Jump to content

Render breaks after several map loads


Go to solution Solved by Josh,

Recommended Posts

Posted
29 minutes ago, Josh said:

recreating the cameras each time seems like something I would not do

I tried once to make loading same map without actual Load - just component Load() and few other stuff without recreating entities if they are already on map.

But faced same issue, just after more load attempts and due some annoying games issues i reverted back since it was not fixing main issue.

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted

Not sure how there could be 10 cameras.

1. Main camera from map.

2,3,4 created by its component

5. UI camera

6. Loading camera (in own world)

Even if main menu was not unloaded it would be only 7 in total

 

I even checked if old tactic camera component being destroyed - and it is, there is no double cameras after load

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted

You might be right. The render stats are reporting 10 but this reports only five:

			int count = 0;
			for (auto e : entities)
			{
				if (e->As<Camera>()) count++;
			}
			Print(count);

 

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

Posted

Okay, there are five cameras when the game is active.

I would make those cameras persistent across game loads and just create them once. The engine should be able to handle dynamically recreating them as much as you want, but something else is wrong and we don't have any way to easily identify what the problem is right now.

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

Posted
45 minutes ago, Josh said:

I would make those cameras persistent across game loads and just create them once

New world being created in every load (with old being destroyed), so no easy way to do it. And would be useless anyway:

https://www.leadwerks.com/community/topic/67399-render-breaks-after-several-map-loads/page/2/#findComment-318251

20 minutes ago, Josh said:

I am also seeing some extremely high numbers of entity indexes, like 50678. This is highly suspicious. What is causing such huge numbers?

In which map? (Demo on New Game or test level)

Every tile (where units walks) is a brush which component creates fog of war brush and outline brush (squares above them to show where you can go) at Start()

And there are also air tiles (pivot with tile component) above ground tiles, usually around 5 per ground i think. Need them for flying units, and for jumps, falling, elevators etc.

Each unit have outline model, two brushes arcs, 1 pivot.

Also tiles and units creates some other entities when needed. 

 

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted

This is your problem:

window->SetText(String(currentWorld->GetEntities().size()));

You have tens of thousands of entities being created each time the scene is loaded, and they aren't being deleted.

I win the prize. 🏆 Now I go to sleep.

I am marking this solved, because this is very likely the problem. You hit 65535 entities, the newly created camera has an invalid handle, since an unsigned short is used, and the shader cannot access data from the right location in the storage buffer.

Tell me if it's not, once you have had some time, but I think it is.

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

Posted
1 hour ago, Josh said:

You have tens of thousands of entities being created each time the scene is loaded, and they aren't being deleted.

But there being deleted.... Old world being destroyed with all entities. I will test a bit later to make sure.

1 hour ago, Josh said:

You hit 65535 entities,

Why unsigned short used? It's too easy to reach in any big game. Where is that var? CurrentWold entity count is stable every load, not sure where to look at.

Both world and scene with all entities being destroyed before each load

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted

Actually "currentWorld->GetEntities().size()" is freaking zero after clearing one Game with scene and before loading new one (and i spent a lot of time and effort to rid off all possible circular references that i don't use on purpose for temporary stuff like projectiles and action effects).

I keep some stuff in ResourceManager, but very few for making instances without loading some brushes and models every time.

And with loading same game load all over again should not increase total entity count at all. So please check your engine size how it's handles entity, because it looks like when actual entities deleted you keep tracking them or something which make you stack overflow eventually,

I still don't know what exactly var you meant, but std::list<std::weak_ptr<Entity> > m_entities in Wolrd is one of weak places if you don't clear from expired entities so i my best guess if that you are actually use some container with weak_ptr entities with 65535 max size which you and not clearing.

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted

Actually, hold on. It looks like the number of entities might be staying steady, but the handle indexes are not being released...I'll figure it out tomorrow...

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

Posted
10 minutes ago, Josh said:

Just add this in Application.cpp. GetEntities() does trim away expired weak pointers. That's why a method is used instead of a member.

GetEntities() returns correct entity count, which is 0 after scene deletion and stable practically same after each load.

I'm talking about this:

4 hours ago, Josh said:

You hit 65535 entities, the newly created camera has an invalid handle, since an unsigned short is used, and the shader cannot access data from the right location in the storage buffer.

What is this storage with 65535 cap?

 

Damn, i answered to changed/deleted message and can't delete mine now :D

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted
4 hours ago, Dreikblack said:

What is this storage with 65535 cap?

An unsigned short is faster than an integer index, and no one ever comes close to hitting this limit.

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

Posted

What type of entity is it, that there are 8000 of them? Where is this being created? I need to reproduce this error in a simpler example.

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

Posted
16 minutes ago, Josh said:

An unsigned short is faster than an integer index, and no one ever comes close to hitting this limit.

Well, i can't see even single demo on Leadwerks 5 yet, expect, let alone full games. So i'm only one who face half of bugs for now.

9 minutes ago, Josh said:

What type of entity is it, that there are 8000 of them? Where is this being created? I need to reproduce this error in a simpler example.

Already described it:

10 hours ago, Dreikblack said:

Every tile (where units walks) is a brush which component creates fog of war brush and outline brush (squares above them to show where you can go) at Start()

And there are also air tiles (pivot with tile component) above ground tiles, usually around 5 per ground i think. Need them for flying units, and for jumps, falling, elevators etc.

Each unit have outline model, two brushes arcs, 1 pivot.

Also tiles and units creates some other entities when needed. 

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted
Just now, Dreikblack said:

Well, i can't see even single demo on Leadwerks 5 yet, expect, let alone full games. So i'm only one who face half of bugs for now.

The largest levels in Crysis or something like that will only have a few thousand individual entities. The vegetation system can have more than that, but it's a completely separate system.

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

  • Solution
Posted

Okay, this will definitely be fixed in the next build that goes up today.

  • Thanks 1

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

Posted
31 minutes ago, Dreikblack said:

So what was an issue internally in the Engine?

I was not clearing some indexes from memory, in some situations, and the iterator kept getting bigger and bigger.

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

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.

×
×
  • Create New...