?
Solved

Must Network game dev be on many machines?

Posted on 2013-01-01
10
Medium Priority
?
405 Views
Last Modified: 2013-01-13
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
0
Comment
Question by:beavoid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 12

Accepted Solution

by:
Sharon Seth earned 1800 total points
ID: 38735786
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
0
 

Author Comment

by:beavoid
ID: 38736662
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.
Thanks
0
 
LVL 12

Assisted Solution

by:Sharon Seth
Sharon Seth earned 1800 total points
ID: 38739136
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 :

http://java.dzone.com/articles/create-your-own-game-using
http://woz.commtechlab.msu.edu/courses/theses/mudcraft/thesis.pdf
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:beavoid
ID: 38747691
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
0
 
LVL 12

Expert Comment

by:Sharon Seth
ID: 38749949
Java FX  gives you impressive GUIs which awt does not provide . Check some of their sample UIs from the official java FX website
0
 
LVL 28

Assisted Solution

by:dpearson
dpearson earned 200 total points
ID: 38753721
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. http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Emulating_wide_area_network_delays)

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.

Doug
0
 

Author Comment

by:beavoid
ID: 38757321
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.
0
 
LVL 28

Expert Comment

by:dpearson
ID: 38757784
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.
0
 

Author Comment

by:beavoid
ID: 38770605
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
0
 

Author Comment

by:beavoid
ID: 38771103
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,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,

Thanks
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question