cross-platform game engine
TRANSCRIPT
1
Kiyoung Moon
Cross-Platform Game Engines
Kiyoung Moon
2
Kiyoung Moon
Agenda
• About Computer• Definition of Game Engine.• Definition of Platform.• What is Cross-Platform Game Engines?• Case Study : DeadEngine• Case Study : Unity (If I have time)
3
Kiyoung Moon
History
• When I/you don’t know something about, it is good to have a look at the history.
4
Kiyoung Moon
Computer game is a computer software
• It’s important!– Computer Games = Computer Software
• To make a computer software we should understand about the computer.
5
Kiyoung Moon
Computer
• Computer is a machine to calculate expressions that it is logically described.
• The origin of word ‘Computer’ has come from ‘Computare’ of Latin language.
6
Kiyoung Moon
Where did the computer start?
• Nature.– Nature is just existed.– We can measure it.
• Physics law.– We can measure about it then could get the law.– For example, V = RI(Voltage is multiply of resistance and current)
7
Kiyoung Moon
Abstraction!
• Abstraction is a best tool that human has.– I think
• We can use diagram to express complicate things.
8
Kiyoung Moon
Analog, Digital
• I’m going to talk about the Digital world only.• We can use gate!
Not And OrAmplifier
9
Kiyoung Moon
Combinational, Sequential Logic.
• With the gate, we can make more complicate things.• For example, 4 bits adder.
– 0101 + 0011 = 1000
10
Kiyoung Moon
Full adder
• Take 3 inputs and 2 outputs.
11
Kiyoung Moon
Full adder is complicated!
• Let’s make full adder like this.
12
Kiyoung Moon
Let’s compare these.
• Easy to use, remember.
13
Kiyoung Moon
4 bits adder
0 01 10 0 11
1 0 0 011
11
1
1
0
0
14
Kiyoung Moon
4 bits adder is still complicated.
• Let’s use abstraction!
15
Kiyoung Moon
Instruction Set
• x86, i4004• We can use Computer language to make a computer software.
16
Kiyoung Moon
Computer Language
• Assembler is machine specific.• What does it mean?
– Have to write machine dependent assembler for machines.– Programmer is lazy! Don’t like this.
• So computer language has been invented.– C, C++, C#– Java– Basic and so on...
17
Kiyoung Moon
Software
• OS, Games, Applications are all software.
18
Kiyoung Moon
Big picture
Nature Physics Law
Circuit Abstraction.
Digital World
Analog World
Combinational Logic
Instruction Set
Computer Languages. Software
... ...
19
Kiyoung Moon
Where we are
Nature Physics Law
Circuit Abstraction.
Digital World
Analog World
Combinational Logic
Instruction Set
Computer Languages. Software
... ...
20
Kiyoung Moon
Again. What is game?
• Games are computer software– Computer Games = Computer Software
21
Kiyoung Moon
Computer game is a computer software.
Nature Physics Law
Circuit Abstraction.
Digital World
Analog World
Combinational Logic
Instruction Set
Computer Languages.
Software
... ...
Game
22
Kiyoung Moon
What is Game Engine?
• http://en.wikipedia.org/wiki/Game_engine
• A game engine is a software framework designed for the creation and development of video games.
23
Kiyoung Moon
Game Engine
• Games are very complicated software.• For example, Rendering, Physics, AI, Sounds, Input and so on.
24
Kiyoung Moon
25
Kiyoung Moon
Do I need to implement all of those?!?!
• YES– 10 years ago
26
Kiyoung Moon
Again, abstraction.
• Thankfully not anymore.
27
Kiyoung Moon
Game Engine
Nature Physics Law
Circuit Abstraction.
Instruction Set
Computer Languages.
Software
...
Game
Game Engine
Oh! Yes!!!
28
Kiyoung Moon
Game Engine does every dirty/hard works for you.
• To construct every game systems from the start is hard.• Game Engine abstract all of those hard works for gameplay
programmer so programmer have more time to concentrate on gameplay instead of dirty/hard works.– Someone like me still like those dirty/hard works but it’s obvious.– If I can concentrate on gameplay more, then game is getting more fun.
• Believe or not
29
Kiyoung Moon
List of Game Engines.
• Quake• Id software made it.• Open Source
30
Kiyoung Moon
List of Game Engines
• Unreal Engine• Epic Games made it.• Integrated Game Development Tool• Big Companies
31
Kiyoung Moon
List of Game Engines.
• Unity• Integrated Game Development Tool• Support C#, Boo, JavaScript• Small companies
32
Kiyoung Moon
Other game engines.
• Renderware• C4 Engine• GameBryo• Cocos2D• GameMaker• DeadEngine
– This is my cross-platform engine!
33
Kiyoung Moon
What is Platform?
• http://en.wikipedia.org/wiki/Computing_platform
• A computing platform is, in the most general sense, whatever pre-existing environment a piece of software is designed to run within, obeying its constraints, and making use of its facilities. Typical platforms include a hardware architecture, an operating system (OS), and runtime libraries.[1]
34
Kiyoung Moon
Meaning of Platform is very wide.
• For Game Engine, Platform is a machine environment.• For Example
– xbox360– PC– PS3– Web– Android– iOS
35
Kiyoung Moon
What is Cross-Platform?
• Cross-Platform– http://en.wikipedia.org/wiki/Cross-platform
• In computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms.[1] The software and methods are also said to be platform independent. Cross-platform software may be divided into two types; one requires individual building or compilation for each platform that it supports, and the other one can be directly run on any platform without special preparation, e.g., software written in aninterpreted language or pre-compiled portable bytecode for which the interpreters or run-time packages are common or standard components of all platforms.[2]
Simply cross-platform software runs on different machines.For example, Java application generate ‘byte code’ and it compiled on the fly based on the machines.
36
Kiyoung Moon
Cross-Platform Computer Software
• Normally program runs on specific machines such as PC, Mac and so on.
• If we want program runs on every machines(PC, Mac for example) programmer needs to make two programs.
• Some machine’s environment are exactly same but most of cases it is not.
• What’s mean?– Programmer need to make a program per machines.
37
Kiyoung Moon
You know programmer is lazy!
• We are lazy.– We like to make things– But we don’t like to do same thing again and again.
38
Kiyoung Moon
Concept of Cross-Platform Software
• Concept is simple
ProgramPC
Mac
Environment
Environment
Program
39
Kiyoung Moon
Program
PC
Mac
CommonEnvironment
40
Kiyoung Moon
Example : Endian mode difference.
• PC uses little-endian mode.• PS3(PowerPC) uses big-endian mode.• What is a problem?
– Tool and Game• I choose big-endian mode
– I don’t want to waste of time for game.– PC(For developer) version is ok to be slow.
• Support MemoryStream Class– Programmer don’t need to care about the file format.– Just use MemoryStream’s interface (read, write) and MemoryStream
class does all dirty/hard works.
41
Kiyoung Moon
Case Study : Dead Engine
• DeadEngine is a cross-platform game engine.• Support PC, iOS, Android Platforms.• Games with DeadEngine.
– DressUpBaby, Attack of the pig• Animation Tools
– DeadAnimation
42
Kiyoung Moon
Case Study : Dead Engine
• Full C++ Game Engine.• Provides Rendering, Physics(Box2D), Sounds, Math, Script
systems so on.
43
Kiyoung Moon
How to support PC/Android/iOS?
• I had experiences PC/Android/iOS games.• I could use C/C++ for PC platform. (Yes!)• Android uses Java but there is a way to use C/C++! (Yes!)
– NDK(Native Development Kit)• iOS uses Objective C/C++ but still can use C/C++ (Yes!)• For Rendering, I could use OpenGL ES (PC/Android/iOS)• It was really simple!
– I could use same language for 3 platforms which is really good sign.• Of course, some functions I had to implement more than 2
implementation.
44
Kiyoung Moon
Rendering
• Fortunately OpenGL runs on Android/iOS/PC• Unfortunately some interface were different.
– So I made a common interface class for client programmer and internally has 3 classes.
Client Gameplay
Programmer
PC
Android
iOS
KRendering
PC specific rendering
code
Android specific
rendering code
iOS specific
rendering code
EngineGameplay
45
Kiyoung Moon
Audio(Sound)
• There are Open source audio library but the performance wasn’t good enough so I had to implement 3 audio classes.– Same as rendering... now you know cross-platform is not free. Some
one have to do this dirty/hard works.
46
Kiyoung Moon
Case Study : Unity
• Unity is a cross-platform game engine.• Unity is not source based game engine.• Gameplay programmer can use C#, Boo, Java Script for
gameplay logic.• Support all kind of platforms such as pc, android, iOS, web,
console and so on.
47
Kiyoung Moon
Case Study : Unity
• Good Things– It support many platforms and easy to change platforms.
• Fact• Many Korean game companies (include small studio) uses Unity Engine for
their games.• Bad Things
– Performance issue can be raised.– With my experience native app is 6 times smaller than the app with
Unity Engine.– More than 2 times slower than native app.– Source is not available (we can buy it if we have money)
• Can’t do anything if there is a problem happen. Have to wait for next update.
48
Kiyoung Moon
Summary
• Computer game is equal to computer software.• Abstraction is the best tool.• Cross-platform is must have features of recent game engines.• Game Engine has trade offs.
– Compare to native program.– Normally native program is faster/smaller than the program use game
engines.• Cross-platform is not free.
– If you are making an engine yourself you have to implement all of those features!
49
Kiyoung Moon
Q/A
Thank you