# Boss-based RTS games.

## Recommended Posts

##### Share on other sites
WebStart is refusing to start the application since it's unsigned. Any chance of a signed version?

##### Share on other sites
It is signed. What, specifically, does it say is not signed?

##### Share on other sites
natives-linux.jar

That's probably already enough to figure out what's wrong, but just in case:

##### Share on other sites
Yep, collisions look like the big bottleneck.

Currently I am using the "stupid method" for collisions (ie, I use an n^2 loop to check and see if GI i intersects GI j, and then apply a force)

A quad tree would probably be a better idea. I just never learned how to do quad tree collision detection. I should probably read up on this now.

EDIT: To make a quad tree, I'd have to come up with some kind of hashed data structure and then remove and add units constantly as their positions change. Is this really efficient?

As for the exception; it really doesn't make much sense. I call the exact line it is complaining about when you start the game, and it didn't crash for you then, did it?

Also, I updated the game to fix the selection rectangle bug.

Thanks for testing, guys.

[Edited by - Thatotherguy on May 5, 2009 12:05:54 PM]

##### Share on other sites
Quote:
 Original post by ThatotherguyEDIT: To make a quad tree, I'd have to come up with some kind of hashed data structure and then remove and add units constantly as their positions change. Is this really efficient?

Collision testing against every object in the scene obviously doesn't scale - many games use at least spatial partitioning to get around this. You can also eliminate double tests by remembering which pairs were already tested. You don't have to update the partitions every frame, either.

Quote:
 Original post by ThatotherguyAs for the exception; it really doesn't make much sense. I call the exact line it is complaining about when you start the game, and it didn't crash for you then, did it?

Nope, only when it goes into this loop after losing. The exception keeps looping, too.

##### Share on other sites
I partitioned the space into a giant hash map that uses seperate chaining, considering each tile on the map to be a bucket in which things can collide. If a unit intersects multiple tile maps, they get mapped to several buckets in the collision map. Then, when they want to see what they're colliding with, they poll the collision map and it returns a list of entities in the same grid square as they are.

I also removed the frame limiter.

I'm not sure if this is any faster, but I was able to spam about 20 more GIs than usual. The crux is, GIs are so small that maybe 10-20 of them can fit on a square. So, I'll have to further divide the space and do a real quad tree implementation to see real performance increases.

##### Share on other sites
Quote:
 Original post by ThatotherguyI partitioned the space into a giant hash map that uses seperate chaining, [...] in the same grid square as they are

Why not just use an array of some kind? What extra benefit does the hash map get you?
Then, when you encounter a "bucket" with entities, instead of testing 3 entities like this:
a -> b
a -> c
b -> a
b -> c
c -> a
c -> b
Test them like this:
a -> b
a -> c
b -> c
And mark the "bucket" as processed so (if you're iterating entities) you don't go and test them again. Just don't forget to reset the buckets to unprocessed at the end of the frame.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627654
• Total Posts
2978447

• 10
• 12
• 22
• 13
• 33