Spent several hours, planing implementation. Considering stacks, queues, cashes, but decided to play only with visibility at the current moment.
So, here we are: for now, number of visible chunks (in current project, 1 chunk = 1 level of terrain) is depends on camera height. On theese screenshots, positions of the camera are the same, except height.
Next step is to add "fog of war": those cubes, that are incide of the mountain should be brown, and similary, cubes for air should be blue.
I spent lots of time on optimization rendering process. But now, looking like it works with maximum perfomance: all chunks are generated during the game start, when camera moves higher/lower, it only toggles their visibility. (also, its possible to see first citizen on the screen below).
Only 2 extra chunks ("top" and "floor") are regenerated on demand. They should cover visibility, of "unknown" tiles, like Fog Of War. Time of regeneration is obvious depends on the size of the "floor" or "top" chunk, but in worst case it took 0.05 seconds (in common cases, approximtely 0.02). On this screenshot, camera is too high above the mountain.
What about whole project structure, i see it in next way: there are TerrainManager and DwarfManager (would be some AnimaleManager, ItemsManager, and so on). They are responsible only for rendering terrain, dwarfs, etc. Game mechanic should be separated from this and be accessible through interfaces.
Also, i added NGUI for rendering GUI of control panel, and cInput for dynamic input changings.
So, now it's time to finish with terrain rendering. Final part is realtime terrain editing (Part 3).
Part 1, basic terrain render.
So, here we are: for now, number of visible chunks (in current project, 1 chunk = 1 level of terrain) is depends on camera height. On theese screenshots, positions of the camera are the same, except height.
Next step is to add "fog of war": those cubes, that are incide of the mountain should be brown, and similary, cubes for air should be blue.
I spent lots of time on optimization rendering process. But now, looking like it works with maximum perfomance: all chunks are generated during the game start, when camera moves higher/lower, it only toggles their visibility. (also, its possible to see first citizen on the screen below).
Only 2 extra chunks ("top" and "floor") are regenerated on demand. They should cover visibility, of "unknown" tiles, like Fog Of War. Time of regeneration is obvious depends on the size of the "floor" or "top" chunk, but in worst case it took 0.05 seconds (in common cases, approximtely 0.02). On this screenshot, camera is too high above the mountain.
What about whole project structure, i see it in next way: there are TerrainManager and DwarfManager (would be some AnimaleManager, ItemsManager, and so on). They are responsible only for rendering terrain, dwarfs, etc. Game mechanic should be separated from this and be accessible through interfaces.
Also, i added NGUI for rendering GUI of control panel, and cInput for dynamic input changings.
So, now it's time to finish with terrain rendering. Final part is realtime terrain editing (Part 3).
Part 1, basic terrain render.
Комментариев нет:
Отправить комментарий