ever want to make a open world game in blender game engine?
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!