I want to make my java games have private servers for playing games with friends over the internet. Do you guys know where to start? or what APIs I should look into? and should I put this in the networking section? Thanks.
Printable View
I want to make my java games have private servers for playing games with friends over the internet. Do you guys know where to start? or what APIs I should look into? and should I put this in the networking section? Thanks.
Depends on the game you want to play. If you need a so called "freeshard" server for a commercial game, you could be very lucky that there is possibly a more or less done server (maybe not in Java).
Ich you want to do your own game there are nice frameworks like Smartfox, RedDwarf, ElectroServer, ...
All I want to do is be able to send small amounts of data across the internet to the people that download the client side of the game. I would have a client and a server running on my computer. the data sent to each of the clients would look something like this
[(103,621),(12,10)][(215,390),(1,3)][(189,531),(0,0)]
every frame. Each square bracket has inside it the position and velocity of one client on the screen.
every time a client presses a key or moves the mouse it is then sent to the server some how like this
38 for up arrow key press or (259,10)D for mouse drag.
so all I want it to do is be able to send data to and from a server to clients on completely different computers with internet access. Code examples appreciated.
Every frame could be hard to be synchronized if you think of 30-60 frames.
I don't think they need to be synchronized do they?
that's what you wrote :)
Quote:
the data sent to each of the clients would look something like this
[(103,621),(12,10)][(215,390),(1,3)][(189,531),(0,0)]
every frame
actually I don't even think that the clients need timers. They just would react when ever the server sends the data which will then be every frame. The clients will just have events and they send data over every time they get one. I apologize I'm still trying to figure out how this will work.
You need to figure out which data the clients need to run "nearly synchronous", that's the data you need to send to them. For example to move a character you need the speed, the direction, the time the movement will take and the endpoint. The client can calculate the way to the endpoint. At regular base the server would send an updateposition package to make client synchronous again to the gameserver (and to all other players).
Not sure if this is the kind of information you searching for.
I'm don't really care too much about the preciseness of the motion of the characters I just want to know how to send the information. Later when I have some examples of sending data then I will get too the actual things that I need to worry about like synchronous of the clients and the server. So for now does any one have experience in this realm of networking and have any code examples?:focus:
Sorry, I cannot be of more help to you. I was working on Java Servers and I had a project, but things got in the way and I never completed it. So I was half way there and I never got a full understanding on making a MultiThreaded Server. Maybe you will have better luck then I did, and be able to implement this where I could not. For your problem, I looked at Sun's (I will always see them as Sun and not Oracle) tutorial on:Writing the Server Side of a Socket (The Java™ Tutorials > Custom Networking > All About Sockets)
look through the whole tutorial so you can make the client work as well.
Hope this helps!