Category Archives: game engine

Scripting is Fully Functional

In an earlier post, I have written that I have implemented Lua script support in the engine. Now it reached its full power since I have added a proper callback mechanism to it. It makes possible for the triggers in the engine to call user specified Lua functions on firing. Unfortunately, SWIG does not help to implement such callbacks, so I had to do it by myself.

Read the rest of this entry

Box Projected Cubemap Environment Mapping

I have added a new technique called … I’d rather not write  it down again…. So, the great thing is that it mimics reflections on shiny surfaces using a simple, but yet quite accurate approximation based on environment cubemap textures.

For more details, see http://www.gamedev.net/topic/568829-box-projected-cubemap-environment-mapping.

The hard part was to find a hidden bug in the engine that prevented me to render in-scene cubemap snapshots using a dedicated off-screen compositor chain. But eventually I have managed to find it and it seems that it worth the effort.

The engine automatically places light probes in each room in the level at load time, then it renders a fully lit HDR cubemap texture for each of them. The engine uses these cubemaps and some extra parameters assigned to the probes, to calculate the reflections with the aforementioned method.

First I have experimented with a similar idea that uses spheres to distort the cubemap look-up coordinates, but it was inaccurate. BPCEM gives a more accurate results in box-shaped rooms.

There are some images with the results:

A demo video:

The First Teleports

Again, I had some time to play with the code. And again, I have rewritten the game object representation structure to make things simpler inside the engine. I have added a new object type “function”. It  is a non-rendering scene node, making different things to other objects. It can heal, give damage, etc., and teleport. It is activated a physics trigger by touching.

I have implemented  some teleports in the scene using these new objects. The following video demonstrates how it works.

Basic FPS Character Control

This Bullet logo was made using Blender 3D, fo...

Image via Wikipedia

I have switched from PhysX to Bullet (but not irreversibly) due to the long waiting for my developer account from NVidia. To test the physics, I have implemented some basic FPS character movement functionality. First I have tried to use the Bullet’s character class, but after a while I have realized that it would be too painful to use it. Now it works with a simple capsule collision shape locked in vertical orientation. Here is a short video about the new features.

Let There Be Spotlights…

…and there are spotlights. And we see the lights, and this is good.

And I am very happy with it, because it took some time to get it work correctly due to some small and annoying bugs. But the results are fine. We can add spotlights into the scene, we can put projected textures on them and they can cast dynamic shadows. They are integrated into the deferred renderer, of course. Spotlights are rendered with a closed pyramid, but is possible to use a cone instead. Bounding boxes are adjusted according to the current transform of the light frusta to keep visibility culling efficient.
Read the rest of this entry

Porting Back to Linux II.

This post is the second part of another I posted earlier.

The detection of uninitialized class members is one of  of my recurring problems with C++. The language standard does not guarantee anything about member variables so I should initialize them myself. Unfortunately, VC++ compiler does not warn me if I forget to initialize a class member variable, even if I set the highest warning level. GCC detects this kind of sloppiness and reports them to me keenly, making great improvements in code quality. Furthermore, GCC goes one step beyond and warns me if the initialization order differs from the declaration order (see Effective C++ about this).
Read the rest of this entry

Lua Scripting Just Have Been Added

While I was doing the porting, I have found SWIG, a very useful tool for Lua integration. Actually it supports so many other languages and interfaces, but I was interested only in game scripting so far.

Why scripting? Scripting is an important feature of a typical game engine, and Merlin3D is not an exception. Prototyping, game and GUI coding is much more easy if I do not have to recompile the whole game engine or DLL. With SWIG adding scripting to the engine is quite easy, so it seemed to worth a try.
Read the rest of this entry

Porting Back to Linux I.

Motivation

Several weeks ago I have taken over a small C project from my colleague. This project was almost totally unrelated to computer graphics or game development, and it was cancelled later, but it ran on Linux, so I had to install Linux on my computer. Aside from the compatibility problems of different Ubuntu releases with my old ATI card, and not counting the six fruitless attempts to get a working Linux on my machine, it was a pleasant task for me because it recalled some old memories about the early days of the engine development. The engine coding was started on Linux originally, but I am developing it under Windows for long time.

So the project gave me the idea to port my game engine from Windows back to Linux again, or at least to see that whether it still compiled. So I copied the Makefile from the old Linux version and the sources from the Windows version, fired up Emacs, my old favorite editor, and started to wrestle with the compiler… 🙂 Read the rest of this entry