+ All Categories
Home > Documents > Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

Date post: 21-Dec-2015
Category:
View: 222 times
Download: 1 times
Share this document with a friend
Popular Tags:
21
Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery
Transcript
Page 1: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

Chapter 3.2C++, Java, and Scripting Languages

hacked by jeffery

Page 2: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

2

C++

C used to be the most popular language for games

Today, C++ is a popular language for game development

Page 3: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

3

C++: Strengths

Performance Control over low-level functionality

(memory management, etc) Can switch to assembly or C when

necessary Good interface with OS + hardware

Page 4: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

4

C++: Strengths vis-a-vis C

High-level, object-oriented High-level language features are

essential for making today's complex games

Inheritance, polymorphism, templates, and exceptions...

Strongly typed, has improved reliability compared w/ C

Page 5: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

5

C++: Strengths

C Heritage the primary high-level language that is

backwards-compatible with C Has APIs and compiler support in

all platforms Folks know it

Page 6: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

6

C++: Strengths

Libraries STL (Standard Template Library)

Comprehensive set of standard libraries Boost: widely used library with wide

variety of functionality Qt, Rabin, let's not forget Qt SDL, Ogre, etc. Many commercial libraries available

Page 7: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

7

C++: Weaknesses

Too low-level Still forces programmers to deal with

low-level issues Too error-prone Attention to low-level details is overkill

for high-level features or tools Blog after Blog, game developers write

their own scripting language atop it.

Page 8: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

8

C++: Weaknesses

Too complicated Because of its C heritage, C++ is very

complicated Long learning curve to become

competent with the language

Page 9: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

9

C++: Weaknesses

Lacking features No reflection or introspection features No method of object serialization No native support for message passing

Page 10: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

10

C++: Weaknesses

Slow iteration C++ is fully compiled into binary

format from source code Compiling large numbers of files is

very slow This will only become more of a

problem as games become more complex

Page 11: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

11

C++: When to Use It?

When performance is crucial If your current code base is mostly C and

C++ If you have a lot of in-house expertise in

C++ Avoid using it for high-level code, such as

tools

Page 12: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

12

Java and C# for Game Development

Why use Java/C#? Simplifies many C++ features Adds several useful high-level features (Java: Easy to develop for multiple

platforms) Good library support

Page 13: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

13

Java/C# for Game Development

Performance Notably weaker than C/C++ Has improved in the last few years:

still not up to C++ level, but very close Just-In-Time compiling and HotSpot

optimizations, etc. Now has high-performance libraries Also has access to native functionality

Page 14: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

14

Java/C# for Game Development

Platforms Well suited to downloadable and

browser-based games Dominates development on mobile,

handheld platforms, e.g. Android Possible to use in full PC games Not used (much?) in consoles

Page 15: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

15

Java in Game Development

Commercial games using Java Downloadable games like those from

PopCap Games: Mummy Maze, etc Online card games PC games using Java as a scripting

language: Vampire: The Masquerade, Star Wars Galaxies

PC games fully written in Java: You Don't Know Jack, Who Wants to Be a Millionaire

Page 16: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

16

C# in Game Development

Some prominent server-side and mono-based uses, e.g. SecondLife

XNA Game Studio Express Free for students/hobbyists

Page 17: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

17

Scripting Languages + VHLLs

Why use scripting languages and very high level languages? Ease and speed of development Short iteration time Code becomes a game asset Offer additional features and are

customizable

Page 18: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

18

Scripting Languages

Drawbacks Slow performance

Limited tool support Dynamic typing makes it difficult to

catch errors Awkward interface with the rest of the

game Difficult to implement well

Page 19: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

19

Scripting Languages

Popular scripting languages Python, Ruby, Lisp/Scheme,... Javascript, Actionscript, etc. Custom scripting languages

UnrealScript, QuakeC, NWNScript

Page 20: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

20

Scripting Languages

How to choose a scripting language What features do you need? What performance requirements? What debugging facilities does the

language have? On what platforms does it need to run? What resources and expertise are

available?

Page 21: Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.

21

VM as Game Engine

Game engines are typically extended with scripting languages

Games are written in a mix of systems-level (C/C++), app-level (Java/C#), and interpreted code

What would VMs need in order to replace game engines??


Recommended