Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Wouter van Oortmerssen, posted on December 31, 2001

Image Description, by Wouter van Oortmerssen

Yes, this is yet another landscape engine IOTD, but quite a different one this time :)

Cube is my tiny fps game engine project using a very simple design, that does a lot completely differently from most fps engines, for the sake of simplicity. Some of its features:
  • automatic LOD on the whole map allowing for configurable fps / visual quality tradeoff on any hardware.
  • very high precision dynamic occlusion culling.
  • simplistic but effective lighting, that can do dynamic soft shadows & lights.
  • in-engine editing of the world in full 3D, even with multiple people (coop editing, a first!).
  • no map precompilation of any kind needed.
  • simplistic quad-tree world structure, with slopes (heightfields with caps) and slants.
  • collision detection & physics
  • client/server networking
  • multiplayer FPS game (weapons, items, game modes).
  • Feel free to have a run around the game/engine yourself, it is available at

    My goal with this engine, besides having fun programming, was to keep things simple (there is that word again) so that I would actually have the time to make a full game out of it, rather than be stuck with a renderer that looks impressive but takes me 3 years to finish. Other goals were to make it very friendly for map editing, and to implement the kind of gameplay which seems to have grown unpopular in most recent games :)

    If you have any questions, I'll be happy to answer them.

    Wouter van Oortmerssen

    Image of the Day Gallery


    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
    Ben Hanson

    December 31, 2001, 10:07 PM

    I am curious as to the design of the engine, does it have an object oriented design or is it mostly C/Assembly?

    It is damn fast and nice; and it even has gameplay too!

    Ben Hanson

    December 31, 2001, 11:16 PM

    Oh yeah.. really notice the dynamic shadowing if you switch to editing mode and delete all the lights, then switch to the rocketlauncher.

    I really like the lighting alot..

    Ben Hanson

    December 31, 2001, 11:17 PM

    Woops, meant to post that in the other guy's post..

    Lion V

    January 01, 2002, 12:01 AM

    Ver-ry pretty !
    I`m going to d/l it, then report back.


    January 01, 2002, 01:12 AM

    i'm a friend of anything which involves tracing rays ;) great work!

    like a lot of people here, i'd really love to see an in-depth tutorial/article about the inner workings of your engine :) maybe this'll convince me to get back into hardware accelerated 3d stuff (i personally find that there's no difference between so many hardware accel games/demos, they all just look the same).

    i've never been good at level design, is co-op editing difficult/similar to normal level editing?


    January 01, 2002, 01:51 AM

    BAAAA !


    January 01, 2002, 02:28 AM

    The artifacts are caused by the opengl floating point accuracy. The algorithm itself is pretty simple once you think about it. Its one height field at the bottom, and one at the top. Each block rises vertically. I am guessing that when the top meets the bottom, that cell becomes an occluder. Then judging from the viewer position, he shoots out rays and records which cells are hit, stopping when he hits an occluder. This is just like the old wolfenstein engines. Jacco Bikker ("The Phantom" sorry if mispelled your name) had an advanced raycasting engine a while back in Pascal that was similar to this which supported things such as fake curved surface. The only flaw in this design though, is that it is not easy to adapt into an outdoor environment (extremely large worlds) and you can't have rooms above rooms. It still looks damn good though.


    January 01, 2002, 05:06 AM

    Oh... just remembered something... typing /sensitivity and pressing enter is quite funny... you can't move the mouse anymore... =) You really should check the number of parameters and if there are none, just type the current value for it... :)

    (instead of setting the value to 0)

    Tutorials about how i.e. the shadow-generation works, etc. would be helpful for those of us that haven't been working with that kind of stuff before... it's _never_ wrong to read how other people do things, no matter how simple they might be. The more methods available the easier it is for a programmer to chose which one works best for him/her.

    For instance, the block idea set my mind spinning at once so now I have to create a multiplanar version... :)

    Oh yeah, how do you handle multiple floorlevels? (for instance walking directly underneath another player)... I don't think I saw that at all in any of the maps... (that's why I'm planning on creating a multiplanar version :)


    January 01, 2002, 06:41 AM

    Nuff said.


    January 01, 2002, 08:41 AM

    Very nice, very fast (for some reason, I couldn't get it below 100fps on my machine, no matter what lod settings).

    I also found there a lot of what looked like t-junction artifacts.

    Fredrik Redgård

    January 01, 2002, 08:41 AM

    The game crashes on my computer after a while (different every time)

    1.2GHz/256MB/GF2 MX/WinXP

    I like the ingame editing, and the coop editing.
    very nice.


    January 01, 2002, 10:33 AM

    Hmmmmz, it's been a long time since I felt compelled to reply to an iotd, bu this time, I couldn't hold myself. This has GOT to be the best IOTD ever... erm, wait, let me rephrase that; This IS the best IOTD/demo combination since I've been reading flipcode (a good year now)

    I mean, dzjeeezes man, It looks soooo nice, and yet it's so fast, stable and entertaining. And it seems to me you have found the key to succesfull game programming. Getting something out there, in a not so long period of time (development wise) that'll entertain people, without forcing them to fork over alotta money for an overpriced graphics accelerator.

    Mkay, enough ranting 'bout how good it is, let's start with the things I think could be improved upon: 1. Rendering artefacts (the T-junction artefacts mentioned before) 2. Level size (but that seems to be more a matter of choice instead of lack of capability) 3. Level design (although there's no accounting for taste, I find these maps way to quaky, or (worse) doomy...) 4. Could be my system, but I didn't notice _any_ dynamic lights whatsoever (Win98 Final RC, ATI Radeon).

    Greetz, Flous


    January 01, 2002, 10:34 AM

    it can cull a visible cube if its small enough such that its not picked up by 2 adjacent rays (i.e. fits within about 0.6 degrees of FOV, currently) and its neighbour cubes are all closer than itself. This really doesn't happen at all, and when it does (I have yet to spot an intance of it) it is so small that it probably isn't noticable.

    the texture coordinates are generated by the world coordinates, currently. This makes a lot of sense since its efficient to build your architecture on ^2 boundaries anyway (to get efficient geometric mipmaps).


    January 01, 2002, 10:51 AM

    He mentions this, and that with the LOD setting at 250 it isnt really noticable.


    January 01, 2002, 11:07 AM

    This is a really good one. I get 30fps (sometimes 50) using my p2-450mhz/300mb/TNT1. My computer never run anything fast and absolutly not if it is OpenGL. I was really chocked =)
    The flow is really smooth even at that kind of fps.

    I would also like to read a tutorial or something about how the engine is built up and how things are made. Although it might be simple someone can always get smarter from it =)

    Once again .. it really rocked :)

    // j


    January 01, 2002, 11:18 AM

    scarab: yes the console doesn't behave identically to the quake engines, but I never promised this either. I'll see what I can do :) The weapon fire just throws some particles around, was never a big focus.. it may improve in the future. No I haven't read that chapter, unfortunately :)

    deathlord: there is already a minimum LOD of 25 which guarantees that within 25 cube unit of the player all is rendered at maximum detail. But the physics is done independant of LOD, i.e. always using the most detailed world data... if he fell through the floor at 2fps that is a physics bug, not a LOD problem.

    ben: cube is written in "C++ as better C", i.e. using whatever C++ features I happen to need. It is not OO really, as there is very little in terms of "objects" going on; most data sits in big static arrays (and before you shout how crap this is, it does make sense for what cube does). It contains no assembly, there would be no point, cube is limited by what happens beyond opengl calls on allmost all systems (on my system, it loses only about 5fps out of 60 when going from release build to debug build).

    lycium: I think the fact that all hw engines look similar is more a lack of people's immagination than a technical problem, I encourage you to have a go :) The difficulty in coop editing is more a social/disciplanary one, and one of having similar editing styles, than a technical one.

    DEVLiN: the current engine does not allow "room over room". the way I would handle it if I wanted to add it is very simple: have multiple layers on top of eachother. But I find the feature overrated, and I love the simplicity that comes forth from having just one level. It forces more creative level design.

    dirtypunk: yes... the way I render the world, finding all T-junctions would either be very hard or be a large penalty in amount of polygons. The way I tried to solve it (semi successfully) is to render the skybox (#1 source of sparklies) only on sky polys (using a depth buffer trick), which reduces the sparklies a lot already. I am out of ideas of how to remove the remaining ones in a simple ways, if anyone has any insights, tell me.

    fredrik: sorry to hear that... you wouldn't know what a nightmare it has been to try to make an sdl/opengl program work on 20 different cards using 5 different driver versions on 10 different OSes, while having significantly less resources than id software.

    it seems like a lot of people are asking for a tutorial / more in depth explanation. I will make one then post it here.


    January 01, 2002, 11:50 AM

    I hope you will take advantage of the editability somehow in your game and make something unique not just a (stupid) "quake like" fps.

    About the lighting... looks nice but I think doesn't fit in to these gloomy levels very well. Maybe you should bring out the shadows and the changes in lighting a bit more roughly.

    Excelent idea. Having no bridges and multiple floors is acceptable. Duke Nukem 3D has already proven that.

    Keep up the good work.

    Christopher Dudley

    January 01, 2002, 12:32 PM

    Okay...I have been a longtime FlipCode lurker, in fact, I can remember back to when this site first began, but before this morning I have never seen anything that would compell me to place a post about it...

    Amazing! I have downloaded the demo, runs perfectly, it is stable, it is pretty darned complete, it is well designed, and it is cross platform. Carmack would indeed soil himself if he stopped by the boards!

    On the technical side, I got good fps, in between 12-40 on a...... PII 266 256MB Voodoo3 16MB. There are some visual artifacts, T-Junctions certainly, but for me it was only visible in the first and third levels. Wierd. I have not yet roused my brother from his slumber, but when he gets up I will fire this puppy up in multiplayer and see what falls out.

    This is the first engine in perhaps two years to give me a playable experience while also allowing stunning visuals. The lighting is right on, and the level design is top-notch. Bravo!

    Keep up the excellent work man, and make a tutorial on how you managed this, Abrash, Carmack and Sweeny could learn a thing or two.


    January 01, 2002, 01:02 PM

    scarab: yes the console doesn't behave identically to the quake engines, but I never promised this either. I'll see what I can do :) The weapon fire just throws some particles around, was never a big focus.. it may improve in the future. No I haven't read that chapter, unfortunately :)

    Well I don't like Quake 2 or 3 anyway, but their consoles are good. Your 'weapon a b c' command is clearly better than anything in those games though. :)

    The GPG chapter is called 'The Magic of Data-Driven Design'. It says that one should seperate code and data. The bare basics should go in the code section as well as AI and other complicated logic. Everything else belongs to the data and should be read from text files. Your menu system is a great example of this.

    Btw, it was my understanding that SDL in Windows is slow compared to using the Windows API. And then I run your game and see it blazing at 200+ fps! Wow. :) And the size of your .exe is equally amazing! Are the SDL header files really that light?


    January 01, 2002, 01:04 PM

    This stuff is known since Wolfenstein 3D, so I think Carmack knows it very well ;-)
    You can only use it for very simple locations that don't have bridges or rooms above rooms.
    But very good work IMHO.


    January 01, 2002, 01:08 PM

    Looks nice, but in the pictures above I keep getting distracted by the HUD information. White stuff floating over the gameplay at the bottom seems like it may detract from the fancy graphics. Sorry I don't have a solution to offer at the moment.



    January 01, 2002, 01:28 PM

    Well then Chris... remember me?

    Yer old teammate from Sweden... what do you say we use a similar approach for our engine? Albeit multi-planar (that is, level over level) to get bridge and room-over-room capability?

    Jesus man get online on ICQ sometime so we can start workin'!



    January 01, 2002, 01:34 PM

    LOL, I speak to my development teammate every day on ICQ. In the vacations almost 24/7. :)


    January 01, 2002, 02:00 PM

    Yeah I really like it that way... once you command parsing in your app, it becomes actually simpler to keep things in a cfg file, besides the obvious other advantages.

    Well, SDL is certainly problematic in windows I have noticed now cube is being used by a wide variety of people, quite a few crashes happen within SDL calls. But I never had any problems with speed. As far as I know, for an opengl app once you have your screen set up, the "speed" of SDL doesn't matter anymore anyway.

    I don't think SDL adds much to the exe at all, as do most libs. The vcpp linker is quite good a stripping unneeded stuff, it seems.


    January 01, 2002, 02:27 PM

    What are the problems with SDL you are experiencing? I'm using it and am not aware of any problems, but am concerned about what I may not know.


    Lion V

    January 01, 2002, 02:45 PM

    Well, if you can polish off the bugs, I think I owuld buy it.

    I have a Voodoo3 PCI, 96 RAM, and a 300Cyrix, and your game runs smoother than UT at the moment.
    With all features jacked up to max, FPS is 13-15.

    I think you need to get a publisher.

    And I`m not giving you crap here.



    January 01, 2002, 02:53 PM

    by far out the coolest IOTD! Goed werk man! snel mooi en een handige
    editor goed werk!! Ga zo door Aardappel ;)

    zed zeek

    January 01, 2002, 03:07 PM

    bah everyone seems impressed but i havent been able to log onto yet yesterday or today, have to wait until traffic dies i expect. the above pictures look nice + colourful anyways, are those doom sprites i see.
    >>no map precompilation of any kind needed. sounds interesting gonna have to take a looksy


    January 01, 2002, 03:10 PM

    Seems it yer side of the 'net that's dead. I have no troubles whatsoever to access the site. Not today, not yesterday, not 27 seconds ago.



    January 01, 2002, 03:53 PM

    Not bad at all! Music's a big lo-fi, though :-)

    I remember Marathon (remember that?) which used the same technique, except they generalized "squares" to arbitrarily-shaped polygons (up to 8 vertices; convex only). Of course, they only had software rasterization at that time, and looking up/down wasn't perspective correct, but at least you could do it...

    Marathon had some great maps, though, and they used their engine to do lots of moving floors/ceilings to simulate elevators, rising lava, and other such things. You should add auto-moving/triggered levels to your engine; that would give you a lot of interactivity fairly cheaply I think.

    This thread contains 70 messages.
    First Previous ( To view more messages, select a page: 0 1 2 ... out of 2) Next Last
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.