APOCALYX is a...

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

Thursday, July 31, 2008

Explosions Generator

Yesterday I have described a program that generates images of animated caustics. Today is the turn of a program that generates images of explosions. You can download it here.
You know the importance of explosions in games. Often they are realized through the particles system, but also a simple square textured with an animation is good enough in some situations. For example, such are the simple explosions in "Urban Tactics".
In the case of this program, each frame of the explosion is drawn in a sector of the texture, so one can immediately use the APOCALYX AnimatedTexture class to render the animation on a transparent billboard and simulate an explosion.
The author says: "As a side-effect of working on a shootemup game I have a small program that generates sprite animations of explosions. Because there aren't many easy ways to get textures like this if you aren't an artist (without stealing them from other games) I thought I would do the decent thing and generate a few spare free textures that anyone can use, anywhere for anything, royalty free. If you are doing 2D or 3D games, you might find these texture helpfull in rendering explosions in your games.
You can download the program and configure lots of different variables to output your own unique texture pages of explosions. Happy exploding!

Wednesday, July 30, 2008

Caustics Generator

Textures are fundamental for games. Nowadays the fragment shaders add a lot of versatility and realism to game scenes, but also a good animated texture may be enough sometimes. Hand drawing textures is an art, use and modify real photos is easier, but there is a third way: use texture generators.
In a past post (read it) I talked about the procedural texture generator included in APOCALYX. There are also programs that generate procedurally animated texture to recreate effects like caustics, the characteristics light-games under the sea surface. One of these program, devoted to caustics, is available here.
The author says:"Caustics can be described as the light pattern you see at the bottom of a pool on a sunny day.
This tool will let you render such caustics patterns. The rendered images can be animated and used for realtime graphics and are tileable in both space and time.
Caustics are a bit more than just the pattern seen on the bottom of the pool. Caustics is the name for the light phenomenon of converging light. Caustics are caused by the fact that light is reflected or refracted one or several times before actually hitting a surface. The more light that is refracted to the same area on a surface, the brighter the area will be lit.
The patterns rendered by this program are calculated by simulating the effect of light refracting through water. The water surface is made tileable in both space and time in order to make the rendered images tileable.
The rendered images can for example be used as realtime textures for games and animations.

Tuesday, July 29, 2008

Banners in Flash

Let's start a new topic a little off-topic for the main line of discussion of this blog: Utilities.
I had to write the flash-banner for a free game in development, the banner that you can see today on the left, and I never created one in the past (in fact, as you can see, the final result is not so professional). Anyway, I tought that some complex and expensive tools were necessary to put together things like that, but I was wrong.

I've found a simple program called PowerBullet, that in its 1.35 version is free to use. It can create flash presentations in a few clicks, in fact built-in buttons to advance presentations are already available, but it is useful also for create simple banners.
I promise that my next attempt will be better, but I think that the beginning is not so a bad.

Monday, July 28, 2008

MDL smooth transitions

I received questions about the smooth transitions between different animations in MDL models. AS explained yesterday, they are only available in the preview of the next release. There are 3 additional functions:
  • number MDLModel:setTransition(number duration, number index, boolean looping = true, boolean reverse = false)

    This function starts the transition from the current frame of the current animation to the first frame of the specified animation. 'index' is the index of the next animation, 'duration' is the time necessary for the transition.

  • number MDLModel:getTransitionTimer()

    This function returns the current transition time, so one knows between 0 and 1 which portion of the transition was already completed.

  • number MDLModel:getStoppedTransition()

    This function returns the last stopped transition (-1 if no stop was reached yet). It is useful during the update() callback to know if the transition is terminated, so the programmer can start the new animation (in fact, the next animation does not start automatically, but on request).

Unluckily there is no demo yet that exemplifies the subject, but I'll include one when the next release will be published. Feel free to ask more explanations.

Sunday, July 27, 2008

APOCALYX 0.9.3 alpha3

Yesterday I posted a link about the new preview of the next release of the engine (download the new executable here)
Apart the bug related to eSpeak that I discussed yesterday, the preview includes some improvements as listed in the history document:
  • Added MDLModel functions: setTransition(), setTransitionTimer(), getStoppedTransition()
  • Added IM (Imaging Toolkit) support in IUP GUI
  • Added primitives: Cylinder, Disk, PartialDisk, Sphere
  • Added setPointerVisible(), isPointerVisible()
  • Fixed bug in collisions between ODE objects and BSP geometry
  • Added support for SQLite and MySQL databases
  • Removed AngelScript, SMALL and CSL language support
These are only some of the improvements fully available when the next release will be published.
For any question, feel free to post on the forums.

Saturday, July 26, 2008

eSpeak: bug solved

Thanks to Nout (the author of NsEditor), I discovered that the current APOCALYX implementation of eSpeak had a design flaw. eSpeak is an open source library useful to convert text in several languages is fluent audible speech. Since the output of the library is a sound, I had to interface the output to a sound source and, because of their versatility, I had chosen a 3D sound source. This way the sound of the spoken text can be attached to a object in movement, a NPC for example.
This idea had a flaw, in fact what happens when the 3D sound is not attached to an object and the camera is moved around in the scene? The 3D sound remains stationary in the origin, while the camera (and the ears of the player) move away, thus the sound may become too far to be heard. A 3D sound is versatile, but its default behavior is not intuitive.
To solve the problem, it's now available a new preview of the next release of engine (alpha3). The solution is simple, when the speaker is static, the programmer can use an old good 2D Sound instead of a 3D sound located at the origin. This preview includes also the MySQL and SQLite support, so the users that need those database interfaces can download it without fear of losing them.

Friday, July 25, 2008

City tour

Finally, the end of the screenshots tour. Let's come back to an urban environment. The buildings are just made of simple blocks, but enough to represent the town of "Urban Tactics". All the lightmaps applied to the walls are generated by the raycaster included in GtkRadiant.

A few buildings

A flat wall: the windows are
drawn in the applied texture

The main street

Thursday, July 24, 2008

Isles tour

The tour continues. Probably, to say that the sea is an open ground is an oximoron, anyway these screenshots belong to the terrain tour serie. Again they are taken from the well known "Hoverjet Racing" demo.

An isle in the Mediterranean Sea

An isle in the Pacific Ocean

A vulcanic isle in activity

Wednesday, July 23, 2008

Terrains tour

In recent messages I have posted a few screenshots of BSP levels rendered by APOCALYX. Usually BSP levels depict indoor scenes, while the last shots simulate an open environment. Let's now consider a real open ground. This time the screenshots are taken from "Hoverjet Racing" one of the most complete and varied demos.

Here you can see a landscape from Mars

Then a shot from the Rocky Mountains

Finally some ice from the Anctartica

Tuesday, July 22, 2008

Flying through Genoa

If you had fun flying through the El Paso level, you'll have more fun flying through a larger level that represents the town of Genoa in Italy. You can download the demo at SourceForge.

The BSP level, very large and detailed, was created by Massimagnus for the game "Soldier of Fortune II". I have only converted it to the Quake III BSP format necessary to show it in APOCALYX.

The author has created the level with the help of his memory only. Effectively, the represented places are not exactly the same, nor the pieces are connected as they are in reality, but I know Genoa very well and I can say that the final result is very near to the real atmosphere.

Monday, July 21, 2008

The Bank of El Paso

Yesterday I show a few screenshots of MD3 models taken from "WesternQ3" a MOD for the old Quake III. The models are quite old-fashioned, but it's amusing the see the Clint Eastwood's face attached to a low-poly model. Now it's time to show a BSP level inspired to the town of El Paso, as it was built in "For a Few Dollars More", a movie by Sergio Leone.

In the screenshot above you can see the bank of El Paso (the grey building on the left) just after the assault of El Indio's band of robbers. While in the screenshot below, you can see the main street of El Paso: a nice place for a duel.

To download the demo and fly through the buildings of El Paso, visit the APOCALYX Demos page.

Sunday, July 20, 2008

The Good, The Bad, The Ugly

Yesterday I watched on TV the movie "The Good, The Bad, The Ugly", a so called spaghetti-western by Sergio Leone. The plot, the long sequences, the emblematic characters, the awesome sountrack, make it one of the best movies of the italian director.
This is the right occasion to remember two small APOCALYX demos that take from that genre of movies their atmosphere. They are the "El Paso level" and "Sure as a Gun".

The former shows the town of El Paso, as depicted in a "For a few Dollars More". The latter shows the most famous characters of Sergio Leone's westerns, performed by Clint Eastwood, Eli Wallach and Lee Van Cleef.
Both the BSP levels and the MD3 models of those demos were taken from the great "WesternQ3", a MOD for the old Quake III.

The demos are very schematic, just a simple fly-through. However, as already explained, it's not impossible for users with some programming skills to improve them and recreate those unforgettable duels represented in Sergio Leone's movies.

Saturday, July 19, 2008

Demos modifications

Sometimes I receive requests to modify in some way this or that demo. I'm surprised by these requests because I always explain that one can easily modify the demos himself. For example, it's very easy to change any resource used in the demos (textures, models, sounds etc.). Take for example the latest demo, Mushroom's Ride, posted two days ago and let's change the player's avatar. Since the avatar is a MD2 model (the old Quake2 model format), it's simple to take one's own preferred MD2 model and replace it. In the screenshot below, you can see that I have simply replaced the original fairy with an orc.

Some of the animations are different, of course, but the convention implied in the MD2 format makes coherent the overall behavior. To replace a model with another, or modify textures, sounds etc, one simply opens the "main.dat" file as it was a ZIP file (effectively, it is a ZIP file renamed to DAT).
Other more complex modifications need some knowledge of a programming language. For example, in the screenshot below you can see that the height of the camera over the ground is lower than in the original demo.

To make this kind of changes one can open the "main.lua" file with his text editor of choice. Doing so the complete source of the demo will be available for one's modifications. Usually the sources of the demos are short and quite structured, then downloading the documentation of the engine at the APOCALYX Downloads Page, it's not so difficult to understand the meaning of the variables and functions. In addition, the Lua language is very intuitive for people who already knows another programming language and, being scripted, no recompilation is necessary: one can immediately see his modifications at work.

Friday, July 18, 2008

Fights in outer space

Just a few screenshots of another demo in development.

In the first picture you can see some buildings, a space-station, two robots walking on ground and some fighters flying.

The second picture show an enlargement of the first one, where you can see the two giant robots, the fighters and the landing-dock.
The two screenshots were taken as usual from an animation executed by the latest release of the APOCALYX 3D Engine.

Thursday, July 17, 2008

Mushroom's Ride released

Finally, here it is: a new APOCALYX demo, Mushroom's Ride. Move the fairy through the stone blocks to collect as many mushrooms as possible. You can download it from SourceForge. The 1.3Mb ZIP contains also a stripped version of the engine executable (only 414 Kb), so you don't need to download the larger runtime.

This is only a demo, in fact the gameplay is not complete. For example, the shadows does not affect the mushrooms' behavior, as originally intended. Anyway the sources are included so users can easily modify and extend the demo at will. In fact, as usual, the source is written in a *.lua file, that one can modify with a simple text editor, while the data is included in a *.dat file, that is nothing else than a ZIP renamed. Enjoy the demo!

Wednesday, July 16, 2008

Mushrooms fields

Another screenshot about Mushroom's Ride. Finally the fairy can run through the stone blocks on the mushrooms field.

Now it's time to implement the game logic:
  • as time passes, the sun moves in the sky
  • when the fairy approaches a mushroom, it keeps following her
  • when more mushrooms follow the fairy, they create a chain (each approached mushroom starts following the last mushroom of the chain)
  • when mushrooms stay too much in the sunlight they shrink and disappear
  • when mushrooms reach the goal the score is incremented

Tuesday, July 15, 2008

Backgrounds (II)

A few days ago I talked about the skyboxes available in APOCALYX. In reality there are different kinds of skyboxes, each of them useful in particular situations.
The most suggestive, already available in the first demos (read the post about the ancient origins), is the StarField, here shown behind the robots. It is a collections of points of several sizes and colors, that resemble stars, together with squares depicting galaxies or planets.

Apart the StarField and the Sky, that is a usual skybox - the inner of a closed cube, there are also the MirroredSky, the HalfSky, the SkyDome and the Stellarium:

  • the MirroredSky is useful when the ground is reflective, in fact the sky is repeated under the surface of the ground;

  • the HalfSky is similar to the MirroredSky, but the reflected sky is replaced by an uniform color;

  • the SkyDome replaces the cube with a hemisphere, in this case the colors of the sky are modified accordingly to the hour of the day or night, simulating the brightness of the sun at twighlight, dawn or noon.

  • finally, the Stellarium is an almost complete planetarium (read the "It's full of Stars!" post to know more)

Monday, July 14, 2008

DataBase connections (II)

Thanks to users' requests the capabilities of APOCALYX grow more and more. Recently several users asked about the databases management capabilities of the engine, in particular they asked for MySQL support. The engine can already manage MySQL databases, but the necessary functions are not compiled in the default release of the engine, while ODBC support is. So I uploaded a version of the executable that you can download to get built-in MySQL support.
Another user asked for SQLite support. SQLite is a library that can manage SQL queries even in memory. This means that, if you want to store and retrieve structured information through SQL, you don't need to create an ODBC or MySQL database before: you can simply create your database in memory, or in a simple text file, thanks to the functions provided by SQLite and the Lua binding Lua-SQLite. To get an executable with SQLite support, use the same link that you've found above (includes both MySQL and SQLite).
I think that now the range of batabases management capabilities of APOCALYX is wide enough, but feel free to ask more.

Sunday, July 13, 2008

Shadow Volumes

Latest improvements in Mushroom's Ride: finally the shadow volumes applied to static meshes are rendered correctly, as you can see in the screenshot (one of the fairies is partially covered by the shadow of the cube).

However the performances are not the best yet, in fact the shadow volumes are applied on a per-triangle basis. This means that for each triangle enlighted by the sun, other three triangles are rendered on the stencil buffer, triangles that extend to infinite, so become particularly large at certain angles.
A better way to implement the technique is to find the outline of the shadow, given by the edges in common between two triangles, one enlighted and one shadowed. In this case the number of faces is reduced a lot. It's not difficult to apply the technique on static meshes, but is more difficult when applied to different animated model formats. Since APOCALYX does not implement his own format, but supports a lot of them, it's necessary to write specific code for each one. Implementing one shadow volume per triangle is simpler, but performances degrade rapidly when the models are not low-poly.

Saturday, July 12, 2008


One of my preferred 3D tools is Terragen. Thanks to this free (for non-commercial use) terrain generator, I could create all the open terrains that you can see in my demos, but also all the backgrounds.

It's very easy to create a beautiful landscape with mountains, clouds and a shiny sun. After tuning some parameters, it's only necessary to take six shots of the scene with an aperture of 90 degrees in the six main directions, then you can load the images in APOCALYX and apply them to a sky-box. Only two tricks are necessary to merge the background to you actual scene: choose the correct sun inclination, so the lens-flare will appear in the right place, and choose a fog color that corresponds to the color at the hills foots, so objects disappear slowly with distance.

Of course there are also ready-made backgrounds out there. For example, you can see above and below two cube-maps created by Humus from real photos.

Friday, July 11, 2008

Goldrake model

Yesterday I show some pictures of the Gundam-like robots available at InGame.de where a large collection of MD3 models is available, free to use in the old Quake III Arena.
Since we already made a big jump back in time, I recall another great japanese TV serie that I used to watch when I was a little child: Goldrake. Here is a screenshot of the giant robot driven by Actarus, always taken from InGame.de.

At the time of the TV serie, I coudn't imagine a videogame looking better than the cartoon itself (or better I coudn't imagine a videogame at all), but now it's even possible to create such a game at home, given enough programming skills and a free engine like APOCALYX. The result will not be comparable to commercial titles, but what a giant leap from the schematic ball and pads moving on a black & white TV screen of the seventies.

Thursday, July 10, 2008

Gundam models

In my continuous search for good free animated 3D characters, I look for large repositories of MD2, MD3 and MDL models, that are the most common because they were the formats supported by Quake2, Quake3 and Half-Life. A large one was PolyCount, but in the past years it suffered a redesign and the links to the most interesting models are not available yet.

Anyway, looking carefully, there are other large free collections out there. A very interesting one is InGame.de. There you can find some of the most famous MD3 models, but also some that I could find only there. For example, you can see in the screeshots some nice Gundam-like robots very useful for some space combat game.

As usual, these models are explicitly provided for free when used in Quake3. For other purposes, such as the inclusion in other games, one has to ask for permission to their authors. In my experience, it's not too difficult to obtain the permission, asking kindly and giving proper credits, because every artist wants that his models still survive in the ages and does not fade away when the environment where they lived becomes obsolete. Of course, the model should not be too similar to copyrighted material, as the robots in the screenshots, because in that case one may incur in problems difficult to solve without paying a lot of money.

Wednesday, July 9, 2008

Mushroom model

I need a model for Mushroom's Ride, but it seems that mushrooms does not inspire any builder of free 3D models, in fact I look everywhere on the internet but I coundn't find any simple or complex mushroom model. So I had to show my poor modelling capabilities and you can see my very schematic result in the screenshot below.

Years ago I have been working for some time as a technical drawer on AutoCAD. Even if I possess some practice, I can't find any modelling program that is enough intuitive and easy to use (to me), probably because I have very little practice in 3D drawings.
The modeller that I find most difficult and disorienting is Blender: I regurarly lose myself in its interface. Anim8or is easier to master, but it's almost impossible to use its texture tools.
To create the mushroom, I have used instead Wings3D and I must admit that it is a great tool. I put together a cylinder and a cone, shaped them a little and then layed down the triangles on a texture to color them in a paint program. If only Wings3D wouldn't be so slow when the number of triangles increases, I'll use it more frequently to create static models.

Tuesday, July 8, 2008

DataBase connections

Recently several users asked about the DB management capabilities of the engine. APOCALYX includes LuaSQL, so it's very easy to connect to an existent DB, simply write the following lines:
env = luasql.odbc()
conn = env:connect("your_database")
The your_database DB must already exist, of course. To create it use the usual ODBC system tools. All the functions are explained in the documentation (read the file APOCALYX-manual-luasql.htm).
The example above uses ODBC. If anyone wants to use MySQL instead, it's necessary to download a different version of the engine. I removed MySQL from the standard release because it requires a DLL that is 600 Kb in size. Click here to download a MySQL enabled version of the executable (3.3 Mb).

Monday, July 7, 2008

Mushroom's Ride

First screenshot of Mushroom's Ride, a prototype in development written for the Lost Garden's Shade Compo (read the original post about the Lost Garden Awards).

As you can see, to fast prototype the game I'm starting from the sources of Dragon's Ride because there is no time to reinvent the wheel again and again. In place of all the models features in Dragon's Ride, I simply put two fairies: they are going to lead the mushrooms to their goal, moving along fresh shadows and avoiding the hot sun.
Now I'm going to model a few mushrooms. As you know, my modelling capabilities are very poor, but I must admit that mushrooms are not the most difficult thing to model in the world... or, at least, I hope so.

Sunday, July 6, 2008

MMORPG in development

Some days ago I talked about the ancient origins of the APOCALYX engine (read the post). I said that all started from a demo written for an old NeHe Contest, the author of which was Matteo Perenzoni.

I forgot to mention that Matteo has further improved his demo developing his own 3D engine, independently from my APOCALYX. That engine was then improved to support MMORPG (Massive Multiplayer Online Role-Playing Game), those games like World of Warcraft Online or Star War Galaxies that focus on large persistent worlds where players meet each other in cooperative quests or player-vs-player combats.

If you are interested to follow the development of Matteo's MMORPG (waiting for my own planned RPG game), or also want to help or know more about his engine, visit the official site of the Lost One's Land (in italian), that is the title of the game.
There you can find screenshots of the game models and editors, some concept art and also interesting tricks about the development. For example, to ease the work of the modellers, Matteo developed a tree genereator, so the engine automatically fills with trees the ladscapes of the Lost One's Land.

Saturday, July 5, 2008

Genoa, Italy (II)

Just a screenshot
Virtual Greetings from Genoa
(Piazza De Ferrari)

Friday, July 4, 2008

Genoa, Italy

Just a screenshot
Virtual Greetings from Genoa

Thursday, July 3, 2008


One of the improvements of the recent released alpha version of the engine (read the original post to download the preview) is related to the collision of ODE (Open Dynamics Engine) rigid body objects and the BSP (binary space partition) geometry. Now balls and other bodies bounce perfectly alsp in BSP levels.

To see the feature at work, execute the demo "BallsOnTriMesh.lua" available in DemoPack1. The demo is divided in 4 sections performing collision of two meshes (ball shaped) against a mesh, a height-field, patches (infinite terrain) and a BSP level. Finally, also the latter works perfectly, so users can simulate the dynamics of ODE objects in complex indoor environments.

Wednesday, July 2, 2008


Recently I have discovered the world of non-Microsoft BASIC languages. In fact, a visitor suggested ScriptBasic (read the post) as an interesting scripting language and effectively I plan to support it, at least at a basic level (no pun intended). Then another visitor suggested other BASIC interpreters and compilers, opening new landscapes that I completely ignored.
Among the suggestions, the most interesting that I've found is FreeBasic, because free and open source. This version includes a lot of useful built-in libraries, interesting features, such as an IDE, and supports a lot of platforms. FreeBasic can only compile BASIC programs, so it is not useful for my particular needs (I need an interpreter), but it is worth a try.
As the authors say: "The FreeBASIC project is a set of cross-platform development tools consisting of a compiler, GNU-based assembler, linker and archiver, and supporting runtime libraries, including a software-based graphics library. The compiler, fbc, currently supports building for i386-based architectures on the DOS, Linux, Windows and Xbox platforms. The project also contains thin bindings (header files) to some popular 3rd party libraries such as the C runtime library, Allegro, SDL, OpenGL, Gtk, the Windows API and many others, as well as example programs for many of these libraries.
FreeBASIC is a high-level programming language supporting procedural, object-oriented and meta-programming paradigms, with a syntax compatible to Microsoft QuickBASIC. In fact, the FreeBASIC project originally began as an attempt to create a code-compatible, free alternative to Microsoft QuickBASIC, but it has since grown into a powerful development tool. FreeBASIC can be seen to extend the capabilities of Microsoft QuickBASIC in a number of ways, supporting more data types, language constructs, programming styles, and modern platforms and APIs.

Tuesday, July 1, 2008

Users' Gallery

I know that the documentation of the engine is not simple to master. Probably I had to focus a little more on getting started papers, rather than big lists of functions. However I think that learn by example is a good way to... learn, so the source code of the demos is the best starting point for new users, if they already own intermediate programming skills. I provided a quite large number of demos on every possible topic, especially fundamental topics. I wrote also a few more complete game-like demos, but interesting examples were provided by advanced users, too. Visit the Users' Gallery to download a selection of users' demos.

For example, Miguel Manchego Rivas wrote Treasure Hunter, that is a side scroller shoot'em up demo. It performs an original use of the entities placed in a BSP level, a basic control of the avatar and shows hot to manage custom MD2 animated models.
Miguel provided also a demo about a third person view shooter with advanced jumps, more complete in comparison with my Urban Tactics, where the level is flat and jumps are not considered.
Then Robin Knight wrote a first person shooter demo with a large level, lot of enemies and powerups. The demo includes also an interesting tutorial.
If other users want to donate their demos and trials to the community, I'll be very happy to publish them on the APOCALYX site.
Thanks to all those who are going to contribute!