ever want to make a open world game in blender game engine?
me too…
it took me years of testing and trial and error and getting new skills but I think I have finally cracked it.
I libfree the first 100 tiles on frame zero and I also create a large kdtree of points to place tiles (I can do many small ones later as needed using grid position*
I use kdtree to get tiles to place, values are in order of distance.
I free 8 tiles per frame and place them while ‘Firing up’ until the edge of the ‘loading bubble’ is reached,
I then flip the order of the kdtree return data so it filles from the outside edge in instead of out and only fill 1 tile per frame dropping the logic usage considerably.
5.after this point I only run the placer/generator when moving using upbge movement sensor.
after generating a mesh it can be edited.
After moving away if a tile is unloaded it is saved in a dictionary
pressing escape(at the moment)/or saving updates all active tiles positions to the save, and pickles the data.
in theory this data can be used by any game engine***
after initial loading peak logic usage is 3.5 ms for me.
Next up is the UI and the tools to place game objects, then I am moving this tool to the blender market!
expect patches later for export to unreal and unity!
I was able to further accelerate mesh editing / meshFX using a kdtree per tile,
now we are smooth and buttery even when walking/loading/unloading and checking 9 tiles x 16x16 vertex per frame.
place object is in, checkbox in ui and display of selected item, next up is to ‘pin’ the object to the tile that owns it’s data so it will load in/out / update object properties.
pin obj data to tiles is in and so much cleaner than my work on manic mack
(before I was trying to catch / store/ free data in a few places, now there is only 1 load in tile/objects and free tile(updateSave), and quit.