Must Network game dev be on many machines?

I am trying to make an RTS in Java..

I wonder, I am trying to do dev entirely on one machine, launching a dev server in main() before initing client objects on the same machine. If each client has its own port, and the server has its own port, isn't that, as if, separate machines?
Should I be doing dev on 2 machines for multiplayer, at first? Because I get a small scroll of network errors now and again as I add another player, totally -unexpected error, - if all is on one machine, and I wonder if that may be related to over burdening the system with UDP packet sends, converting data members to serialized objects for the packet creation.
..Is doing client and server runs on one machine looney for RTS game dev, because the networking is over logged?
I have a PC next to my macbook. Should I put a server on the PC for every run?
Who is Participating?
Sharon SethConnect With a Mentor Commented:
Yes , you should consider doing your dev on a server client setup .  Network programming has much more to reveal  when it runs on multiple machines rather than on a single machine
beavoidAuthor Commented:
Good, this is exactly what I was suspecting. Thanks. Is there an article about gotchas that I should be aware of? Or is it rather straightforward? Maybe some of the error chunks I had will still happen?
It is rather simple, anyway for an RTS, get all the HELO's from the clients and then bounce all activity packets from each client to the others.
Sharon SethConnect With a Mentor Commented:
Not specifically to game development , but looking at game development as just an another java based network program , you should  watch out for all those things you want to monitor in that area .
But I believe  , game development today has progressed to an extent where you have engines and SDKs specific to game development  , which would actually take care of all the underlying packet management and other low level functions , while you can use your time entirely on plotting and creating (the story :)) for your game  . I am not aware of the scope of the game you want to develop , but I would suggest that you take a look at the available SDKs and gaming engines , and specifically JavaFX.

Might not be what you are looking for , but I had bookmarked some of these sometime back , when I myself wanted to write a game in java :
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

beavoidAuthor Commented:
Thanks. Why java fx? If I eventually launch my game from web-start, will it run exactly the same as from eclipse? What does fx offer aside from awt or*
Sharon SethCommented:
Java FX  gives you impressive GUIs which awt does not provide . Check some of their sample UIs from the official java FX website
dpearsonConnect With a Mentor Commented:
To your original point here I would suggest there's nothing wrong with running both client and server locally.  I'm part of an online gaming team and that's exactly how we develop the game - with each engineer running the entire stack locally (database, server, client everything).

Your local network will have no trouble with the data rate (modern cards can handle 1Gbps - or put another way 2.5 million 50-byte packets per second of actual network traffic, so nothing to worry about until your code is sending more than 2.5 million packets not per day or per hour, but per second...)

The only difference between that and a real server comes when you start trying to handle errors correctly - and for that you generally need to explicitly force the errors.  Simply connecting up two machines on a LAN will normally give you very low error rates.  So instead you need to use a tool that specifically generates different types of network errors (e.g.

But even that can probably be done locally at the start.  Local development is VASTLY easier than dealing with an actual remote server/client combination that your productivity will be 5x working on a local solution.  And productivity should be your first concern.

beavoidAuthor Commented:
I don't know why, but when I did my previous RTS, it had no problem in Microsoft   J++ with server and client on one machine, but now,

with Eclipse, on Macbook, the code I'm doing clogs up, if all networking is done on local. It blows up with network streaming errors.

So, I'm going to do dev on my workspace, with client dev on my Macbook, and server dev on my PC,  2 feet away,
18.3 inches, actually.

This simplifies it, for me, in fact.
OK if that makes it simpler then fair enough - but if the networking is "clogging up" locally it suggests there's a bug in the code that has yet to surface.

But if it's a bug it should also show up when working remotely, so go ahead and stick with that model if you find it easier.
beavoidAuthor Commented:
It is going as well as I hoped. Really Well.
Before I post the code, I wonder if you'd like to comment on serialization and Datagram byte[] size?

I started with unserialized 512 to make it simple, but in an RTS, to signal a mass movement, you need a MSG type listing unit movements of up to 20,40 units, so thats 40*4 bytes for the unit numbers who are moving, and 8 for the x,y location bytes for the whole group or individual to go to,
and I'd like to have another IA1[] for possible integer[] use, and a BA1[] for byte arrays.

So my final Message class should look like this for every possible message ?
The messages will be serialized and deserialized, of course. I have that working
    byte messageType;
    int playerNumber;  //most messages are related to a player
    int int1, int2;          // available ints for the message
    byte b1,b2              //available bytes for the message
    int IA1, IA2 []                    //available integer arrays for the message
    byte BA1, BA2 []                    //available byte arrays for the message
What size should I specify for the bytes in the DatagramPacket? It has to be the same on server and client and they have to be the same value for small or large messages.

beavoidAuthor Commented:

with my example of a HELO message, could be the same struct be for any message?

public class DRWmessage implements Serializable { above

if I  have MSG_LENGTH=1024; . . or 4096
byte[] HELObytes = new byte[MSG_LENGTH];
// ..more data in HELObytes
DatagramPacket packet = new DatagramPacket(HELObytes,MSG_LENGTH);

//send packet

What should my message length be for this and all others?
How do I do / tie together a mass-movement message?

Okay, for an RTS, I think the only network packet message types are MSG_HELO, MSG_BEGIN, MSG_CHAT, MSG_MOVE, MSG_ATTACK (which is move message with an implied attack tag, MSG_LEAVE,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.