Re: Optimization Stuff
Posted: Sun Jan 03, 2021 12:43 pm
That's primarily a question of memory and also how big is big enough (there's only so much interesting content you can create with a team of two). I think the bigger maps in the campaigns will be around 128x128, I also did tests with 256x256 without a problem, so maybe some of that scale will be added for sandbox modes. 512x512 would probably work too but that's just a useless size for our game.
If anything, memory could become an issue. The map and all tile related data is stored in arrays, i.e. so no per tile table but a table (array part) per datatype for the whole map, struct of arrays in DoD terminology. I could reduce memory dramatically when using ffi allocated memory but, for now I use just Lua tables in case I want to make a version for iOS/Android (or even just a reduced/simplified version of the game).
But basically it doesn't matter as rendering is limited to what's visible anyway and simulation is handled in a distributed way over multiple frames. I.e. building logic doesn't need to run at 60fps, not even close. Pathfinding f.i. does a limited amount of iterations per frame, requests are in a fifo queue (will be moved to a separate thread in the future) and worst case a char does not start walking for a few frames.
Final fps will still depend on the used PC specs and number of objects on the map (at some point even with a optimized distributed sim, you'll reach the limit), so it's more or less a question of what the recommended specs will be once the game is done. Given all the potential optimizations I can do I'd say that 60fps on a 5 year old midclass system should be realistic.
If anything, memory could become an issue. The map and all tile related data is stored in arrays, i.e. so no per tile table but a table (array part) per datatype for the whole map, struct of arrays in DoD terminology. I could reduce memory dramatically when using ffi allocated memory but, for now I use just Lua tables in case I want to make a version for iOS/Android (or even just a reduced/simplified version of the game).
But basically it doesn't matter as rendering is limited to what's visible anyway and simulation is handled in a distributed way over multiple frames. I.e. building logic doesn't need to run at 60fps, not even close. Pathfinding f.i. does a limited amount of iterations per frame, requests are in a fifo queue (will be moved to a separate thread in the future) and worst case a char does not start walking for a few frames.
Final fps will still depend on the used PC specs and number of objects on the map (at some point even with a optimized distributed sim, you'll reach the limit), so it's more or less a question of what the recommended specs will be once the game is done. Given all the potential optimizations I can do I'd say that 60fps on a 5 year old midclass system should be realistic.