Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Sep 2012
Offline Last Active Today, 08:11 PM

#5281158 Game Engine design for many-typed many-copied entities

Posted by on 13 March 2016 - 10:32 PM

I wonder how fast a binary search over a vector would be compared to a custom bitset implementation...
Binary search fcks up the CPU's branch predictor. Its pretty much one random jump into memory each iteration, hard to predict, and many times the branch decides which memory segment needs to be loaded next if they're far apart enough, thus hindering the CPU's ability to preload it into a cache line. This cost is amortized if you're handling a lot of data.


Bitsets its a couple bitwise ops to find the word index in the array, jump to it, then do a couple bitwise ops again. Much more straightforward (although not as memory efficient if they're very sparse).

#5280620 Game Engine design for many-typed many-copied entities

Posted by on 10 March 2016 - 08:58 PM

When you scroll down to "Results", the graph shows what I mean about ECS not scaling well:


Eh, check these benchs from artemis-odb guys https://github.com/junkdog/artemis-odb Those are raw benchmarks, no game, just testing the framework's functions in a "game loop" without game.


So I cloned Artemis Spaceship Warrior demo game, adapted it to dustArtemis (my own fork of artemis), made it spawn a shitload of enemies and bullets and I can play with around between 7k and 12k active entities flying around according to the counter, at 300 fps (minimum). Which is 3.3 milliseconds for each frame of the entire game, and its made on libGDX, which isn't known for performance. I get over 100k entities created and deleted after playing the game 15 seconds like this, 3.3 ms per frame minimum.


(it has a high entity count because each bullet, particle and background star is an entity, so it gets crazy high).

#5280461 How to programmatically create Tile Maps

Posted by on 09 March 2016 - 08:02 PM


#5280448 Blending with two buffers

Posted by on 09 March 2016 - 06:16 PM

Don't draw to the front buffer. It causes artifacts.


The front buffer is conceptually the one you're showing in the monitor. So any tiny change in there will cause artifacts. Don't touch it. If you need more buffers, learn how to use framebuffer objects.

#5280447 How to programmatically create Tile Maps

Posted by on 09 March 2016 - 06:12 PM

So you dont have a computer, but you're coding in Java... how exactly? In paper?

#5280074 Game Engine design for many-typed many-copied entities

Posted by on 07 March 2016 - 04:40 PM

What I am looking for is some advice on possible implementations of a game engine that is able to handle many (100+) different entity types (e.g. Wrenches, Clothes, Wall segments, Grilles, Chairs, etc. etc.) and also efficiently allocate resources for many instances of that entity (50+).
5000 entities then? Thats nothing. Anything will work fine with that, unless you do something terribly wrong of course.


Also if say, a chair is something static, and a wall is static, its not a different entity. They're the same static kind of entity, with different textures. I very much doubt you'll have that many different kind of entities.


A game like Skyrim was made with probably less than 100 different kinds of entities (npcs, quests, statics, animated, weapon, armor, spell, and a couple more, thats it). Yours wont have as many as you think.

#5277330 Managing game object IDs

Posted by on 21 February 2016 - 02:54 PM

Hi! I wanted to hear your opinions on how to manage game objects IDs, at runtime and in save files or game data. Have in mind I'm talking about a persistent world, RPG, think of any Elder Scrolls game (Oblivion, Skyrim, etc), also single player, so no additional restrictions for network stuff.


Currently my tiny project has only runtime entity ids only for the things currently loaded, which means I create an entity, which has an ID, and use that to fetch its components when I need them. After the program is closed, everything is lost.


Eventually I'll have to move this into some form of persistence, I'd need a way to store entity instances and their IDs, for normal base game data, and do the same for storing player's save files.


Afaik Elder Scrolls games have a couple of "levels" for this data:

  • First is the main game data. This stores the base game data for all things (NPCs, places, quests, etc). All objects have their own ID.
  • Second the "plugin" data. This stores official addons, mods, and that kind of thing. These also have their own IDs.
  • Third is the player data. These are the game files, I'm assuming it kinda works like the other two, storing the IDs of things the player modified from the base game (say, player killed an NPC, solved a quest, looted a dungeon, etc, that stuff will be stored there,), and also the things the player "spawned". Say that you spawn a demon companion, that NPC is new, or say that you crafted a sword, etc.


I'm not quite imagining how to handle such things. For example, if we're going to make a new unique ID for a crafted sword, we need to know all used IDs in the game, even for stuff that isn't loaded so not to step over an existing item. I'm guessing the ID list is either present in memory all the time, managed through an embedded database or memory mapped file maybe.


Thats fine because we know the IDs occupied by the base game and the ones the player modified. But what if the user makes a mod that adds a new item? Or if I release an official addon that adds a new town or something?


Now I'd need to patch up all the IDs of the addon, and/or patch up the IDs of the player's save game and all their references. Moreover, now the load order of the game data matters. If I load up an addon or another before/after they were before in a previous game run, their IDs will be different (ie, run 1: addon a gets loaded before addon b, so addon a IDs are smaller, run2: addon b gets loaded after addon a, addon b IDs are smaller now), and thats a whole different kind of ID patching D:


Any opinions/experiences about this?

#5277318 Game Engine Architecture: what's after that?

Posted by on 21 February 2016 - 01:01 PM

What does it help you build?
By itself nothing really. Its an overview on how game engines are architectured, what kind of subsystems they have, how they communicate, with advice on how to go about designing them and coding them. That is why its "Game Engine Architecture". 


And its big, its big because game engines are fucking big. So I'd advice you to read it anyway, so you know what you're getting into.

#5275585 Do game developers still have any reason to support Direct3D 10 cards?

Posted by on 13 February 2016 - 05:29 PM

I'd say D3D9 lasted for a good while because of D3D9/GL2 level hardware on consoles. So will D3D11.x for the same reasons.


D3D10 is unfortunate enough that didn't matched any hardware present in the console generation at the time.

#5275006 Simple Open-Source Projects To Contribute To?

Posted by on 09 February 2016 - 10:53 AM

 I'm wondering if you guys are aware of any simple C# projects that I can contribute to. 
Small open source projects tend to be very personal, like one or two dudes team. You'll have a hard time convincing them they need your contributions.


You could fork something and expand it instead, but without a use case its useless (developing libraries in the void tends to do that).


So I don't think this is a feasible approach.


What you could do is develop your own projects, but read about the libraries you use, see their sources, see how they're developed. Maybe then, after you've used them, understood their development and gained experience, you can start to contribute back.


And as always, bug reports, those are contributions too.

#5272775 Vulkan is Next-Gen OpenGL

Posted by on 26 January 2016 - 06:57 PM

If they did the same thing this time, my bet would be on Valve taking to initiative to finish Mantle/Vulakn/Valven on their own, and form a new comittee making Khronos redundant. So, failure is not an option for them this time.

Or they could just wait another 10 or 15 years then try again! /s

#5272507 How can I implement a GREAT blur?

Posted by on 24 January 2016 - 02:46 PM

Your offsets are too big. Thats why you get those artifacts.


I suggest you read this:



#5271765 View/Projection Matrices for Cascaded Shadow Mapping

Posted by on 18 January 2016 - 06:15 PM

You can see the result in the video. The problem is, that depending on the horizontal angle of the camera a lot of shadow map resolution is wasted, because the shadow map does not "rotate with the camera". How do I achieve that?
I haven't implemented anything close to CSM but I've read (from Crytek's presentations IIRC) that rotating shadowmaps arent actually a good thing. By rotating the shadowmaps you create instability when sampling from frame to frame, which introduces shimmering. They got around that by simply not rotating the shadowmaps, wasted resolution yes but they get stable results.

#5270401 When are Shaders needed ? (wich context vers.)

Posted by on 10 January 2016 - 09:40 AM



There are only a few things that you can't do with shaders on "core" contexts. Like clearing the screen as you discovered, or blitting one framebuffer to the other with glBlitFramebuffer. But thats it, if you want to actually draw anything, you have to use shaders.

#5270379 Question about data and resources protection

Posted by on 10 January 2016 - 06:03 AM

Multiplayer games will end up checking these files as well, as it is trivial to modify these resources to gain a competitive advantage.
Very true. I was thinking more on the lines of an MMORPG. Wouldn't want anyone replacing the smoke grenade sprite with an empty one in a game like CS:GO or CoD.


I believe once heard of a game where the players would lower the graphics setting to a minimum since cloaks/smoke grenades at low quality settings affected visibility less than at higher quality. That sounds like a hard nut to crack : /