Sign in to follow this  
clixby

Sending radar info from server

Recommended Posts

clixby    100
I'm a complete noob and still in the planning stages of my game, so I'm trying to work out the problems before I jump in. I'm still undecided on which programming language to use, but leaning towards vanilla Python.

[b]The problem:[/b]
My game is a multiplayer 2d space game that will probably end up with A LOT of ships running around at once. Players can control multiple ships while AI controls others. I want to send a list of nearby ships to each ship, preferably every second. I want to do this without sending all ship positions to the client, because I'm guessing it will be trivial to mod a client to show all ship locations if the client was sent all that info.

I'm afraid that nesting loops to achieve a per-ship list of nearby ships will destroy the server past a few ships. What would be the possible solutions for 500+ ships?

Also, I am probably not going to be using any game-making or networking frameworks, if that makes a difference. If there's an elegant way of doing it with one of them, though, I'd be interested.

Share this post


Link to post
Share on other sites
TheTroll    883
[quote name='clixby' timestamp='1302865697' post='4798736']
I'm a complete noob and still in the planning stages of my game, so I'm trying to work out the problems before I jump in. I'm still undecided on which programming language to use, but leaning towards vanilla Python.

[b]The problem:[/b]
My game is a multiplayer 2d space game that will probably end up with A LOT of ships running around at once. Players can control multiple ships while AI controls others. I want to send a list of nearby ships to each ship, preferably every second. I want to do this without sending all ship positions to the client, because I'm guessing it will be trivial to mod a client to show all ship locations if the client was sent all that info.

I'm afraid that nesting loops to achieve a per-ship list of nearby ships will destroy the server past a few ships. What would be the possible solutions for 500+ ships?

Also, I am probably not going to be using any game-making or networking frameworks, if that makes a difference. If there's an elegant way of doing it with one of them, though, I'd be interested.
[/quote]

The way I would do it is to break the map up into smaller squares. Now if you have only a single range for your radar then you make the squares 2/3rds the size of that radar. That will mean that the square the person is in plus the surrounding squares are the only ones you need to test against to see if they can be seen. Edited by TheTroll

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this