James Hancock
asked on
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.
Basically,
..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?
Thx
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.
Basically,
..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?
Thx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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 java.net.*
Thx
Thx
Java FX gives you impressive GUIs which awt does not provide . Check some of their sample UIs from the official java FX website
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
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.
ASKER
Perfect
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.
?
Thanks
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.
?
Thanks
ASKER
So,
with my example of a HELO message, could be the same struct be for any message?
public class DRWmessage implements Serializable {
....as above
}
if I have MSG_LENGTH=1024; . . or 4096
{
byte[] HELObytes = new byte[MSG_LENGTH];
HWLObytes[0] = MSG_CODE_HELO;
// ..more data in HELObytes
DatagramPacket packet = new DatagramPacket(HELObytes,M SG_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,
Thanks
with my example of a HELO message, could be the same struct be for any message?
public class DRWmessage implements Serializable {
....as above
}
if I have MSG_LENGTH=1024; . . or 4096
{
byte[] HELObytes = new byte[MSG_LENGTH];
HWLObytes[0] = MSG_CODE_HELO;
// ..more data in HELObytes
DatagramPacket packet = new DatagramPacket(HELObytes,M
//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,
Thanks
ASKER
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.
Thanks