Jump to content
Posted 14 February 2012 - 11:52 AM
Posted 14 February 2012 - 12:40 PM
Posted 14 February 2012 - 12:41 PM
I'm working on a 2D game on the same vein as Tower Defense games but with a large world, seemless world.
The player(s) will have to react to attacks from different areas of the world and sometimes defend multiple fronts at once.
The problem I have is the idea of hundreds (potentially thousands) of "towers" trying to acquire targets. Also to avoid unnecessary checks when there are no targets within the maximum range. Line-of-Sight is NOT an issue, only whether the target fits within it's range. (some shoot directly forward, some can aim in a cone, etc)
I have been told that Quadtrees might allow me to optimize this system of target acquisition.
Is this true? Are there any articles I should read? Any pitfalls or alternatives?
Additionally, to prevent unnecessary checks, I had the idea that when a hostile unit enters the world, it "activates" all the defenses within a certain radius. And when there are no enemy units around, the defenses shut-down and go into a kind of "sleep" mode. Any thoughts on this?
Posted 14 February 2012 - 07:13 PM
Posted 14 February 2012 - 11:25 PM
const float enemyDistance = dot(tower.pos, enemy.pos); if (enemyDistance < previousMinDistance) previousMinDistance = enemyDistance;is the opposite of expensive, making it important to consider the overhead of other methods, find the break-even point and most of all, decide if the performance increase is worth the headache and potential bugs of a more complicated algorithm.
Posted 15 February 2012 - 10:50 AM
Posted 15 February 2012 - 11:00 AM
Another thing to keep in mind in the days of up to 8 cores: how well can you execute it in parallel?
Posted 15 February 2012 - 11:35 PM
Unless it will be released as AAA title on Steam, the number of cores will be 2. If it doesn't run acceptably there, it won't matter. 8 cores is very rare, very few people have dual CPU machines. On i7, there are 4 cores with 4 hyperthreads which is far from 8. Construction of QT is serial anyway, even when evaluated on GPU, they are often constructed on CPU.
Posted 16 February 2012 - 09:53 AM
Yea, mine aren't going to miss but the towers in 'Dungeon Defenders' can.
I also don't see any point in doing collision detection for projectils, until you seriously want towers to be able to miss. All these games I've seen so far never miss, so nothing but the distance of the bullet and its target matters (or even just the precalculated "time til impact").
Posted 16 February 2012 - 10:16 AM
How many max players a server will be able to handle with it computing all the logic server-side.