The Myths and Truths of Java Games Programming
- Slides: 49
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 Myths 1
In a Nutshell v Java for games programming: are you joking ? v No, Java is a great games programming language. Myths 2
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. Myths continued 3
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. Myths 4
Java Bashing 1. 2. 3. 4. 5. 6. 7. Myths v Java is too slow for games programming. Java has memory leaks. Java is too high-level. Java application installation is a nightmare. Java isn't supported on games consoles. No one uses Java to write 'real' games. Sun Microsystems isn't interested in supporting Java gaming. Almost all of these are substantially wrong. 5
Wake up, it's 2006 v These objections had more validity in the late 1990 s – the language and its libraries were less sophisticated and slower – lots of hype led to lots of disappointment Myths 6
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 J 2 SE 5: only 1. 1 times slower v Java SE 6 is about 20% faster than J 2 SE 5 Myths continued 7
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/ Myths 8
The Hotspot Compiler v Introduced in J 2 SE 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 Myths 9
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. Myths continued 10
v J 2 SE 5/6 Swing uses Open. GL/Direct. X 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 Myths 11
Slow-Moan 2: my Program is Slow (because of Java) v Where to lay the blame? – graphics rendering: Open. GL or Direct. X – network games: the network Myths 12
. 2 Java Has Memory Leaks v Uhh? – Java doesn't offer pointer arithmetic – out-of-bounds array accesses are caught Myths 13
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 Myths 14
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 Myths 15
Profiling Tools v Java SE 6: jps, jstat, jhat, and jstack v Many third-party tools – e. g. JProfiler Myths 16
. 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 Myths 17
Historical Observation v The gaming community used to think that C and C++ were too high-level. Until: – Doom and Dungeon Master, mid 1980 s – cross-platform development tools u e. g. Render. Ware, Gamebryo Myths 18
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 2 D and 3 D graphics, networking, etc. v Object-oriented design (UML) Myths 19
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 Open. GL and Direct. X. Myths 20
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/ Myths 21
. 4 Installation Is A Nightmare 1. 2. Java has to be on the machine before the application will run. Code bloat – even small programs require a 16 MB JRE 3. 4. Myths Frequently changing JVMs. Non-standard components are often required (e. g. Java 3 D). continued 22
5. 6. 7. v Myths It's not possible to compile the application for a specific platform. The. jar extension is hijacked by other software The JRE is slower to start up compared to a native compiled application. Solved with good installation software – except for 2 and 7 23
Many Installation Options v Applets v Java SE 6 plug-in – for Internet Explorer v Java Web Start (JWS) – improved significantly since J 2 SE 1. 4. v Third-party installers – e. g. install 4 j Myths 24
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 Myths 25
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 Myths 26
5. Java Isn't Supported On Games Consoles v This criticism has some justification. v Two important games platforms: – the PS 2 and Windows – Java isn't available on the PS 2 Myths continued 27
v Actually it is possible to run Java on the PS 2 using Sony's version of Linux, but: – the OS requires the PS 2 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 Myths 28
Java on the PS 3? Probably Not v Basic/premium PS 3 versions will have – 512 MB of RAM, a large hard drive, Linux support, Open. GL v Casual games programming on the PS 3 – development kits in Spring 2007 – support for an object-oriented language u probably C++/C – virtual machine utilizes JIT technology Myths 29
Blu-ray Drives v Support a version of Java called BD-J for: – interactive menus, GUIs – networking applications Myths 30
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 Myths cards, RAM, internet connections – more exciting game play – many more PC games, particularly in the area of multiplayer online games continued 31
v Mobile gaming – sales rising to US$ 2. 5 billion in 2007 – thought to be around 250 million Java-enabled phones – Java ME Myths 32
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, . . . Myths continued 33
Myths 34
Myths 35
Myths 36
Myths 37
Casual Gaming Market 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. Myths 38
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/ Myths continued 39
v The Java Games factory – http: //javagamesfactory. org/ v Works-in-progress – https: //games-forge. dev. java. net/ v Java. Gaming forums – http: //www. javagaming. org/ Myths 40
Java. Gaming. org v Best source of technical advice – over 9000 highly opinionated registered users v Discussion topics – Java 3 D, Java 2 D, Java Sound, J 2 ME, networking, online games development, performance tuning, JOGL, JOAL, JInput, and more Myths 41
Open-source Gaming Tools https: //games. dev. java. net/ v JOGL, a Java binding for Open. GL v JOAL, a binding for Open. AL (a 3 D audio library( v JInput, a game devices API v games-middleware and games-forge sections Myths 42
Books Myths continued 43
due out in May 2007 http: //fivedots. coe. psu. ac. th/~ad/jg Myths 44
. 7 Sun Isn't Interested v J 2 SE 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 Myths in client/server multiplayer games continued 45
v Version 5. 0 – nanosecond timer v Java extension libraries, e. g. – Java 3 D – JMF (the Java Media Framework) – the Java Communications API – JAXP (Java’s peer-to-peer API) Myths continued 46
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/ Myths 47
Sun's Project Dark. Star http: //games-darkstar. dev. java. net v Tools for supporting massive multi-player online games. – server side: Sun Game Server (SGS) – client APIs for C++, Java SE, and Java ME Myths 48
. 8 In a Nutshell v Java for games programming: are you joking? v No, Java is a great games programming language. Myths 49
- Open source java games
- Types of games indoor and outdoor
- Hunger games chapter questions and answers
- 2 truths and a lie
- Permanent states present simple
- Two truths and a wish examples
- 2 truths and a lie instructions
- Myths and legends quiz questions and answers
- What is a soliloquy?
- The study of basic truths
- Eight noble truths
- Tag title author genre example
- Three universal truths
- Other faiths
- Behold these truths to be self evident
- What are 4 noble truths
- Four noble truths siddhartha
- We hold these truths to be self evident
- Four noble truths
- Four noble truths
- Scopes monkey trial apush definition
- Tengrism gods
- Hyacinth and narcissus
- Poland urban legends
- Legends and myths difference
- Myth legend fable
- Fables and legends
- Myths and legends of king arthur
- Myths of greece and rome
- Elements of science fiction and myths legends folktales
- What is a folktale example
- Irish myths and legends lesson plans
- Myths and legends of flight
- Fairy tale jeopardy
- Sipapuni
- What are legends?
- Hurricanes myths and facts
- Myths and fallacies about non communicable diseases
- Folktales examples
- Heroes myths and legends
- Java introduction to problem solving and programming
- Udp socket programming in java
- Java introduction to problem solving and programming
- Java introduction to problem solving and programming
- Java applet games
- Perbedaan linear programming dan integer programming
- Greedy programming vs dynamic programming
- Windows 10 system programming, part 1
- Integer programming vs linear programming
- Definisi integer