flipCode - Tech File - Henry Robinson [an error occurred while processing this directive]
Henry Robinson
Click the name for some bio info

E-Mail: hr109@york.ac.uk



   05/13/1999, No Subject


In case you haven't seen it yet, over on the Unreal Tech Page there is an archive you can download containing _all_ the headers and some of the .cpp files from the Unreal code base. This is really interesting stuff: it's not often you get to see cutting-edge code. I appreciate Tim Sweeney's code sharing policy. While I wouldn't recommend anyone rips anything straight from these files (copyright, and lack of understanding that you get from writing it yourself), they can give valuable insight into the design of a top 3d game engine.

This gave me some ideas about my game object idea for Crystal Space. I have been worrying about the scheme for a while, in that I didn't think it was elegant enough, and was a bit convoluted. I think the basic idea is sound: a csGameObject interfaces with a csObject that the engine looks at. However, it didn't do this in a clean manner, and required a lot of fudging techniques in the subsystem code to actually make things work properly. Normally, this doesn't worry me so much: I like the 'black box' style of programming. However, this code needed to be nice and clean.

So I went away, thought about it, and then looked at the Unreal stuff and got a good idea. What I wanted was a system that acted like a normal class hierarchy, yet still had behavioural traits that couldn't be accomplished by a normal C++ class system. For instance, I wanted variables that could be easily and automatically serialised, acted like normal C++ variables (even at a core-code level), and immediately updated the equivalent variable in the csObject. I could possibly have accomplished the last with the use of references, but then we have the problem of the game content and the game engine using the same memory space, and I wanted to avoid this if at all possible.

So I reinvented the wheel. I defined a variable class, gave it some behaviour, and derived all the different types I needed from it. Therefore I could build in all the functionality I needed, while using normal C++ syntax to do the job. I could create an array type that had automatic bounds checking, an integer type that only serialised itself to the level of precision required, and a string type that had concatenation as a + operator. All had the basic functionality of their typical C++ counterparts, but performed the tasks needed to make the content control system work. Structs are automatically built in as a basic type, and even classes could be implemented. All a question of the right tools for the job.

H.





  • 06/21/2001 - Tech File Update
  • 06/07/2000 - Tech File Update
  • 08/25/1999 - Scripting Ideas
  • 07/18/1999 - No Subject
  • 05/13/1999 - No Subject
  • 04/26/1999 - On Scripting...
  • 04/24/1999 - Hi!

  • This document may not be reproduced in any way without explicit permission from the author and flipCode. All Rights Reserved. Best viewed at a high resolution. The views expressed in this document are the views of the author and NOT neccesarily of anyone else associated with flipCode.

    [an error occurred while processing this directive]