Archived

This topic is now archived and is closed to further replies.

writing multiplayer games on one computer

This topic is 5578 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using the MULTIPLAYER GAME PROGRAMMING book and going through the examples and it made me think. Is it easy to work on a mutliplayer game with one computer? Can I just use the same IP address and different ports and that be the way to test? (running multiple instances of the program using differnt ports) I was thinking of getting a 2nd computer but maybe I don''t need to. How are you all writing networked games?

Share this post


Link to post
Share on other sites
Well, I''m not a professional, but I''ve been working on a multiplayer (via internet) game on one computer for a year or so now. All I do is, as you thought of, use the same IP address(127.0.0.1) and run multiple instances of the program. It seems to work alright, but it can be a pain, because I can only debug one program at a time with my compiler (VC). Another computer right next to this one would be great, but definitely not necessary.

Share this post


Link to post
Share on other sites
are you using directplay? I have no idea how hard it would be if there was a problem in the network code. Tracking that down seems impossible

so I am hoping if I take the example if the book that already works I will have most of the work done for me and just need to change the packets that are passed

anyone else using the MULTIPLAYER GAME PROGRAMMING as a template?

Share this post


Link to post
Share on other sites
No, I''m using plain old winsock 2. The network code was a bit tricky to get right, I admit, but I think that was due more to the fact that I''d never done it before than that I was trying to do it on one computer. It was a bit of a hassle, switching focus to different windows and printing out tons of debug data because I couldn''t trace w/in VC, but that was all. I imagine two computers would be more necessary if you were going to get into complex topics like optimization, or if your program did not send data in a more or less predictable fashion that was easy to distinguish and separate. Or if you wanted a realistic ping between the instances without introducing an artificial latency, you could connect via a dialup ISP or something.

good luck!

Share this post


Link to post
Share on other sites
When testing multi-computer scenarios I often go back and ue VMWARE to actually run 2-3 virtual computers on my computer.

Does not support hardware acceleration, but is totally ok to run the SERVER part of the multiuser game.

Simulates a real computer, so be carefull to have a good system to start of (tons of ram).

Is fun, though :-)


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

Share this post


Link to post
Share on other sites
It is just hard for me after 10 years of programming with one loop for one player to try to understand where directplay fits into it all.

The SPACEPRATES game that came with the book is great. I think my first goal should be to modify that and I hope from doing that I will learn. Or perhaps start a new project and paste chunks of code from SPACEPIRATES

Then there is the problem of coding a seperate server program and the quetions of how to get started with that...

And what about if I want to try it with 8 people? What do I do if I have dialup ? I am trying to get DSL but if it is dynamic it will be hard to organize anything.

Maybe I will post here when I get something and try to get volunteers. Anyone else done that?

Share this post


Link to post
Share on other sites
My 3D engine has a client and a server system in the same binary, so i just locally connect to 127.0.0.1 and it works.

Otherwise, when i want to test with more than one client.... I do have other computers on a LAN, my game is 3D accelerated and when i run multiple instances, one runs in software OpenGL so i do need another computer....... But if it were 2D, i'm sure it would work fine with multiple instances on the same machine.

About the writing..... Well...

I'm using UDP. The client object has his own socket, the server object has his own socket... They do use different ports, i believe thats necessary... The server will accept incoming connections from any network adapter so there is no problem. And it makes more sense to have a different server port anyways.



Looking for a serious game project?
www.xgameproject.com

[edited by - Max_Payne on September 10, 2002 12:53:36 PM]

Share this post


Link to post
Share on other sites