APOCALYX is a...

free Game Engine based on OpenGL (MAIL) (SITE) (FORUM) (BLOG)

Wednesday, April 30, 2008

GUN TACTYX has its models

Finally, the choice was taken. The poll stated that the best model for the next version of GUN TACTYX is the legionnaire from “The Specialists” MOD for Half-Life 1.

In the next days I’ll publish a demo performing the model in an animated sequence, like the one already published and based on the models from “The Trenches”, but before I have to solve a problem about the transitions between sequences. If fact, as you can see in the old demo, the MDL animations are smooth, but often the passage between different sequences, even if thought to be connected, are too evident and unrealistic. Once this problem is solved, the models from “The Specialists” are going to behave perfectly also in APOCALYX

Tuesday, April 29, 2008

Infinite terrains

APOCALYX supports a particular kind of terrain with no boundaries. In reality, it is a fake infinite terrain, because it simply repeats the same pattern periodically. Anyway, the pattern can be quite large and the periodicity is not easy to detect, except when recognizable shapes are built in the terrain itself.
To create this kind of terrain you have two possibilities, shown in the flight-simulator series of the demos: “Flying Circus” and “Zeke on Your Six!
The first shows also an application of the built-in “noise” library. It includes functions to generate fractal terrains with their own colors and shadows. This is the simpler and faster way to generate a terrain, but often you need a particular kind of shape for your landscape, thus a random generator of fractal noise is not the best choice.
The second possibility, that is also the obvious one in most 3D engines, is shown in the second demo. The terrain is defined with the help of several images: an height map, that encodes the heights of the terrain in a greyscale image; a color map, that encodes the very large scale color of the map, including the shadows of mountains and hills; a coarse map, that is a texture applied on the large scale; and a detail map, that is a texture applied at small scale to simulate the details of the terrain.
The last two textures are easy to find as free resources on the internet: for example, use seamless textures of rocks, concrete, grass, sand etc. The first two instead (the height map and the color map) must be tailored according to your needs. You can use terrain editors, like Terragen, that generate a ladscape given a few parameters and also provide tools to modify it.
When the editing phase is done, simply take a screenshot of your terrain in the height map editor (this is the grayscale image that defines the height map), then render your terrain applying the light conditions that you prefer (be sure to set up correctly the sun inclination, or the shadows will not match the sun position in your world) and take another screenshot from above (this is the color map with shadows). Remember that the infinite terrain requires a seamless height map, so use the same shape for the opposite sides of the map.
For more details, on how to load your brand-new maps in the engine, read the code of the demos cited above, give a look to the resources zipped in the data files and, finally… fly like an eagle!

Monday, April 28, 2008

Particle-based physics

The engine includes several open source libraries and a lot are written by other programmers, but I also wrote myself some of them. An example is the particle-based physics engine, that I called SimulAxion.
You may ask what a particle-based physics engine is. I first read about it in an old paper by Thomas Jakobsen, who designed the dead-body simulator of the first chapter of the Hitman series: “Hitman: Codename 47”. In that paper Thomas described a simple way to simulate rigid-bodies, soft-bodies and cloths, through the use of particles linked by sticks. In practice, the particles follow the usual laws of dynamics, but also they are constrained in their motion by rigid connections with nearby particles. At the time it was designed, that was the fastest way to create a believable physics behavior with little computational effort. In fact, the satisfaction of constraints is performed through a mathematical method known as relaxation: the particles move back and forth for a while, thus solving in a few steps a problem difficult to fix all at once.
Thanks to this idea, you can see APOCALYX performing nice looking flags and cloths. Now, because of faster hardware, other more accurate methods are available, but there is no reason to apply more complex algorithms, when simpler ones still work quite well.

Sunday, April 27, 2008

It’s full of stars!

There is an advantage in developing a GPL project: you can include nearly any other open source project in it. This is of great help, because I could never find the time, the resources and the capabilities to write a speech synthetizer, a full featured physics engine or a scripting language. That wasn’t necessary, because open source libraries performing all those features (and more) already exist.
That’s why you can find in APOCALYX so uncommon functions. When I decided to move from a simple 3D engine to a more complex game engine, a lot of libraries became of some interest even if they are usually ignored in games.
For example, some time ago I had an idea for a game set up in the Mediterranean Sea, based on naval commerces and wars from the ancient Greek-Persian conflict to the more recent Venetian-Turkish naval battles. It was an ambitious project, but as every “too large task for one-man army” it produced some useful spin-off. One obvious: the code for a better ocean than the ten years old one still performed in the engine demos. I also needed a realistic sky, with recognizable stars, because pilots had to choose directions also according to the position of stars (yes, it was a very ambitious project). The natural choice was to include in the engine a simple but accurate planetarium: I found it in Stellarium 0.4, that is open source, based on OpenGL and simpler than recent developments of the same program.
I can’t imagine any other application for those stars and planets, but it’s not bad to know that a realistic sky with accurate motion is there, waiting for the moment that you need to find your route in the world.

Saturday, April 26, 2008

“The Trenches” animated

In a few days the poll is going to reveal which model will be performed in GUN TACTYX between “The Trenches” and “The Specialists”. In the meantime, you can refine your opinion looking at the new demo in which the WW1 soldiers from “The Trenches” are animated seamlessly. I hope to provide a similar demo for “The Specialists”, too.
To see the demo at work you must download the GunTactyx2.zip file (4.7 Mb), if you haven’t already downloaded it more than a week ago, and apply the patch GunTactyx2-patch.zip (600 Kb). To apply the patch, unzip the two files in sequence and, when you are asked for an overwrite confirmation, simply confirm.

Friday, April 25, 2008

TooDee 2D Engine

Here I talk almost exclusively of APOCALYX, my 3D engine, but I have developed also a 2D engine, that I call TooDee. It is based on LuaSDL, so I can program in LUA 2D games rendered through the low-level SDL functions.
I use it mainly to fast prototype games and test their design, like those games shown in the “Experimental Gameplay Project”. It is useful also when sites like “Lost Garden” provide nice 2D graphics, to develop in a short time simple games.

Almost an year ago, I used TooDee to program a simple puzzle game: “The Lost Sheep”. I have developed it for “The CCN SpeedGame Contest 2007” and I achieved an unexpected third place.
If you want to try the game, download the “Lost Sheep” from GameAce. An editor of puzzles is included, but it’s quite raw and no documentation is available. Feel free to ask for further explanations.

Thursday, April 24, 2008

Soccer mode in GUN TACTYX

The few core players of GUN TACTYX remember for sure the interesting soccer mode of the game. In soccer mode, Wrokdam, the cyborg whose brain is programmed by the players, does not shoot bullets or grenades, but runs on a field and hits a ball towards the enemy goal, so… it plays soccer.
Only a few players succeeded in developing interesting teams tailored for soccer mode. Those teams were mainly RobyBaggio, VanHimst, Zidane2x2. It’s amusing to see those strange cyborgs follow the ball to push it, but also it’s surprising to see the intelligent-like behaviors programmed in a few script lines.
Now I have found some good MDL models performing soccer players (see the picture above) taken from the “International Online Soccer” MOD for Half-Life 1. I’ve asked for permission to use that model in my game, so it’s not impossible that even GUN TACTYX 2 is going to include a soccer mode. Start to tune your soccer tactics!

In the picture, the “RobyBaggio” team of
Wrokdam players is going to score a goal.

Wednesday, April 23, 2008

MS3D vs MD3 performances

The comparison between different model formats supported by APOCALYX continues.
This time I compare the same dog model in its original MS3D format against its MD3 version. The MD3 format is the old vertex-based Quake3 format, while MS3D is the native format used by the MilkShape3D modeller. The latter uses skeletal animation.

MS3D above, MD3 below


In the screenshots above, you can see two scenes rendered at the same frame rate. It’s evident that the engine performs the MS3D rendering at poor speed, compared to MD3 rendering, in fact the first loses 25 dogs against 225!
The main reasons are two: MS3D, being skeleton-based, require more computations than MD3 to place each vertex; then MS3D does not support yet the clone function and every dog in the picture is a different model with its own animation data, while similar MD3 models share the same data, so the impact on memory allocation is reduced.
I think there is room for a lot of speed improvements in the MS3D animator, but in the meantime I suggest, if you own some MS3D model, to convert them to MD3 (if there are only a few animation sequences) or MDL, because they are currently faster.

Tuesday, April 22, 2008

Watermarks

This blog begins to give some good feedbacks. First of all, the poll about the model that you wish to see in GUN TACTYX 2 is going to find its winner, in a few days, between "The Trenches" and "The Specialists".

Then, thanks to a comment by Robert, I realized that the Ogre screenshots look better than APOCALYX also because there is an appealing watermark attached. The suggestion was about an atomic mushroom, so I unchained my poor graphic capabilities to produce the front-image of the blog, a powered-by button and a watermark. You are going to see this watermark superimposed on the demos in the next release of the engine.

If you want to draw a better watermark and post it, I'll be very happy to open a new poll to choose among the best ones.

Monday, April 21, 2008

Wrokdam, the gladiator

In the last posts I always talked about MD2 and MDL model formats, even BSP level format, but never about MD3 models. They were the main source for my first demos and also the first version of GUN TACTYX was based upon such a kind of model: Wrokdam.
To celebrate the format I'll publish here the Wrokdam's story, that is also the background of GUN-TACTYX. Now another story is necessary for GUN-TACTYX-2, but before the poll between "The Trenches" or "The Specialists" models must be closed: You have still a few days to vote.

WROKDAM by Grant Struthers

Wrokdam Von Gadmoore was a legendary arena gladiator in his time. He had no greater love than the glory of combat and spent his entire life shaping his body and mind into the perfect weapon. Tragically, a warrior's prime fades quickly.
Wrokdam could feel the years catching up and it infuriated him. He swore he would never allow weakness to prevail even if his body betrayed him. He decided to combat death itself through the use of cybernetics and began replacing parts of his body he felt had grown too weak to be useful in battle. He thought he had found true immortality. He was terribly mistaken.
As time passed, Wrokdam slowly slipped into madness. His mind could not endure the time his new body could and he soon lost himself to the machine.
Now the monster known as Wrokdam wanders the world in search of combat and no one knows if any part of his soul still lives.

THE STORY SO FAR... by Leonardo Boselli

In a few decades people lost memory of Wrokdam and his past glory faded away. The cyber-gladiator's story became a legend known only by the oldest arena warriors, until Wrokdam was found still fighting in a provincial arena on a far planet at the border of the Empire.
A young researcher of ZYX Corporation apprehended the military application of a body so highly trained for combat, so the mad warrior was captured and transferred to a gun-fight training area known as GUN-TACTYX.
The researcher discovered that Wrokdam's body could become the perfect combat machine, but his brain was too weak, slow and mad to drive effectively his powerful devices. A hard decision was taken and an artificial brain was installed in place of Wrokdam's carbon-based one. Then his body was cloned hundreds of time to form teams of clones fighting each other to pick out the perfect warrior through natural selection.
Only one thing lacks to make Wrokdam the strongest arena gladiator of every time: The best gun-fighting algorithm for his artificial brain!

GUN-TACTYX: Now it's your play!

The reader may ask where Wrokdam's original brain is now, but the answer is obvious if you know that ZYX Corporation's philosophy is: "Throw Away Nothing".
Wrokdam's brain is now employed as a consultant at ZYX Corporation and mainly keeps up running commentary of the fights among the clones taking place in the arenas of the GUN-TACTYX area. His deep experience in gun tactics is very useful to the developers that tune up the fighting algorithms.
I don't know if he is really dissatisfied with his new condition, but I'm sure that he is a little envious of those artificially brained fighters that resemble the aspect of a warrior once know as Wrokdam: A legendary arena gladiator in his time.

Sunday, April 20, 2008

GameDev's "Image of the Day"

Some screenshots of APOCALYX are now featured in the "Image of the Day" at GameDev.
GameDev is a great site for game developers: interesting articles, useful resources, well frequented forums, challenging contests etc.


Probably I hardly could develop most of the APOCALYX code without the help of sites like GameDev.net, Nehe.GameDev.net, OpenGL.org, GameProg.it, Gamasutra.com, CFXweb.net, FlipCode.net (the latter two no more updated). Thank you guys!

Saturday, April 19, 2008

BSP performances (II)

Yesterday I promised a comparison between APOCALYX and Ogre about the rendering of Quake3 BSP levels. I tested a level taken from the Ogre demos, that you can see below, and the result is surprising: while Irrlicht and APOCALYX behave almost the same, Ogre is much slower! Ogre got only 61 frames per second against 213 using the same configuration (same resolution and no vertical sync enabled in both cases).
The result may be surprising, but you must consider that Ogre renders some animated textures that APOCALYX ignores. The differences are evident in the screenshots.
Ogre is more than three times slower, but the scene looks much better. In conclusion, it's time to improve the BSP support of APOCALYX, trying to keep it fast, of course.

Ogre above, APOCALYX below

Friday, April 18, 2008

BSP performances

From time to time, occasional users of the engine say: your engine is interesting, but in rendering Quake3 BSP maps it is slower than Irrlicht, Ogre, or... (put here your preferred open source engine). Then I discover that occasional user has compared different maps, in different situations. A typical mistake of unexperienced users: a comparison between the Irrlicht "Quake3Map.exe" demo at the default resolution (640x480) and my "BSPLevel.lua" at 1024x768!

So, in conclusion, is APOCALYX really slower than Irrlicht in rendering BSP levels? Below you can see two screenshots of the same level from above (taken from the Irrlicht demos). In the same conditions, the utility "Fraps" reports almost the same frame rate.

In the next days, I'll make the same comparison between APOCALYX and Ogre. I need just the time to extract a BSP level from the Ogre demos.

Irrlicht above, APOCALYX below

Thursday, April 17, 2008

"Trenches" vs "Specialists"

A main objection about the poll that I opened yesterday: how can one choose between two models looking only at screenshots? A good objection. So I put together the models in a very simple demo, so you can see in action the animations and give a more thought vote. Download the demo at SourceForge (4.7 Mb)

The demo is still raw, in fact the animations are not connected seamlessly, neither the models move on the ground. I'll provide a better demo in the next days, but you can already see at work the main features of the two models and give suggestions.

The Trenches ------ The Specialists

Wednesday, April 16, 2008

Low-poly vs High-poly (POLL)

It's time for a poll. My final choice for the models featured in the next to come GUN TACTYX 2 game falls between the two presented here:
The Trenches ------ The Specialists

The one on the left is a quite low-poly WW1 german soldier from "The Trenches" MOD for Half-life 1, while the other is the Legionnaire that comes from "The Specialists" MOD always for Half-life 1, both wearing a gas mask in the picture.

The choice will influence the design of the game:

  • In the first case (The Trenches) the game will include two platoons (british and german) of twelve soldiers each with two weapons: rifles with bayonet and grenades. The best environment for this choice is probably an open ground with trenches. Here the management of the team is going to be more complex, because a lot of mates are around.
  • In the second case (The Specialists) will be available four team of three soldiers each with several weapons: rifles, machine guns, berettas and grenades. Here the best environment is probably an in-door maze and the main difficulty will be the management of the single unit, because of the high number of animations and weapons available.

Being an important choice for the game, I ask for suggestions: it's not only a matter of model, but also of design. In the poll on the right, you can choose the model and the design that you prefer.
GUN TACTYX 2: Now it's your play!

Tuesday, April 15, 2008

The Lua sandbox

In a game like GUN TACTYX, where the players write directly the AI code that manages the behavior of their team of bots, it's important to verify that no malicious code is possible (or no player will load other players' code on his computer).
It's a situation similar to the execution of JAVA applets in a browser: we don't want that any applet can write arbitrary data to our hard disk (e.g. a virus), so applets are confined in a so called sandbox.
Another requirement is the complete control over the code execution, so a scheduler can share correctly the time among different teams, and also the control over the memory allocation, so no team can use too much memory.
In the old version of GUN TACTYX, all these requirements were realized in the interpreter of SMALL scripts, but that language had several disadvantages. In the next release instead, the language that controls the bots is our beloved Lua. In fact, I have created a LuaScript class: it implements a Lua interpreter that includes a memory allocation manager and an execution scheduler.
Imagine two platoons of a dozen soldiers each, controlled by their own AI script written by the players: that is going to be GUN TACTYX 2.

Monday, April 14, 2008

A new movie

It's a long time since the last (and first) movie featuring some of the engine demos, so I've collected several cuts from the most significative demos, a few of them not yet published, in a 20 Mb file.


This movie and the old one give an idea of the graphic capabilities of the engine, but it's always better to try the features on the field, of course, so run to the APOCALYX site and download the demos.

Sunday, April 13, 2008

Improving MD2 support

Yesterday I asked why MDL models show almost the same performances of MD2 models, the latter being of worse quality. There were several answers, but the right one was the following: the code of the MD2 animator was very poor, of course.
Tweaking the code, the demo showing 32 MDL models now give roughly the same frame rate of a square of 64 MD2 models with weapons and shadows.
In conclusion, in the next release of APOCALYX you are going to double the number of rendered MD2 models at the same time, keeping the frame rate the same: a nice achievement.

USA and German soldiers (MD2 format)

Saturday, April 12, 2008

MDL vs MD2 performaces

I was still evaluating good animated models for GUN-TACTYX-2, my QUAKE3-style CROBOTS-like game. This time my idea was to develop a more realistic game. The first GUN-TACTYX performed a very original MD3 model (the Wrokdam model by Grant Struthers) that gave a suggestive background to the game, but also little emotive involvment in the fights among cyborgs. Instead realistic models add more atmosphere and an improved player's attachment to his team of bots. That's why I am evaluating several kind of models available on the internet.

Since I'm oriented towards the usual, inflated WW2 background, my choice falls between the models of "The Trenches" MOD for Half-Life 1 and the models of the "DDay" MOD for Quake2. The models of the latter are worse, if seen at short distances, because of the limitations of the MD2 model format, but I thought that they were going to be better to keep frame rates high. In fact, an MD2 model is very simple: one need to attach only a single texture and render only triangle strips or fans already optimized for OpenGL strips and fans. On the contrary, MDL models are more complex and better seen at short distances: they need several textures, lots of triangles and the animations based on skeletons require chains of matrices multiplications.

Because I need a lot of models around of the battleground, I thought that MD2 models were lighter, but I was wrong. In the pictures below you can see a square of 36 WW2 USA soldier in MD2 format (from "DDay" MOD) against 32 british and german WW1 soldiers in two rows (from "The Trenches" MOD). Surprisingly the frame rate is roughly the same. I don't know yet which is the cause: the poor code of the MD2 animator, the good code of the MDL animator, or the relative heaviness in triangles count of the two kind of models.
However, this first test gives more points to the better looking, more versatile MDL models.

32 WW1 british and german soldiers in two rows (MDL format)

A square of 36 WW2 USA soldiers (MD2 format)

Friday, April 11, 2008

Improving MDL support

Since the beginning of the development, I had a problem: I'm an average programmer, but a very poor modeller. That's why APOCALYX supports some of the most common model formats, MD2 and MD3: a programmer can concentrate on... programming, while downloading models from the large repository of free animated models that internet is.
I am a fan of the Doom-Quake series and I choose MD2 and MD3 formats as the primary source for my models. That wasn't a good choice because the Half-Life 1 format, MDL, is much better: it is a format based on skeletons, more compact and versatile, than the vertex based animations of MD3s.
As you can see from the pictures, the MDL format can encode very good looking models, like the one above, that is the Legionnaire from "The Specialists" MOD for Half-Life 1.

Now I have found some good example of MDL format loader and animator and also discovered large repositories of MDL models, so the MDL support, already available in version 0.9.1 of the engine, is improving a lot.
In the next release of APOCALYX, you are going to find an even better support for this format and you'll give new Full-Life to your MDL models!

The picture above shows MDL models in action from "The Trenches" MOD for Half-Life 1. I asked for permission to use these models in the next release of my GUN-TACTYX game. These models are quite light-weight and good-looking, especially when seen from a distance, as in a RTS-like game.

Thursday, April 10, 2008

The APOCALYX Blog is here!

Ok, I know it's boring to wait for news about the APOCALYX 3D Engine on the official site, so I have decided to start this blog that I'm going to update often with news about the recent developments. Stay tuned!

In the picture you can see APOCALYX featuring the great MD2 dragon model by Magarnigal. You may notice the flame following the dragon's mouth: it's not easy to attach a particle emitter to an MD2 model, but the engine can do the trick. Give new life to your MD2 models!