|
Post by jon3123 on Feb 1, 2016 15:25:44 GMT
host-a.net/u/Jon3123/JavaServerExample.zip Heres an example of creating a Server in java and having a client in Game Maker Studios. Once you connect two clients to the server and move your character the other client will be able to see your coordinates. You can post all question you have for the code here as I didn't add very many comments. I think if you have a basic understanding of Java you will be able to understand, but if you don't understand something DON'T HESITATE to ask for help I will be willing to help anyone of any skill of programming.
|
|
|
Post by rater193 on May 29, 2016 12:54:13 GMT
wow man, nice server example this is something ive been wanting forever! thanks to you, i can finally start work on a TRUE dedicated server, not no stupid game maker based server!
|
|
|
Post by jon3123 on May 29, 2016 14:36:56 GMT
wow man, nice server example this is something ive been wanting forever! thanks to you, i can finally start work on a TRUE dedicated server, not no stupid game maker based server! No problem man have fun with it!
|
|
|
Post by rater193 on May 29, 2016 23:38:20 GMT
i have a problem, on the server i have this
**snip**
and on the client i have this
**snip**
however when the server tries to write to the buffer in the for loop, it writes the value of "0" this bug is really troubling, mind helping me fix it?
|
|
|
Post by jon3123 on May 30, 2016 0:28:20 GMT
hmm I'm a little confused to be honest on what you're asking for help on, just double check if you are sending the correct values for int, bytes, etc. and make sure you are reading the amount of bytes u send.
|
|
|
Post by rater193 on May 30, 2016 13:56:52 GMT
i fixed the issue, now everythings working
|
|
|
Post by rater193 on May 30, 2016 13:57:37 GMT
the issue was because of a buffer limit of 256 bits i was using 270+ bits
|
|
|
Post by rater193 on May 30, 2016 13:59:19 GMT
also, there is 1 issue with ur net code for when players join. When its just 2 players, it works just fine, however when 3 or more players join the system just craps out completely and everyone starts slowing down. Its not the machine the servers being hosted on ither, because it has 100 mbits up/down
|
|
|
Post by rater193 on May 30, 2016 17:17:25 GMT
i fixed the issue, you need to update your receive code on the client to use a while loop for the "size" of the buffer
|
|
|
Post by jon3123 on May 30, 2016 18:51:07 GMT
Hmmm sounds like to me you are sending a lot of packets to have to change it to a while loop, I don't even have to do that with my game, might want to try to condense the sending of packets.
|
|
|
Post by rater193 on May 31, 2016 1:53:58 GMT
actually, its because of your move code, the problem goes like this, with 2 players you wont notice it, becuase you only receive 1 other players movement packets, however with 3 or more players, you will "slow" down because you are only handling 1 part of the packets each frame on the client.
|
|
|
Post by jon3123 on Jun 4, 2016 13:34:05 GMT
Yea sorry I didn't optimize the code, I really just made this example in a day to show that it works with and like 39dll with a slight few changes.
|
|
|
Post by aexofspades on Nov 17, 2016 0:14:49 GMT
Hi, I'm incredibly new to networking and have been using a mix of guides and a LOT of testing, and I have a few questions. My first is: How would you add security to a server? Would you do something like a while loop to check if they have a website or application opened from a list in an array? Second: How would you add staff ranks and tools (for staff to distinguish themselves, and to be able to update the game, but players can't), I have no guesses on this one :/, Third: How would you create an area that would only let you and your party/team in? I already have the team system done, but no matter what I try other people can still get in (My system saves your party to a script holding variables and then checks everyone's ID (give them an ID when they first log on) and then display's their look, class and stats on a gui) I tried warping players back to a specific point but if you went back in, the script would stop working. Thanks, and sorry for a lot of reading
|
|
|
Post by jon3123 on Nov 23, 2016 18:29:07 GMT
Hi, I'm incredibly new to networking and have been using a mix of guides and a LOT of testing, and I have a few questions. My first is: How would you add security to a server? Would you do something like a while loop to check if they have a website or application opened from a list in an array? Second: How would you add staff ranks and tools (for staff to distinguish themselves, and to be able to update the game, but players can't), I have no guesses on this one :/, Third: How would you create an area that would only let you and your party/team in? I already have the team system done, but no matter what I try other people can still get in (My system saves your party to a script holding variables and then checks everyone's ID (give them an ID when they first log on) and then display's their look, class and stats on a gui) I tried warping players back to a specific point but if you went back in, the script would stop working. Thanks, and sorry for a lot of reading Sorry for the late reply man I've been pretty busy. I'll try to answer the questions as some of them are kinda vague. For the security Generally the main thing you'll run into if you need any security is just people who think its funny to DDOS your server. It has happened to me a couple times a good way to defend against them is to add to add IP bans and check if players are sending packets over and over again that don't need to be sent. For adding admins You want to keep all that stuff server side, so have on the server that "player X" is an admin and when he types "/kick player y" I need to kick that player. and your thread question is a lil hard for me to answer I would need more info.
|
|
|
Post by aexofspades on Dec 23, 2016 3:26:04 GMT
Well I got pretty far and now i'm working on adding some events (minigames to get extra money and rare items that are initiated and controlled by admin's commands) and one of my minigames need to be precise on timing for sound, but for some reason on some clients it will sound faster than others probably because of connection speed. How would I sync them so that they run at about the same time (0.5-1 seconds off is okay). That's all I need for now, thanks
-Aex
|
|