1/4/2014 Ove Näslund Java Gaming An overview. 2 1/4/2014 Ove Näslund 2 Content Demos Some game types Java as Game language Game building issues API:s.

Slides:



Advertisements
Similar presentations
1 UNIT I (Contd..) High-Speed LANs. 2 Introduction Fast Ethernet and Gigabit Ethernet Fast Ethernet and Gigabit Ethernet Fibre Channel Fibre Channel High-speed.
Advertisements

2000 Prentice Hall, Inc. All rights reserved. 1 Outline 3.1Introduction 3.2Game Loop Components 3.3How to Implement in C# 3.4Adding Image to XNA Project.
Advanced Piloting Cruise Plot.
1 Applets Programming Enabling Application Delivery Via the Web.
Copyright © 2003 Pearson Education, Inc. Slide 5-1.
Chapter 1 The Study of Body Function Image PowerPoint
OSPF 1.
AQute Eclipse Environment By Peter Kriens CEO aQute OSGi Director of Technology and OSGi Fellow.
Writing Pseudocode And Making a Flow Chart A Number Guessing Game
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
Copyright CompSci Resources LLC Web-Based XBRL Products from CompSci Resources LLC Virginia, USA. Presentation by: Colm Ó hÁonghusa.
Introduction to Metview
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
Exit a Customer Chapter 8. Exit a Customer 8-2 Objectives Perform exit summary process consisting of the following steps: Review service records Close.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Year 6 mental test 10 second questions
1 G54PRG Programming Lecture 1 Amadeo Ascó Adam Moore G54PRG Programming Lecture 1 Amadeo Ascó 3 Java Programming Language.
Game Making with Alice Eat the Hay Game
Mike Scott University of Texas at Austin
Protocol layers and Wireshark Rahul Hiran TDTS11:Computer Networks and Internet Protocols 1 Note: T he slides are adapted and modified based on slides.
1 Java Card Technology Prepared by:Ali Toyserkani Adopted from: Introduction to Java Card Technology C. Enrique Ortiz.
Mehdi Naghavi Spring 1386 Operating Systems Mehdi Naghavi Spring 1386.
ETS4 - What's new? - How to start? - Any questions?
The Platform as a Service Model for Networking Eric Keller, Jennifer Rexford Princeton University INM/WREN 2010.
1 Jini Tutorial, Part 3 Jini Programming. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2.
ABC Technology Project
Mobile Application Development Fall COP 4655 U1 T/R 5:00 - 6:15pm – ECS 135 Steve Luis lecture1.
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
August 2012 This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit
Spring 2014 RMS/EOC Proctor Caching Training. Agenda 2 Proctor caching overview Downloading & installing Cache test content.
70-270: MCSE Guide to Microsoft Windows XP Professional Second Edition, Enhanced Chapter 3: Using the System Utilities.
OFFICE OF SUPERINTENDENT OF PUBLIC INSTRUCTION Division of Assessment and Student Information Online MSP Testing Technology & Assessment Coordinator Training.
OFFICE OF SUPERINTENDENT OF PUBLIC INSTRUCTION Division of Assessment and Student Information Online MSP Testing In-Depth Technology Training January 13,
IP Multicast Information management 2 Groep T Leuven – Information department 2/14 Agenda •Why IP Multicast ? •Multicast fundamentals •Intradomain.
VOORBLAD.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
© 2012 National Heart Foundation of Australia. Slide 2.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
Chapter 9: The Client/Server Database Environment
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Executional Architecture
Implementation Architecture
Template v5 October 12, Copyright © Infor. All Rights Reserved. 1 Learn LN User interface concepts Bram Vijfhuizen Principal.
Macromedia Dreamweaver MX 2004 – Design Professional Dreamweaver GETTING STARTED WITH.
25 seconds left…...
Slippery Slope
Januar MDMDFSSMDMDFSSS
Chapter 10: The Traditional Approach to Design
Systems Analysis and Design in a Changing World, Fifth Edition
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
©2004 Brooks/Cole FIGURES FOR CHAPTER 12 REGISTERS AND COUNTERS Click the mouse to move to the next page. Use the ESC key to exit this chapter. This chapter.
Connecting LANs, Backbone Networks, and Virtual LANs
Intracellular Compartments and Transport
PSSA Preparation.
VPN AND REMOTE ACCESS Mohammad S. Hasan 1 VPN and Remote Access.
Chapter 8 Improving the User Interface
Java Network Programming Vishnuvardhan.M. Dept. of Computer Science - SSBN Java Overview Object-oriented Developed with the network in mind Built-in exception.
AGD: 5. Game Arch.1 Objective o to discuss some of the main game architecture elements, rendering, and the game loop Animation and Games Development.
Presentation transcript:

1/4/2014 Ove Näslund Java Gaming An overview

2 1/4/2014 Ove Näslund 2 Content Demos Some game types Java as Game language Game building issues API:s for 2D game development API:s for 3D game development API:s for Mobile game development Example of game engines Installation

3 1/4/2014 Ove Näslund 3 Some other reading….

4 1/4/2014 Ove Näslund 4 Some game types Arcade games 2D Games 2D Side scroller Isometric tile games 3D games FPS – First Person Shooter 3D Mazes Network games

5 1/4/2014 Ove Näslund 5 Why not Java? To slow? Java isnt slow anymore! Most of a graphic Game is handled by HW Memory problems? Avoiding/ensuring GC is about programming style To high level? C/C++ was that too!! High level OO helps design of complex games Many new API:s for game support Jni

6 1/4/2014 Ove Näslund 6 Why not Java? Installation nightmare Code bloat of JVM – well most games today are > 100MB Slow startup – Yes, but is a small part of game time! Installation – Java Webstart & Install4j Support Sun is more active to add API:s for games Game consoles doesnt support Java! (80% market) But, modern mobile phones support Java!

7 1/4/2014 Ove Näslund 7 Game Framework Game loop Sprites, Animated sprites e.g explosions Collision detection Pausing, exit Image repository (loading and sharing) Model repository Sound player & repository – (Midi, mp3 clips) Object manager – control the GC Input handling – mouse, keyboard, game pad etc Boards e.g. High score list

8 1/4/2014 Ove Näslund 8 Its all about time Update of screen No flicker No stops – hack in viewing Same update speed on all HW Update of game state More important than update of screen

9 1/4/2014 Ove Näslund 9 Time Control Keeping constant time FPS – Frames Per Second UPS – Updates Per Second Normally FPS Upper bound is the monitor refresh rate (70-90 Hz)

10 1/4/2014 Ove Näslund 10 Measuring Time Resolution of time – OS dependent System.currentTimeMillis() – resolution 1-60 ms System.nanoTime() Java 5 – resolution 1-6 ms Java.util.concurrent.TimeUnit Java 5 – ns resolution J3DTimer Java3D – resolution ns Other timers javax.swing.Timer and java.utility.Timer – uses System.currentTimeMillis() and is hard to control Timer in Java Media Framework JMF Game engines

11 1/4/2014 Ove Näslund 11 Sleeping Better Sleeping The Thread.sleep() accuracy is OS dependent (10%- 20% error for a 1 ms sleep time) Oversleep must be handled

12 1/4/2014 Ove Näslund 12 A game loop Update game state Render game state End loop Time calculations Finished? Sleep? Sleep & calc over sleep late? Update game state Yes No Yes No

13 1/4/2014 Ove Näslund 13 while(running) { // Game loop gameUpdate(); gameRender(); // render the game to a buffer paintScreen(); // draw the buffer on-screen afterTime = J3DTimer.getValue(); timeDiff = afterTime - beforeTime; sleepTime = (period - timeDiff) - overSleepTime; if (sleepTime > 0) { // some time left in this cycle try { Thread.sleep(sleepTime/ L); // nano -> ms } catch(InterruptedException ex){} overSleepTime = (J3DTimer.getValue() - afterTime) - sleepTime; } else { // sleepTime = NO_DELAYS_PER_YIELD) { Thread.yield(); // give another thread a chance to run noDelays = 0; }} beforeTime = J3DTimer.getValue(); /* If frame animation is taking too long, update the game state without rendering it, to get the updates/sec nearer to the required FPS. */ int skips = 0; while((excess > period) && (skips < MAX_FRAME_SKIPS)) { excess -= period; skips++; gameUpdate(); // update state but don't render } }

14 1/4/2014 Ove Näslund 14 A little about Collision Detection Boundary check Complex figures are approximated Bit overlap One step-ahead In 3D its about vector mathematics Sphere plane collision Boundary box Ray tracing And time Dont forget large steps… Finally what to do Explode, Bounce, Stop, Penetrate..

15 1/4/2014 Ove Näslund 15 2D and Isometric Game issues Choice of view FSEM or Windows 2D v.s. Isometric Screen size and resolution Moving backgrounds Planning time for loading and GC Graphic and sound Background Event effects – sound synchronized Choice of input

16 1/4/2014 Ove Näslund 16 Some 2D and Isometric algorithms Collision detection Map creation Path finding A* - find the lowest cost way from A to B D* - dynamic A* Flocking

17 1/4/2014 Ove Näslund 17 A* path finding

18 1/4/2014 Ove Näslund 18 Some 3D Game issues Scene graph – the world Floor, boundaries, Sky Creating and loading models Combining 2D and 3D Sprites, menu's etc Viewer position and movement First person camera Hovering following camera Gravity – ground follower, flyer Picking Lightning Collision detection

19 1/4/2014 Ove Näslund 19 Some 3D Game effects & algorithms Particle systems Flocking Growing trees Level of detail

20 1/4/2014 Ove Näslund 20 Desktop API:s for game development Basics JDK Graphics FSEM, Java 2D, Java 3D, (JOGL, LWJGL, GL4Java) Sound JOAL / Sound 3D, JMF Control JInput Distribution Java WebStart, Install4j Other ODEJava

21 1/4/2014 Ove Näslund 21 Some Free Game Engines Free 2D game engines Meat Fighter - GAGE - GTGE - Free 3D game engines Jake2 (Quake2) - JGE - JME -

22 1/4/2014 Ove Näslund 22 JME Game picture

23 1/4/2014 Ove Näslund 23 Building 3D worlds Design tools 3D Studio Max Maya - Autodesk Terragen Monkey World 3D Many more… Some file formats DXF - Autodesk VRML M3G – Mobile (JSR184) MD2 – QuakeII

24 1/4/2014 Ove Näslund 24

25 1/4/2014 Ove Näslund 25 Mobile Game issues Small memory Low processor speed Lack of floating point calc HW support Small screens Inconsistent capability between phones Configuration of screen, MIDP version, input etc Distribution of many configuration versions More…

26 1/4/2014 Ove Näslund 26 Mobile API:s for game development Basics MIDP1.0, MIDP2.0 - Java Game (JSR 134) Graphics Java Game (Sprites), Mobile Java 3D (JSR183), Java Bindings For OpenGL ES (JSR 239), Mascot Capsule Micro3D Engine Sound Java Game, Mobile Media API (JSR 135) Control Java Game Networking Threads Distribution

27 1/4/2014 Ove Näslund 27 Network games – topology host5 host4 host2 host1 host3 host5 host4 host2 host1 host3 Server host5 host4 host2 host1 host3 Ring All-to-all Peer-to-Peer Star

28 1/4/2014 Ove Näslund 28 Network games - issues Protocol - UDP, TCP, http, IP multicasting Game type Bandwidth, firewalls, robustness Fat client vs. fat server logic Security Transport Anonymous users More…

29 1/4/2014 Ove Näslund 29 Java networking API:s Plain sockets UDP/ TCP, Java Secure Sockets Extension - SSL TLS IP multicasting P2P – JXTA URL class J2EE – Servlets Applets (Multicast ?) RMI Service Architecture Jini WebServices e.g Axis Sun Project Darkstar MMORGP (Massive Multiplayer Online Roleplaying Game Platform)

30 1/4/2014 Ove Näslund 30 Packaging and Distribution Java WebStart Install4J