Tag Archives: game engine

Programming with C# and Unity 3D game engine – part 003 .

In this tutorials I will show how to deal with lists and enumerations.
First you need to make one C# script under Unity 3D. If don’t know how to do it then read this tutorial.
The list is an object which holds variables in a specific order.
The enumeration is an object with one distinct type that consists of a set of named constants called the enumerator list.
Let’s start with lists.
You need to put this on your script:

Now you can create list under your class , see the example with one class named YourClass:

We can see the List’s syntax is at first confusing. If you take a look to types – int, sting and GameObject and variables – ages, names and objects then the base remain this: List<...> … = new List<...>(); where types are into <> and variables can be created with = new … ().
Now will add one value to names with:

To reverse one list in-place then use this:

If you want then can remove one:

We can use an array to initialize a List named animals:

Loop into the list animals and print the list:

To get the number of elements from animals list, use this:

To clean the list just use this:

The next step is enumerations and is define by the enum type.
An enum type internally contains an enumerator list like this example:

In this enum named animals, cat will be zero (unless given another value explicitly), dog will be one, and fox will be two …
To print out the enum values, you can call ToString on the enum variable in a program.
The Console.WriteLine can automatically call the ToString method.
Using GetValues method with foreach to returns an array that contains a value for each member of the enumType enumeration.

Sometimes we have a string value that we want to convert to an equivalent enum and we can use Parse().
Also you can used many enum like: Enum.Parse, Enum.TryParse, Enum.Format, Enum.IsDefined…
You can get values from enum , see the example:

Convert enums to list:

Posted in C#, Game engine, Unity 3D, Visual Studio, Windows 10. Tagged with , , , , , , .

Unity 5 – shortkeys – part 001 .

In this image I show you some shortkeys from Unity 5.
This will help you remember quickly and also will you increase your working speed.
Unity 5

Posted in All, Unity 3D. Tagged with , , , , , .

Programming with C# and Unity 3D game engine – part 002

Today I will show you how to install Unity 5 for free.
First will need to download it from official website – free download.
You need to follow this steps: Select Unity 5 Personal Edition.
unity5-firststeps
Fill with your email adress and password from Unity website account.
unity5-firststeps-001
Select your answers …
unity5-firststeps-002
Press the blue button Start Unity and will be ready to start your project.
unity5-firststeps-003

Posted in 3D, All, Game engine, Unity 3D, Windows 8. Tagged with , , , , , , , .

CRYENGINE – about Lua programming – part 1.

First I make this tutorial because lua language is used not only CryEngine …
Most game engines used this language programming.
Because I used the 64 bits into Cry Engine I will use the LuaCompiler from this folder :
C:\CRYENGINE\Bin64>LuaCompiler.exe
About Lua if you read the official website you will see this :
Lua is a powerful, fast, lightweight, embeddable scripting language.
Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

Also you can read about lua and windows OS here :
Now let’s make a simple example with this programming language.
First we need to deal with three file type: .cgf , .lua and .ent .
The .cgf cry engine file is a file will load into game.
The .lua file is a lua program file.
… and .ent file is a cry engine file ( entity file ).
So I make this files : test001.ent and test001.lua.
I save the test001.ent with this path : C:\CRYENGINE\GameSDK\Entities
and test001.lua come with this path: C:\CRYENGINE\GameSDK\Scripts\Entities\Physics
The content of the test001.ent:

The content of the test001.lua:

The next step is to open your Cry Engine Editor and will see your script working.
cryengine-test001
Now about the lua script ( test001.lua) is very simple to understand how it’s working.
First line is the name , in this case is test001.
All about this is store with {} and after that will come the functions: OnInit , OnReset and PhysicalizeThis.
Because all this functions come from test001 then the syntax is: test001:your_function() and will end with this word: end.
Also be advice about ; and , under Properties and after that is need to see how is the diff when we use:
self: and self.
All of this tips can be found if you read the test001.lua and try to understand that script.
Also you need to following prefixes on the value name…
Prefix Type
b – boolean
f – float
i – integer
s – string
clr – color
object_ – an object compatible with CryENGINE: a CFG, CGA, CHR or CDF file

You also can read this webpage.

Posted in 3D, All, Game engine, Programming, Windows 8. Tagged with , , , .

Ogre 3D and Code::Blocks – first part unfinished

My son has 2 years old.

I had to make a little game to keep him busy.

Little known to push so I used the arrow keys to make it more interesting.

This is the source code.

When you run the project, you will see the following picture:

ogre 3d
The result is :
First Ogre 3D tutorial from Catalin Festila on Vimeo.

Is first try to use Ogre 3D …

Posted in 3D, Game engine, Programming. Tagged with , , .