Download presentation
Presentation is loading. Please wait.
Published byMaximillian Bishop Modified over 8 years ago
1
Myths1 The Myths (and Truths) of Java Games Programming Andrew Davison Dept. of Computer Engineering Prince of Songkla University Hat Yai, Songkhla 90112 Thailand ad@fivedots.coe.psu.ac.th
2
Myths2 In a Nutshell v Java for games programming: are you joking? v No, Java is a great games programming language.
3
Myths3 The Familiar Advantages v The object-oriented paradigm. v Cross-platform support. v Code reuse. v Ease of development. v Tool availability. v Reliability and stability. continued
4
Myths4 v Good documentation. v Support from Sun Microsystems. v Low development costs. v The ability to use legacy code (e.g. C, C++) v Increased programmer productivity. v It's fun, especially for games programming.
5
Myths5 Java Bashing 1. Java is too slow for games programming. 2. Java has memory leaks. 3. Java is too high-level. 4. Java application installation is a nightmare. 5. Java isn't supported on games consoles. 6. No one uses Java to write 'real' games. 7. Sun Microsystems isn't interested in supporting Java gaming. Almost all of these are substantially wrong.
6
Myths6 Wake up, it's 2006 v These objections had more validity in the late 1990s –the language and its libraries were less sophisticated and slower –lots of hype led to lots of disappointment
7
Myths7 1. Java Is Too Slow For Games Programming v Or "Java is slow compared to C and C++, the dominant languages for games programming at the moment." v JDK 1.0 (1996): 20 to 40 times slower than C++ v J2SE 5: only 1.1 times slower v Java SE 6 is about 20% faster than J2SE 5 continued
8
Myths8 v Speed depends on the application and coding style –Java programmers must be good programmers v Jack Shirazi's Java Performance Tuning site –http://www.javaperformancetuning.com/
9
Myths9 The Hotspot Compiler v Introduced in J2SE 1.3. v The run-time system identifies areas of code that are utilized many times, and aggressively compiles them. v Program execution is often slow at the beginning until the code has been analyzed and compiled –splash screens API in Java SE 6
10
Myths10 Slow-Moan 1: Swing is Slow v Swing GUI components don't use the OS much –portability, controllablilty –extra layer of processing above OS v Some games applications use the older, lower-level AWT GUI libraries. continued
11
Myths11 v J2SE 5/6 Swing uses OpenGL/DirectX more directly v Most games don't require complex GUIs –full-screen game play with mouse and keyboard controls is the norm –mouse and keyboard processing is dealt with by the AWT –full-screen mode
12
Myths12 Slow-Moan 2: my Program is Slow (because of Java) v Where to lay the blame? –graphics rendering: OpenGL or DirectX –network games: the network
13
Myths13 2. Java Has Memory Leaks v Uhh? –Java doesn't offer pointer arithmetic –out-of-bounds array accesses are caught
14
Myths14 Possible Meaning 1 v Defunct objects are not being garbage collected. v Due to bad programming style –the garbage collector can only do its job when an object is completely dereferenced
15
Myths15 Possible Meaning 2 v Garbage collector is executing at poorly timed intervals. v The JVM comes with several different garbage collectors –can be selected/fine-tuned from the command line
16
Myths16 Profiling Tools v Java SE 6: jps, jstat, jhat, and jstack v Many third-party tools –e.g. JProfiler
17
Myths17 3. Java Is Too High-level v Abstraction versus speed and control –C++ is too high-level –C is too high-level –assembler is too high-level –ICs are too high-level –an abacus is sufficient for all our computing needs
18
Myths18 Historical Observation v The gaming community used to think that C and C++ were too high-level. Until: –Doom and Dungeon Master, mid 1980s –cross-platform development tools u e.g. RenderWare, Gamebryo
19
Myths19 High-level Moan 1 v Java’s use of classes, objects, and inheritance add too much overhead without enough coding benefit. v Class libraries are essential: –high-speed I/O, advanced 2D and 3D graphics, networking, etc. v Object-oriented design (UML)
20
Myths20 High-level Moan 2 v Low-level, fast operations -- such as direct Video RAM I/O -- are impossible. v Full-screen mode –page flipping –control over the screen's resolution and image depth v Graphics rendering using OpenGL and DirectX.
21
Myths21 High-level Moan 3 v Java can't use game peripherals –e.g. joysticks and game pads v Yes it can: –JNI, the Java Native Interface –JInput, the game devices API u https://jinput.dev.java.net/
22
Myths22 4. Installation Is A Nightmare 1.Java has to be on the machine before the application will run. 2.Code bloat –even small programs require a 16 MB JRE 3.Frequently changing JVMs. 4.Non-standard components are often required (e.g. Java 3D). continued
23
Myths23 5. It's not possible to compile the application for a specific platform. 6. The.jar extension is hijacked by other software 7. The JRE is slower to start up compared to a native compiled application. v Solved with good installation software –except for 2 and 7
24
Myths24 Many Installation Options v Applets v Java SE 6 plug-in –for Internet Explorer v Java Web Start (JWS) – improved significantly since J2SE 1.4. v Third-party installers –e.g. install4j
25
Myths25 Code Bloat v Increasingly irrelevant –many games weighing in at over 100 MB –many graphics and sound card drivers are larger than 15 MB v Network speeds are a problem, especially overseas –broadband usage is growing rapidly
26
Myths26 Others v Sun Microsystems estimates that around 70% of all new PC's come with a JRE pre-installed. v Slow start-up time, but –better in Java SE 6 –fairly negligible compared to the total running time –Java SE 6's splash screen API
27
Myths27 5. Java Isn't Supported On Games Consoles v This criticism has some justification. v Two important games platforms: –the PS2 and Windows –Java isn't available on the PS2 continued
28
Myths28 v Actually it is possible to run Java on the PS2 using Sony's version of Linux, but: –the OS requires the PS2 to have a hard disk –only limited access to hardware v Two trends that may help Java: –consoles are mutating into home media devices –the rise of online gaming
29
Myths29 Java on the PS3? v Basic/premium PS3 versions will have –512 MB of RAM, a large hard drive, Linux support, OpenGL v Casual games programming on the PS3 –development kits in Spring 2007 –support for an object-oriented language u probably C++/C –virtual machine utilizes JIT technology Probably Not
30
Myths30 Blu-ray Drives v Support a version of Java called BD-J for: –interactive menus, GUIs –networking applications
31
Myths31 Other Markets v The PC market is far from miniscule –US$ 953 million by the end of 2008 –over a billion in 2009 v Games on PCs –superior, modern hardware u video cards, RAM, internet connections –more exciting game play –many more PC games, particularly in the area of multiplayer online games continued
32
Myths32 v Mobile gaming –sales rising to US$ 2.5 billion in 2007 –thought to be around 250 million Java-enabled phones –Java ME
33
Myths33 6. No One Uses Java To Write Real Games v The number of commercial Java games is small, but growing –won awards and bestsellers –e.g. Tribal Trouble, Puzzle Pirates, Call of Juarez, Chrome, Titan Attacks, Star Wars Galaxies, Runescape, Alien Flux, Kingdom of Wars, Law and Order II, Ultratron, Roboforge, IL-2 Sturmovik, Galactic Village, Wurm Online,... continued
34
Myths34
35
Myths35
36
Myths36
37
Myths37
38
Myths38 v Java is used widely in the casual gaming market –game play is more innovative –implementation timelines are shorter –budgets smaller –less man-power needed v By 2008, the casual games market will surpass US$2 billion in the US. Casual Gaming Market
39
Myths39 Many Java Gaming Sites v Sun Microsystems showcase –http://www.java.com/en/games/ v Community pages –http://community.java.net/games/ v Open-source gaming tools –https://games.dev.java.net/ continued
40
Myths40 v The Java Games factory –http://javagamesfactory.org/ v Works-in-progress –https://games-forge.dev.java.net/ v JavaGaming forums –http://www.javagaming.org/
41
Myths41 JavaGaming.org v Best source of technical advice –over 9000 highly opinionated registered users v Discussion topics –Java 3D, Java 2D, Java Sound, J2ME, networking, online games development, performance tuning, JOGL, JOAL, JInput, and more
42
Myths42 Open-source Gaming Tools v JOGL, a Java binding for OpenGL v JOAL, a binding for OpenAL (a 3D audio library) v JInput, a game devices API v games-middleware and games-forge sections https://games.dev.java.net/
43
Myths43 Books continued
44
Myths44 http://fivedots.coe.psu.ac.th/~ad/jg due out in May 2007
45
Myths45 7. Sun Isn't Interested v J2SE 1.3 –improved graphics and audio capabilities v Version 1.4 –full-screen mode and page flipping in hardware –faster I/O, memory mapping –support for non-block sockets u useful in client/server multiplayer games continued
46
Myths46 v Version 5.0 –nanosecond timer v Java extension libraries, e.g. –Java 3D –JMF (the Java Media Framework) –the Java Communications API –JAXP (Java’s peer-to-peer API) continued
47
Myths47 v Java SE 6 –improved graphics rendering speeds –splash screen API, scripting, desktop API v Sun-sponsored websites –http://www.javagaming.org –http://www.java.net –http://community.java.net/games/
48
Myths48 Sun's Project DarkStar v Tools for supporting massive multi-player online games. –server side: Sun Game Server (SGS) –client APIs for C++, Java SE, and Java ME http://games-darkstar.dev.java.net
49
Myths49 8. In a Nutshell v Java for games programming: are you joking? v No, Java is a great games programming language.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.