PGD Home

P0-MS5: Part 352: Debugging, Optimisation

by on Apr.08, 2018, under Astral Realms, P-0, Software and Games, Spiritus Astrum

Having solved most of the major issues with the AI system for the time being, I have moved on to create a dynamic paging system for the project.

I have paging systems already in place for ground cover objects like trees, etc, and grass, but I don’t have one for complex objects like Ships, Space Stations, etc.

Currently, I have very few of these objects, so I can simply store them in memory, but this would of course not be practical in future.

Ideally, I want to page these objects into and out of memory based on their distance from the player, but Unity does not currently have a multi-threaded or asyncronous instantiate function.

This means that my only options would be to either store the complex object in a prefab, and load it piece by piece using a coroutine, or build the complex object at runtime, again using a coroutine to instantiate just one object at a time. This could work, but I have decided to leave the actual loading and unloading until Unity 2018.1 comes out, so that I can, hopefully, use the job system to instantiate objects in another thread.

What I have done this week is add the logic to detect when the objects are far enough away to be unloaded, and close enough to be loaded. This is more difficult that it sounds, because I need to keep track of the world space position of each of the objects, and I need to consider the fact that players can enter and leave a variety of ships and structures, which can also move on their own.

Screenshot (17) Screenshot (19) Screenshot (13) Screenshot (14) Screenshot (15)

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!