Development: creature AI, start of architecture mode, fractals demo, more

June 10, 2012
Room Arranger with SSAO demo, shown by view3dscene
Room Arranger with SSAO demo, shown by view3dscene
Room Arranger with SSAO demo, shown by view3dscene
Difficult polygon triangulation
Difficult polygon triangulation
Fractals 1
Fractals 2
Fractals 3


First of all, we had a plan to release new shiny engine version at the end of May — sorry everyone, as you can see, we failed to make it on time. The work is progressing nicely (more details below), but there's just never enough time to finish it. So, sorry, everything has to be delayed a little further. (And if you would like to help: we have a list of things you can do to help (not all of them require experience with programming), and donating is very appreciated (as it allows me to spend more time on the engine development, instead of on various freelance jobs). Thanks in advance!)

New features done lately:

  1. Engine contains now the promised CastleCreatures unit (see inside src/game/ subdirectory in SVN), that allows you to easily create creatures with artificial intelligence. (For details see initial docs and castlecreatures.pas source.) There are various ways to use it:

    1. For starters, you can just use the walk-attack-state intelligence, by the TWalkAttackCreatureKind class. Such creature tracks the player (remembers last seen player 3D position, walks/flies to it, possibly through sectors/waypoints — so it can pass through narrow doors in a labyrinth or walk over a narrow bridge), attacks the player from the right distance (this can be either a melee attack, or shooting a missile — which adds a missile to the 3D world), eventually runs from the player (when he's too close and/or our health is low). For now, the player is always the main enemy, and there's no "creature vs creature" fighting, although it can be added easily in the future.

      For basic usage, there's no need to even derive new classes. All you need to do is to create a directory holding creature 3D data and index.xml describing it (for example, see various subdirectories of castle/data/creatures/ in SVN).

      There are a lot of settings to achieve particular behavior, e.g. cowardly/brave, offensive/defensive, melee/ranged, etc.

      There is also a "missile" intelligence (TMissileCreatureKind), that causes the creature to blindly go in given direction (possibly with gravity and/or homing (close-on-target) features). On impact, missile may explode, hurting player and/or other creatures. Any kind of missile, like arrow or lighting bolt, is represented as such "missile creature", that flies independently of the shooter.

    2. You can also derive simple descendants of above classes, to customize their behavior. For example, "The Castle" customizes walk-attack creature to give both ranged and melee attacks to the Spider Queen, to make werewolves howl from time to time, and such. See castle1 GameCreatures.pas unit sources. We plan to add a simple FPS game to the engine examples, to illustrate this nicer.

    3. Finally, nothing stops you from taking basic TCreatureKind, or even the more basic T3DAlive class, and add an intelligence there. Methods MyMove, MyMoveAllowed, MyHeight, MyLineOfSight allow you to add any kind of movement/intelligence to any 3D object. See Base3D unit and classes there.

    We also have CastleResources unit (for reference-counted, heavy 3D resources) and other new units in the src/game/ subdirectory.

    This achieves the major goal for the next engine version :) But there's still more work — we want to have there also (pickable) items, advanced player management, and advanced level loading. This is all already implemented in castle1 source, but we still need to generalize and clean up the code.

  2. Jan Adamec started implementation of a new camera navigation method, called Architecture now. The idea is to create a more constrained Examine mode, suitable for viewing models with a ground/floor, where you don't want to accidentally flip the model upside-down.

    The new navigation mode is already available on view3dscene header (take view3dscene binary from snapshots), it's also available for VRML/X3D models by NavigationInfo.type="ARCHITECTURE". Remember it's a work in progress for now, the behavior will change.

  3. Some more screenshots of Room Arranger scenes with Screen Space Ambient Occlusion, and more screenshots of triangulating of non-trivial polygons, are visible on the side of this post. See previous news for details about these features.

  4. Fractals demo using our engine (TCastleWindow and such) is available on github: The code is GPL >= 2, by Michalis. Partially, I set this up to play with github :) But it also shows one way to distribute a code of a game/utility using our engine. You can look at README.txt, Lazarus lpi, and compilation scripts there as an example.

  5. lets_take_a_walk, demo of 3D sounds inside our engine, was refreshed (to use T3D classes) and added as another example to our engine sources (under castle_game_engine/examples/3d_sound_game/).

  6. Added comments about sponsoring, and links to FOSS Factory and to our donations page.

  7. Lazarus TOpenGLControl component got quite a few improvements in Lazarus SVN, thanks to the work of Michalis, Jan Adamec and Andrey Zubarev: MultiSampling, AlphaBits, DepthBits, StencilBits, AUX buffers. This is an ancestor of our TCastleControl component, so all these improvements are directly useful also inside our engine.

  8. Other small fixes/updates: