Jump to content

Leadwerks editor and memory


Rick
 Share

Recommended Posts

Tim and I have a game where we have a small town setting (think 500 ppl). We've made a house prefab (both from csg and from model pieces that we put together to make the house) and wanted to see how many houses we could have in the map.

 

I'm able to get between 90-100 copies of the csg house prefab before the editor crashes. The Leadwerks.exe process is always showing around 1.4 gig when it crashes. Our camera is a top down isometric type camera so the fps when looking down and only seeing 1-2 houses at a time is fine, but the memory is the issue.

 

What can be done about this? I assume this is because the editor is 32-bit and not 64-bit? This is a problem in our game as 90-100 houses isn't even a 500 ppl town.

 

Is there anything I can do to help LE handle this or is LE just not meant for this kind of memory usage?

Link to comment
Share on other sites

Can you elaborate? I'm hearing from some people that some other engines allows you to "turn off" areas of the map. However I'm not sure what that means in terms of memory because it all seems to be memory related here.

 

In game I could look at loading these prefabs at runtime (since 1 instance would already exist it should be "instant" and not pause), but how to setup the scene in the map editor is another issue. A work around could be to place a pivot where the house should be and then load that house when the player is close in the game, but it really sucks because you never see your scene in the editor which is really needed.

 

Anyone have possible LE editor workarounds that they can think of?

Link to comment
Share on other sites

CSG geometry is always unique, not instanced. Therefore your geometry is taking up a lot more memory than if the whole thing was just a model. 1.4 gb is in the red zone for 32-bit processes, at which point you may run into problems allocating contiguous blocks of memory.

 

The same map would work just fine with instanced models. This is a situation where CSG is not a good choice.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

CSG geometry is always unique, not instanced. Therefore your geometry is taking up a lot more memory than if the whole thing was just a model. 1.4 gb is in the red zone for 32-bit processes, at which point you may run into problems allocating contiguous blocks of memory.

 

The same map would work just fine with instanced models. This is a situation where CSG is not a good choice.

 

Interestingly enough the editor crashed after 20 of our instanced house model (non csg). Now when I say instanced house I don't mean the entire house is 1 model. We made wall segments and floor segments and we pieced together a house with multiple instanced of each. However, after 20 of these house instances built this way the editor crashes.

 

This presents a real head scratcher though on how to handle this in the editor (in game I can unload/load instances based on camera position which shouldn't be a problem). It sounds like some engines allow you to turn "off" entities in the editor where memory is released and obviously nothing is drawn, but entity info is still there so you can flip it back on and have the editor load it. This would allow us to have "bigger" areas in the LE editor.

 

This could be a handy flag to have for LE. The entity stays in the scene but this flag tells the editor on map load if it should really load this entity or not and during checking/unchecking of the flag load and unload the entity in the editor. This would allow us to have these large maps with lots of models in them. If the setting propagates down we can make pivots as parents for map sections to unload/load all at once a bunch of entities. This puts managing this into our hands.

Link to comment
Share on other sites

That should not happen unless your memory usage is extremely high somehow. Please send me your project if possible.

 

We made wall segments and floor segments and we pieced together a house with multiple instanced of each.
How many is "multiple"? 10? 500? Each entity has a certain memory usage so if your map has 10000 entities then it would not surprise me if you ran out of memory.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I'll gather the project up here shortly and send it your way. This is a battle between variety and memory.

 

The one made of models has about 500 some instances. I was thinking instances were very small in memory (only pos/scale/rotation/color/some sort of pointer to base entity). 54 bytes per instance x 500 instances = 27,000 bytes per house x 100 houses = 2.7 MB total (clearly I was wrong :) ). That was my thought process anyway but apparently there is way more bytes per entity instance.

  • Upvote 1
Link to comment
Share on other sites

Instanced models (which are always on) save space because the model geometry is only stored once. However, the entity itself takes a certain amount of memory, and it's not just the 4x4 matrix.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Okay, this is what is being done:

post-1-0-06321600-1416946202_thumb.jpg

 

This is the most inefficient way to build a scene I have ever seen. I understand what you were trying to accomplish with this approach, but it's not practical.

 

For the particular style of game you are doing, I recommend using some big room-size modular pieces, both for performance and production speed.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Via the chat this was the first one we tried. We made larger floor and wall segments now but with still poor results. I guess we'll look at entire room segments and combining those.

 

However, this makes getting texture variations via the atlas a little different or I guess less variant. I think we'll try this and see how it goes.

 

You went offline, but a load/unload option would be handy in the editor.

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.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

 Share

×
×
  • Create New...