Jump to content

What the Engine (wtengine) - My game engine in development


Recommended Posts

Guess if I want to info dump share parts of the engine I'll keep it here.


Here's one of the key parts...


Basically the part that keeps track of everything in the game world, the systems are handled elsewhere.

For anyone unfamiliar with this, it's a method for rapidly searching parts of an entity.

For example, if you want to move objects around, they need a movement component.
Then the movement system only grabs the movement components and performs updates.

This way it doesn't have to process every single entity, just the ones it needs to.


Definitions > https://github.com/wtfsystems/wtengine/blob/master/include/wtengine/mgr/world.hpp

Implementation > https://github.com/wtfsystems/wtengine/blob/master/src/mgr/world.cpp


- Thread safe

- Exceptions thrown by this are just logged and do not stop the engine from running

- Uses a vector to track entity IDs

- Entities are referred by ID number or a unique name

- You can assign the name or let it random generate

- Unordered multi map to store the components

- Uses templates for selection

- Get/sets (const/non-const) for:

   - batch components of a certain type

   - all components for a certain entity

   - one component at a time

- New components are created by just extending the base interface class


Performed very fast in testing, it's hard to gauge now in running since it's all 2d, but can't wait to see what I hit once I get 3d in.

Pretty much the final version as well, unless much further down the line it's reviewed for performance optimizations.

Anything under that manager subclass is just a singleton.


Right now you need to hard code everything that will be loaded into the game (spawner is a separate part), but expanding some of the features of the engine to be more dynamic is next on the checklist after I figure out my unnecessary but I just want to do it solution to my input handlers ?

I wanted it to be possible to define the game objects using a modeling language, which fits nicely with TMC's goals.  So I'll be getting my engine's entity spawner and asset manager to be controllable by the in-engine commands rather than just hard coded in.  This alone would open up the ability for the engine to become moddable with little effort.  I've already looked at a C++ JSON library so will likely add that into the project when the time comes.  My only real restriction to the project is I'm targeting Emscripten.  I have to stick with more basic libraries, and I believe this one was just standard STL usage.


Here's the demo game that shows this all in action:



Sadly not in a build-able state RIGHT NOW due to the handlers update I'm trying to do.  I'm trying not to give up with this, but I had a simple "override the lambdas" approach before.


I got a Windows binary on there that's the same game, just a much older version of the engine.  Pretty much right after I got the ECS up and running.

Part of what I've been doing was I wrote the simple game first, then just reversed each part into more dynamic features to work like an engine and not a hard coded game.

  • Like 2
Link to comment
Share on other sites

Just off the top of my head:

- Audio system with a definable number of sample tracks in pre-compilation

- Two track music with a mixer, single voice channel

- Very customizable sprite system with shading and rotation (thanks to Allegro)

- Uses Allegro's backend for all input devices

- Threaded logging system

- Will branch out the render-er in a thread soon

- A bit in the early stages, but I plan on having nodejs scripts that automate build process


Let me know if anyone has any questions, if I think of anything more in depth I'll keep adding it here.

  • Like 2
Link to comment
Share on other sites

Well ya fix one bug and ya find another ?

After getting the handlers straight the game doesn't load now haha

But I think this was back from when I switched from python to nodejs for my scripting

I also changed around some of the names on the engine commands

I just got to update all the script files and I should be good

Gotta run out today so this I'm hoping will be a weekend fix


So my top priority list is now:

- fix this ^^

- work on the debug mode

- update loaders to be flexible

- web demo (full emscripten build)


I'm hoping I hit that web demo by late Nov


After that, implement 3d, then get any wrap up features in for what my game will need.  Mainly a robust and secure high score system and replays since I want to make an arena shooter.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site you agree to the Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.