For a while now I've been developing a game that has a non-static world, that is to say the world is:
1: Tile-based and generated at random, but limited
2: Dynamic, meaning we have trees that can be cut, tiles representing holes dug in the ground, rocks that can be broken, etc.
As you can imagine, loading the entire map at one time isn't feasible. Because of this, we stream in whatever is closest to a player, and discard things that are too far away from everyone.
We used to be doing instantiation/destruction of the tiles, which was rock solid in terms of Bolt networking "what I expected was what I got", but for performance reasons we decided we had no choice but to create a pooling system whereby we instantiate a great deal of possibly needed tiles and deactivate them. Then as they're needed we reactivate them, move them into place, etc.
I've programmed numerous pooling systems before successfully, but having Bolt in the mix is... complicating the issue, to put it mildly. Currently the pooling system stores tiles in a deactivated, unattached state. The tiles are then attached in their OnEnable, and our despawn routine deactivates the tile (and on top of that we have all of our tiles set to "Detach when disabled" in their entity settings).
We have the strangest unexplained issues, such as tiles that will vanish right off the screen despite the fact that it's literally impossible for a tile to be placed back into the pool in those circumstances, and impossible for something else to "take" a tile whose GameObject is active. It leads me to believe the only explanation is that Bolt is doing something I don't want it to do with my objects, but I cannot explain what's going on.
At first I thought Bolt was just "self-destructing" and blowing up random objects because there are so many, maybe something to do with the scoping? Admittedly we have a ridiculous number of entities that Bolt has to take care of; we saw no way around that, since as far as I can tell, each tile needs to be its own entity. I just don't know what's happening.
I'm open to any suggestions on better ways to handle this and so forth, insight on what in the Bolt side of things could be going wrong, and so forth.
It's worth mentioning that these tiles never need to move after their initial placement, and most have no continuously moving parts (for instance, a rock need only sit there and be a rock until it's hit with a hammer). However, the entity does say it's being considered for updates "every packet". I don't know if things like this need to be dealt with or worried about.
If anyone has any input about this situation either directly, tangentially, or just has a way of accomplishing what I'm setting out to do that I haven't thought of, I'm all ears. I've been working on this for weeks and am becoming extremely discouraged.
1: Tile-based and generated at random, but limited
2: Dynamic, meaning we have trees that can be cut, tiles representing holes dug in the ground, rocks that can be broken, etc.
As you can imagine, loading the entire map at one time isn't feasible. Because of this, we stream in whatever is closest to a player, and discard things that are too far away from everyone.
We used to be doing instantiation/destruction of the tiles, which was rock solid in terms of Bolt networking "what I expected was what I got", but for performance reasons we decided we had no choice but to create a pooling system whereby we instantiate a great deal of possibly needed tiles and deactivate them. Then as they're needed we reactivate them, move them into place, etc.
I've programmed numerous pooling systems before successfully, but having Bolt in the mix is... complicating the issue, to put it mildly. Currently the pooling system stores tiles in a deactivated, unattached state. The tiles are then attached in their OnEnable, and our despawn routine deactivates the tile (and on top of that we have all of our tiles set to "Detach when disabled" in their entity settings).
We have the strangest unexplained issues, such as tiles that will vanish right off the screen despite the fact that it's literally impossible for a tile to be placed back into the pool in those circumstances, and impossible for something else to "take" a tile whose GameObject is active. It leads me to believe the only explanation is that Bolt is doing something I don't want it to do with my objects, but I cannot explain what's going on.
At first I thought Bolt was just "self-destructing" and blowing up random objects because there are so many, maybe something to do with the scoping? Admittedly we have a ridiculous number of entities that Bolt has to take care of; we saw no way around that, since as far as I can tell, each tile needs to be its own entity. I just don't know what's happening.
I'm open to any suggestions on better ways to handle this and so forth, insight on what in the Bolt side of things could be going wrong, and so forth.
It's worth mentioning that these tiles never need to move after their initial placement, and most have no continuously moving parts (for instance, a rock need only sit there and be a rock until it's hit with a hammer). However, the entity does say it's being considered for updates "every packet". I don't know if things like this need to be dealt with or worried about.
If anyone has any input about this situation either directly, tangentially, or just has a way of accomplishing what I'm setting out to do that I haven't thought of, I'm all ears. I've been working on this for weeks and am becoming extremely discouraged.