1 / 5

C++, Java, and Scripting Languages

C++, Java, and Scripting Languages. C++ and Game Development Strength Performance

posy
Download Presentation

C++, Java, and Scripting Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. C++, Java, and Scripting Languages C++ and Game Development Strength Performance Traditionally, performance has been king in anything related to game development. Games often push hardware to the limits and try to do the unexpected. Today, with the advent of powerful hardware in the form of modern PCs and game consoles, this is not as much of an issue except for a few performance-critical sections of the game. C++ is a very efficient language, and its constructs map very closely to low-level operating system functionality and even hardware operations. C++ also makes the performance cost for each operation very explicit. Memory management is left up to the programmer, so there is no automated garbage collection In the rare situation where the performance provided by C++ is not enough, we always have the option to drop to C or even straight assembly language. High-level features: OOP, exception handling, all high-level features implemented efficiently, const correctness. C heritage Libraries: for OpenGL and DirectX Standard Template Library: Containers , Algorithms

  2. C++, Java, and Scripting Languages C++ and Game Development Weaknesses Too low level Too complicated Lacking features no reflection/introspection, object serialization, message passing. Slow development iteration support (frequent re-compilation) When to use it? C++ is a very good match for any code where performance is crucial. Tools is another area in which C++ is not a perfect fit.

  3. C++, Java, and Scripting Languages Java Why Java Java introduced several high- level features that are very useful in game development. Java has a serialization mech- anism through which objects can easily save and restore their state to the disk or even the network. It is also possible for a Java object to query its own structure through the functionality provided by reflection. Because Java programs run directly on the JVM, they are completely isolated from the actual hardware on which they run. Support porting games to different hardware platforms. Lack of low-level hardware control Performances Java’s performance is now catching up C++’s, because of optimized Just-In-Time compilation in JVM Supporting hardware-accelerated 3D graphics through OpenGL binding, using JNI. Lack of user-controlled memory management Platforms: PCs and handheld/mobile devices, but not game consoles.

  4. C++, Java, and Scripting Languages Scripting Languages Why scripting languages Easy of development (using high-level/game-specific commands) Sorter development iteration time Code becomes and (reusable) asset Features (e.g. AI behavioural scripts) Drawbacks of scripting languages Slower performance (because of interpreted, auto-memory management) Lack of tool support Hard to catch errors (type-less or dynamically typed, exception handling) Interfacing with rest of the game The scripting language code sits on top of all the engine and game code, which was probably written in C++. Interfacing usually involves having to explicitly flag C++ functions as being “exported” to the scripting language. Popular scripting languages: Python; Lua Other off-the-shelf languages: Ruby, Perl, JavaScript Custom languages UnrealScript (Unreal engine), QuakeC (Quake engine), NWNScript (Neverwinter Nights) for MODs creation

  5. C++, Java, and Scripting Languages Scripting Languages Choosing a scripting language Do you need a scripting language? A scripting language is a great tool for rapid development iteration, experimentation, and future modifications. Most games of a reasonable complexity will greatly benefit from the use of a scripting language to implement most of their high-level game code. What features do you need? A general scripting language that replaces C++ for the high-level game code A more specialized scripting language What kind of performance do you need? Do you need to write code in a scripting language that is going to be almost as fast as C++, are you willing to give up some performance? What debugging facilities does the language have? If most of your high-level game code is written in a scripting language, you will definitely want to have a full-blown debugger for that language. Having adequate debugging facilities in a game that makes heavy use of scripting can mean the difference between shipping a great game or not shipping at all. On what platform does the scripting language need to run? Platform dependent vs. platform independent scripting languages What expertise and resources do you have available?

More Related