Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming •...

51
Rapid 3D Game Development in Rapid 3D Game Development in Rapid 3D Game Development in Rapid 3D Game Development in Blender 2.5 Blender 2.5 Blender 2.5 Blender 2.5 Arun Ravindran www.arunrocks.com

Transcript of Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming •...

Page 1: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Rapid 3D Game Development in Rapid 3D Game Development in Rapid 3D Game Development in Rapid 3D Game Development in Blender 2.5Blender 2.5Blender 2.5Blender 2.5Blender 2.5Blender 2.5Blender 2.5Blender 2.5

Arun Ravindranwww.arunrocks.com

Page 2: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

• Introduction to 3D Game Programming• Components of Typical 3D Games

• Python 3D Game Development • Blender Game Engine • Blender 2.5 Basics • Blender 2.5 Basics

• Case Study: A Simple 3D Game• Further Reading

Page 3: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

(Re)visiting 3D Games(Re)visiting 3D Games

Page 4: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game
Page 5: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

GenresGenres

Page 6: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Action – FPSAdventure

RPGPuzzlePuzzleSimsSportsStrategy

Page 7: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Game EngineGame Engine

Page 8: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Game Engine

Physics engine Sound engine

Scripting engine Animation engine

Game Engine

AI engine Networking

Resource mgmt …

Page 9: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Don’t write your own!

Industry Insider Tip #87

Don’t write your own!

Page 10: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Programming 3D Games in PythonProgramming 3D Games in Python

Page 11: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Python 3D game enginesGame EnginesGame EnginesGame EnginesGame Engines RemarksRemarksRemarksRemarks

PyOpenGL

Python-Ogre

Pyrr

pyglet

Only Rendering, Not Full Game Engine

Panda3D game engine in C++ with python

integration

Soya 3D / PySoy High level 3D engine for Python

Blender Game Engine Game engine, modeler, animator

Sylphis3D commercial game engine with GPL

version

Page 12: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Blender Game engine (BGE)Blender Game engine (BGE)

Page 13: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Blender Game Engine

Physics engine Sound engine

Scripting engine Animation engine

Blender Game Engine

AI engine Networking

Resource mgmt …

PythonPythonPythonPython

Page 14: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Where has BGE been used?

Page 15: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

ColorCube Puzzle game $

SAAB-91 Virtual RaceBFight

"A Furry Vendetta“, Yo Frankie! Project"A Furry Vendetta“, Yo Frankie! ProjectArchitectural Visualizations

Physics Simulations

Page 16: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

What kind of games can be made with BGE?BGE?

Page 17: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

FPS?Multiplayer?Orthographic?Orthographic?

Platform?

Page 18: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

All of themAll of themAll of themAll of them

Page 19: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Two ways of making games

Page 20: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

1. Code a Game loop

Page 21: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

do

get player input

do calculations do calculations

repaint screen

loop while not game over

Page 22: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Yawn!

Page 23: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

2. Click and drag game creation (the Blender Blender Blender Blender way)(the Blender Blender Blender Blender way)

Page 24: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

100% Code-free **

** Conditions Apply***: The conditions under which you do not need to write any code are as follows: 1. The game you are trying to

build is completely free of any complex logic such as bot AI, path finding, complex simulations 2. There is no multiplayer requirement. 3. There are no complex collisions outside that can be handled by default bullet engine

*** All these conditions are fake

Page 25: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Understanding the way of Logicof Logic

Page 26: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Understanding the way of Logic Machinesof Logic Machines

Page 27: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

What is a Machine?

Page 28: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Reacts to StimulusEvaluates some logicPerforms an actionPerforms an action

Page 29: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Take any Machinecoffee machine | fire alarm | firecracker

Page 30: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

ReactsReactsReactsReacts to StimulusEvaluatesEvaluatesEvaluatesEvaluates some logicPerformsPerformsPerformsPerforms an actionPerformsPerformsPerformsPerforms an action

Page 31: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

ReactsReactsReactsReacts EvaluatesEvaluatesEvaluatesEvaluates PerformsPerformsPerformsPerforms

Page 32: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

A Crash Course to Blender 2.5 (Beta)

Page 33: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

A Crash Course to Blender 2.5 (Beta)

Yes, it may crash!

Page 34: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game
Page 35: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

What’s new in 2.5?

Page 36: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Major rewrite of Blender API GUI finally works! (Discover)GUI finally works!

New Smoke SystemPython Based GUI

Page 37: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

What’s new in BGE 2.5?

Page 38: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

* Faster!* New sound system (ogg, mp3, wav…)

* Real-time external IK targets* Ability to use raw OpenGL code (GUIs)* Ability to use raw OpenGL code (GUIs)* Dynamic loading/freeing of assets

* Python API improvements

Page 39: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Some BGE concepts

Page 40: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Modeling & Texture mapping

Page 41: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Types of Sensors

Page 42: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Types of Controllers

Page 43: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Types of Actuators

Page 44: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Packaging Your Blender Game

Page 45: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Blender PlayerCrystalBlendCrystalBlend

GameKit

Page 46: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Pros & Cons of BGE

Page 47: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

☺ No code ☺ No Compilation

☺ Out-of-the-box Physics☺ Out-of-the-box Physics☺ No Integration Issues

☺ Python 3.1! 1st

Page 48: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

� Graphical Logic Complexity� Sparse Documentation� Unconventional Approach� Unconventional Approach

� Optimisations?

Page 49: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Case Study: Pacman 3D

Page 50: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Learn more

http://www.blender.org/documentation/250PythonDoc/

http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro

Page 51: Rapid 3D Game Development in Blender 2 - PyCon India · • Introduction to 3D Game Programming • Components of Typical 3D Games • Python 3D Game Development • Blender Game

Thank You

Follow @arocks