Halloween Costume ideas 2015

BGE / Game Logic Start

I am starting to get into Blender Game Engine (BGE) recently.

This BGE study and research is in tandem to my Python programming study specifically for 3D packages (Blender, Maya, Houdini) and Unity 3D and all related matters.

As of today, I am very much beginner with game development and BGE. I am still looking into many YouTube videos and also I am referencing many books as much I can get from the library. All the references I found useful will be listed here on this first post on BGE.

Most of my understanding of BGE is actually by reading this book title "Blender Game Engine Beginner" by Victor Kuller. There are few old books and articles that I read previously that touch BGE, and that also helps my interest with BGE. But that book by Victor is really the basis of this article.

This post will probably just be a summarize or collected notes from many other sources.

WHY INTO GAMES?

Game Design and Development is probably another area that I deeply want to get into from the day I started to learn about animation in Computer Graphics. I bet that your interest in Computer Graphics also came from Film Visual Effects or Games.

These days, in the field of Computer Graphics, both Film and Games, and also Multimedia (AR - Augmented Reality - being one of the latest exciting technology) are kind of merging more than ever. Virtual world is brought closer into physical world via AR, and games interaction and environment is something we should understand better so that we can provide users with 3D contents to interact with.

Games being very important at the moment because today's game can give more immersible experience than film. That statement is arguable. However, I think some recent games that are story-character based, such as "Sleeping Dog" are very immersive. One can play or watch games like that for hours (longer than film), and still interested to see more!

Understanding Game Logics in general will help you further the capability you have within Blender and perhaps to understand Computer Graphics Animation and User Interaction in general.

You could setup a Machinima type of presentation or entertainment that you can record and play in real-time. Not just that, you can probably use Game Engine to create cool behaviour effects (based on Near, to Trigger Action) that you can bake and use normally for Cycles Render.

There is a nice note on "recording" BGE Physics here at Blender Wiki:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Game_Engine/Physics

Also this YouTube Video from CGBoorman:
http://www.youtube.com/watch?v=SMOtQ_ZswAA&feature=plcp

GAME RELATED BOOKS:

GAME RELATED LINKS:

  • Game Development for iOS with UNITY3D by Jeff W. Murray

BGE RELATED BOOKS:

BGE RELATED YOUTUBE VIDEOS AND CHANNELS:

BGE CREATED GAMES:

BGE RELATED LINKS:

  • Burster - Online BGE Games Publishing
    http://geta3d.com/
  • http://www.tutorialsforblender3d.com

SEE ALSO TOOLS LIKE

  • Alice 3D
  • Panda 3D

ONE'S FIRST EXPLORATION OF BGE

Ok, so you know Blender (or other 3D packages) and you have some 3D knowledge on modeling, texturing, rigging, animation, lighting, rendering, particle, etc. 

Now, you probably thinking: "I am ready, I want to make my own game!". But, where to start? 
  • Do I need to know programming? 
  • Is it difficult? 
  • Can I create game just by using Blender and a single computer?
Those are the questions that arise when I started as well. The answers, if I were to answer my own questions:
  • No, you don't need to know programming to create a 3D game. There are tools that allow you to create game, without a single code. BGE actually gives you the tools. But, eventually if you are serious with game development, you need to learn coding. Python, Javascript, Java, C++ are some of the codes commonly used.
  • Easy or difficult is relative. But I think creating game is both challenging and fun. Providing time and dedication and guidance, you can create games. I am sure it used to be more difficult. Well, technology has changed, so nowadays the quality is more demanding. While often we have to "reinvent the wheel, trying to solve the old questions", but resources have never been so available. If something too easy, you probably get bored really easily. It should not be the case. Like learning programming, of course you found sometimes you are stuck, but there must be another way or maybe you will get it some other time. Just never give up.
  • Yes, you can create high quality games by using Blender and a single computer.
UPDATE 2012.10.08:
This great YouTube video by Goran Milovanovic explains the basic of BGE:

(Thanks to eBoy for the link!)

Goran goes over the advance feature of BGE via Python:
THINK SIMPLE AND CLASSIC GAMES FOR NOW
Simple games:
- Platform games
- Shooting games
- Puzzle games

(Simple does not mean easy.)

Creating 3D for Games, unlike 3D for Films, will require you to setup a real-time environment where user can interact with. The game render is in REAL-TIME, which is the main difference to film, where 3D is pre-rendered into still images. This is quite similar to how Animation, Particles or Physics simulation is set, but in game, everything behaves in real time. NOTE: Although, there are of course games that uses rendered Sprite images as assets.

What cooler with game is that you actually create an INTERACTIVE media that users can play and interact with. So you don't just create something that is linear in term of experience, but you can create some kind of non-linear story.

Blender comes with its own Game Engine, a platform, a framework, whatever it is called, that allow you to build game with all connected assets (3D model, animation, sound) and test your game right away from within Blender interface. You can also easily export out the executable package (EXE) or APP to be played in any computer platform (PC, Mac, Linux).

BGE is really a fantastic special feature that is really not integrated normally in other 3D packages. 

NOTE:
These days Unity is the "Game Engine" or "Asset Management" that is widely used for Game Creation. But I think before learning Unity, BGE is a good starting point to understand the Game Logic and also you can practice Python scripting for Game Programming inside BGE.

I reckoned that for us learning Unity 3D workflow is good idea as well.  This is one of the authoring tools used mainly in commercial game production or maybe for your independent game project. Concept is very similar anyway. True Blender artists should be able to easily blend to other tools!


To switch to Blender Game environment, all you need to do is to switch to Blender Game (renderer), and hit P (play) on the 3D Viewport or click on that button "Start" on the properly panel. Hit Esc on the keyboard to get out of real-time BGE rendering mode and back to normal 3D viewport.

Get used to the idea of switching from normal 3D Scene View and Game View to test your game.

To get a better representation of the real-time 3D game rendering, with proper texture and lighting, you want to switch on GLSL and Texture Mode.


BGE: STATIC DYNAMIC

At the moment, nothing exciting will happen inside the 3D Game Engine when you run it. Everything is just static. That default Cube is static and does nothing, same case with the default Light/Lamp and Camera.


By default all 3D polygon mesh Game Physics is set to Static. As Static, it will just stands still but it will collide.

If you change the Physics to Dynamic, per object basis, Blender will also turn on also the "Actor" option and your object now will fall with Gravity.

You could go further setting Physics Type as as Rigid Body for more accuracy. Watch also the Collission Bounds settings.

Dynamic Object falls with Gravity.
Being "Actor", Blender explains, it will be detected by Near and Radar Sensor. What is that? We will touch this Near and Radar and Sensor later.


Watch also that option "Collision Bounds". Certain Bounds option will give you more precise collision.

From here on, I will start to talk in BGE and Game Terminology.

BGE: PLAYER CONTROL

With game, you always have something that user can control (give input to computer). And for this you need INPUT DEVICE, or in BGE this is set by SENSOR brick.

The REACTION or OUTPUT is set using ACTUATOR brick. Kind of FEEDBACK (output by computer) you want it to happen.

Wait, what is this SENSOR and ACTUATOR? How would you set this up? I almost forgot to explain this very important environment you will be working on. You do it inside the Blender LOGIC EDITOR.

If you switch to Blender Game Logic Layout, you will see the Logic Editor panel at the bottom.


That is the workspace you will be working on most of the time. You seem there is additional panel in this layout to write Python code. But don't worry about that for now. 

You can create a simple game just by working on the Logic Editor and 3D scene. All you will be doing is connecting Nodes which is divided into 3 different types of logic block or bricks:
  • SENSORS
  • CONTROLLERS --> if you use Python code, the Controller here is set to Python. But if you are not using Python, this CONTROLLERS is behaving more like "operators" (AND, OR, etc).
  • ACTUATOR
SEE: Blender Wiki on Game Engine for more details.

You can think the Nodes like this:
IF SENSORS (detect something), THEN do ACTUATOR (CONTROLLERS is usually set to AND)

This is actually pretty much all you need to create a 3D game in Blender. Amazingly simple right?

The setup or recipe goes like below examples:
  • IF user press certain keyboard button THEN do certain action/motion
  • IF character get close to certain object THEN earn point (add VALUE to PROPERTY)
  • IF character hit a wall THEN reset the scene
  • IF object A is touching object B THEN make object B disappear (End) and replace object A with a new geometry
  • IF object A hits object B THEN make sound
  • IF all the target completed THEN change to new scene
  • IF character get near door object THEN open door automatically
  • ... and SO ON.
Anyways, so for now, to control our character in the typical 4-directional axis, usually the setup is like this below:
1. With your object selected:
2. Set the Logic Editor Like Below

SENSOR: Keyboard
CONTROLLER: And
ACTUATOR: Motion

Note: Don't forget to hook up the noodle between SENSOR - CONTROLLER - ACTUATOR

Now, you should be able to control Object in 3D in realtime to move in 4 directions. Well, you can actually setup all kind of controls using Keyboard or Joystick. Maybe Spacebar for Jump.

4 directions can be:
  • forward, backward, rotate left, rotate right
  • up, down, left, right (top view)
  • left, right, duck, look up
  • etc
If your character is parented/skinned/bound to Armature, you apply the ACTUATOR: Motion to the Armature object itself. Blender will still figure out the Dynamic Physics based on the animated Mesh. You kind of separating Pose/Animation/Action with character's Physics, but in the end they work together.

Think of some games you have played from memory and focus on the hero character control mechanism:
  • Pacman (Top View)
  • Boulder Dash (Side View)
  • Sideway space shooter
  • Vertical space shooter, eg: Ikaruga
  • Side Scrolling Platform, eg: Mario, Sonic, Super Contra
  • Megaman/Rockman (Top View)
  • Tetris (Front View)
  • Bomberman (Top View)
  • Battle Chest (orthographic with angle)
  • First person and third person game (usually in Perspective)
  • Classic Prince of Persia (Side View) --> one game with strong animation and memorable character and story
  • Doodle Jump hopping game (iPad/iPhone/Android) --> apart from the accelerator input, the control is super simple, you can recreate this game easily
  • Angry Bird --> feel challenged to do this using Blender?
TIPS: Reorder Logic Brick
When collapsed, the Logic Brick you can sort and arrange the brick using the up and down little arrow buttons. This to ensure the noodle is nice and untangled.


Sooner or later you end up with lots of bricks and noodles.

TIPS: Copy Logic Brick To Selected
If you have one object already set with bunch of Logic Bricks and you want to copy those setup into another object, you can do it like this:
1. Select Object B you want to copy Logic Bricks into.
2. While Object B still selected, select Object A, in which you have some Logic Bricks applied.
3. Tap Spacebar and find: "Copy Logic Brick To Selected".

TIPS: Switching Camera
When you press P, the game will start right away and continue on from that single camera view.

If you want additional cameras to switch while in game, you prepared them before hand. One way to do it is like below:


Blender respects the Perspective, Ortographic, and Focal Length setting of each camera.

NOTE:
Looks like you could also use this ACTUATOR: Camera to make character "jump" or "teleport" to a new position. Not sure this is the right way thought, maybe it is.

Can you auto-switch camera if character is near certain bounding area? Yes, I believe you can do so. Logically it is a matter of triggering that ACTUATOR: Camera, with "something".

If you want a camera with additional overlay camera, you can do this in BGE by creating additional Scene(s) that is overlayed on top.

We will discuss camera more in depth a bit later, I do not want to overload you with too much info.

TIPS: Control with Additional Modifiers
You can set character control that receive few button combinations like this:

  • Normal Walk = Arrow
  • Fast Walk (Run) = Hold Shift + Arrow


(If I found another way I will add note here.)

BGE: Animation & Action

Now, what if you want to also assign Animation feedback for user while the Object is in motion? You simply assign ACTUATOR: Action. Of course you need to create an animation first.

As you may or may not already know, every animation in Blender is applied as Action block which can be assigned to game.

SENSOR: Keyboard
CONTROLLER: And
ACTUATOR: Action

Action includes F-Curve, NLA and also Armature animation.


---- BELOW SECTIONS MAY BE INCOMPLETE ---
(will continue writing the whole topics, but maybe wiser to break this introduction)

But, I recommend you this book title below as your main reference. That is pretty much what I am using to get my Game Logic going and also understand the BGE:

"Blender Game Engine Beginner" by Victor Kuller
--- MUST READ ---

Anyways, the rest of BGE topics that I wanted to cover are listed below. 

BGE: UV Texture (Normal map, etc) --> how you setup texture mapping correctly for BGE
BGE: Environment / Game Level / Map Design
BGE: Collision Detection and Near Trigger
BGE: Camera Follow and Multiple Cameras
BGE: Overlay and HUD
BGE: Sound Trigger --> sound is important feedback!
BGE: Concept of Looping
BGE: Game Property and Message Passing
BGE: Enemy AI Behaviour
BGE: Shooting Projectile
BGE: Life Bar
BGE: Game Credits, Game Opening Scene, Ending Scene
BGE: Exporting and Publishing

So, the future post will be more snippets of Logic Connection that I collects, that hopefully you can also apply to create your own games.

And we can also deconstruct some of the classic games and recreate it in Blender using the Logic Editor and also Python codes.

UPDATE 2012.11.21

See also Zelda Remake in BGE
http://www.youtube.com/user/SheldinLP?feature=watch
http://blenderartists.org/forum/showthread.php?271114-Legend-of-Zelda-Ocarina-of-Time-%28Blender-3D-Remake%29

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget