Engine and Tools

Blitz3D Forums/Blitz3D Programming/Engine and Tools

boomboom(Posted 2004) [#1]
Hi, I have started building my first proper game, (hurrying to get a demo for blitzcon :)) and would like to know how to go about the general layout of the code.

At the moment I have a basic test program, mainly to test whether the concept and control system can be done. this has been done by my usual method of shuving everything in one file.

I am satisfied with my test and want to start programming the main engine. My main question is How do i go about laying it out?

For example, do I split the level building code, controls, asset loading...etc code into different files and if so how would i go about connecting them together?

also, how do you build your levels? i would quite like to build my own level making tool, but do you normally make the level maker generate blitzcode to use as an include, or a kinda script that you can then run through an 'interpreter' function that builds the level?

any advise most welcome.


jhocking(Posted 2004) [#2]
Um, what do you mean by "level maker?" If you mean the level geometry, then you create that in some sort of modeler or level editor and save to b3d file format. Then load that in Blitz using LoadMesh (or perhaps LoadAnimMesh to preserve heirarchy.)

If you mean placing entities in a level, the normal approach is the second one you mention. That is, write the entity placement data into a file and have your game read that file when the level loads.


boomboom(Posted 2004) [#3]
yes, it is placing entities.

do you know of any tools that i can use instead of building my own. I do not need anything special, just entity placement and possibly some defineable attributes


GW(Posted 2004) [#4]
Start by getting away from your computer grabbing a pen and go sit somewhere, Start laying out on paper all the major sub-systems. example:
User settings - reading and writing, default keys ect.
audio - managing sounds loading and clean up ect.
Gui - loading and managment/update. for small games this should include mouse and key handling.
graphics, network ect ect..

As a start, make a main BB file for each of these subsystems and try to make them as self contained as possible. try to minimize the amount of cross linking.
For example, Even on a simple project my UI code only has one interface 'UI_Update()' that function just calls 'UI_Update_Mouse' and 'UI_Update_Keys()'. those function are considered internal and not exposed to the other parts of the program,


jhocking(Posted 2004) [#5]
For placing entities I recommend Droplet, a free tool from Rob Farley. Look in the Toolbox for World Editors.


boomboom(Posted 2004) [#6]
OK i have decided to make my own, as i need something quite specific for what i need.

So basically my thought last night were to make something like this:

First I program all the 'blocks' that i will be using in my game with types into my block placement program (a block can be a collection of entites, such as the texture, the collision box and the actual mesh)

then i make the block placement program able to generate a new type for the block if i need it, with some of the attrabutes enterable

my placement program then saves these types in blitzcode, then the types, when loaded in the game run through a building function for each different block and builds it in the game.


Is this a good way of doing it, or is there a better way, this will be my first time doing anything with types (array man normally) but i can't see anotherway of doing it.


jfk EO-11110(Posted 2004) [#7]
It doesn't really matter if you are going to use types or only arrays. But I wouldn't export Blitzcode.Instead you better use a generic object structure and a loader for those object attributes. Basicly it's the same as your block. I suggest to completely wrap an objects possible properties. For meshes these are ENtityFX, EntityAlpha, position, rotation, scale, collsion mode, mesh file path, etc. etc. etc. THen you can save all the attributes in a simple textfile (of course all "blocks" in one file). THe loader will then read it, load the meshes using the path, rotate it , position etc.

Personally I use a generic structure that is even capable of loading 3d sounds and animated meshes. I use a string field in the structure for special tasks. The engine will then parse the string filed while loading and decide if an object has a special purpose (eg. "key 3"). This way the editor remains flexible and I can use the string field as some kind of Scripting Language.

I released a slim version of my editor for the open source plasma project, it's also here:
http://www.melog.ch/dl/pledit05.zip

It may give you an idea about how it's done, tho the source isn't very structured <:°)