AI in multiplayer

Started by
12 comments, last by ToniKorpela 11 years, 9 months ago
hplus,

Thanks for help so far!

I was talking to someone else on IRC. They seem to believe that really only RTS's use lock-step and that sports games should probably be using a server-client system.

Discussing further, he set it up like this....
Computer1
- Is Client1
- Runs the server

Computer2
- Is Client2

So each game is a client, but one of the computers runs the 'server' which is responsible for doing the AI simulations and telling the clients what to do.

Do you agree/disagree with that?

So, using your syntax, it might be something like this:

// SERVER
forever()
{
receive_packets();
if (i_have_any_data_put_into_queue())
{
process_queue();
}

update_ai_simulation();
send_all_data_to_clients(); // ?
}

// EACH CLIENT
forever()
{
receive_packets();
if (i_have_any_data_put_into_queue())
{
process_queue();
}

update_my_game_sim();
send_only_my_user_data_to_server();
}


Does that seem right?

Thanks
Jeff.
Advertisement
They seem to believe that really only RTS's use lock-step[/quote]

Not necessarily true. Torque network engine (a version after the Torque 3D game engine) did it for FPS, according to a presentation I saw at GDC. There.com does it for a virtual world. The trick is to figure out how to hide the round-trip latency of a command going to the server and coming back. This can be done with acknowledge animations, or by showing the local client "ahead" and correcting if you guess wrong, or by game design, etc.
enum Bool { True, False, FileNotFound };
I recently added multiplayer to my RTS, I decided to go with client/server. After reading the AOE article and realizing how hard doing lockstep is I thought there is no way I want to tackle it when adding networking to an already mature code base, if a team of full time networking and AI experts had difficulty implementing it, I didn't stand a chance. I wasn't shooting for perfect game simulation either, which if you have a competitive AAA RTS title that would be very important, hopefuly my implementation is good enough for casual games, I will be releasing a beta soon.
My favorite way to handle NPC artificial intelligence, actually basically the whole NPC system.

Basically in multiplayer game the client sends and receives data according to the input of the player, but what happens when you write bot to replace the player input, you have artificial intelligence of some sort even though the bot might just be a macro. So basically remove all of the code from the real players client what you think your artificial intelligence does not need and afterwards modify the client to run the artificial intelligence. Now you can host these NPC clients anywhere you basically want and possibly make one NPC client act as multiple NPCs.

We just simplified the game server a ton and categorized NPCs and Players as same things, because really they do the same thing, but the other is programmed and the other is born. Though this does use more bandwidth, but you can of course run the game server and NPC clients in local network or even in same physical server.

This topic is closed to new replies.

Advertisement