[SOLVED] World server design questions simethereal

Creating a world server for server connection options with simethereal clients.

I have the basics for the server done for receiving packets but would like to understand the best way to integrate it with SimEthereal.

My first instinct is to just keep the world server dumb a let it only receive packets.

I am not sure as how to implement this on the SimEthereal server though.

Since SimEthereal already uses UDP, it seems that I should add a new system to the game server where all it does is send a packet every 30 seconds to the world server. Looking at SimEthereal, I see how it flags a method as reliable.

This requires a client be logged in and all of the rmi stuff which seems overkill.

Whats the best, secure approach to design of this?

I’m unclear what exactly you are trying to send to the server.

SimEthereal is for real time synching of object state… which necessarily requires some idea of the client and what is local to them… which also implies that they are connected in a “real” way whatever that means. (Login or not is game-specific.)

The SimEthereal server would just send a packet with the number of players logged on, its server number.

I could fill in the rest from there on the world server.

The term “logging in” is probably described better as “establishing a constant connection” to the server.

Udp is marked unreliable because it doesn’t know that the packet actually got received. It just sends it and forgets it ever happened. This is especially useful in position sending for example. It doesn’t really matter because they get sent so often. Usually like a machine gun at times.

TCP is heavier but comes with guarantees of delivery.

If you just want to expose information to the public you probably want a different protocol specification such as http - those connections aren’t persistent and are designed for rapid bursts of anonymous data. Scoreboards, user count, Json data, etc. for joe public to look at without actually connecting to the server.

Ok, didnt know I could make a http connection to the SimEthereal server like that. Never had to do server stuff before.

I was going to just store the packet in a HashMap and build a server list from it using a Lemur ListBox.

Edit: If the packet for a server was to old I was going to mark the server offline.

Looking at this further, I think I see how to setup the basic http server part on the SimEthereal game server but this leads me to wonder about this approach. If anyone can connect to the game server via http, whats stopping them from spamming the crap out of the channel?

The reason I was thinking of just blindly sending the UDP packets to the world server from the get go on a timer was to prevent any interaction with the game server. Every 30 seconds just send the packet. If a packet doesnt get updated after so many minutes, assume the servers down.

The http server will listen on say port 80 or 8080 or whatever. They don’t “connect” to the server, they query the port and address, exactly the same way you do a website, and the server returns a value. Thats the end of the connection. So for example you/the user queries my.ip.addr:8080/info and it returns whatever you want. If you want it in-game you should probably return a json object so you can use POJO’s and javascript easily if you want people to be able to display the data on their website for their server. Nice for a clan to have a website displaying scoreboards, usersonline, etc… You can have unlimited endpoints, too.

/info
/scoreboard
/usersonline
/etc

Technically they “can” spam the endpoint but that’s called DoSing (as opposed to DDoSing - and if you’re getting DDoS’ed you may as well just turn the server off). You can reject continual requests from the same ip quite easily. But the same can be said for any port accepting traffic, not just HTTP. Rate limiting is a thing.

Wait… maybe you can be clear about your architecture because I saw you mention “world server” and “game server” in the same sentence as different things.

So who is sending what to whom exactly?

World Server is a standard UDP server that only receives packets.

Game Server is the SimEthereal game server. No client code. I have split the client into a separate project.

Game Server sends packets only, world server just receives only.

So the world server and the game server will be on the same network?

Or are these game servers run by players?

Edit: is the world server running SpiderMonkey? Or is it just a generic Java server?

If before you write the longer response that you keep attempting, you could answer the questions above then I can formulate a more detailed response of your options before I have to leave. :slight_smile:

No. Game servers can be anywhere but there is only one world server that is used and then only to store the packets so I can then build a list of servers for the user to choose to connect to. Not tested through but plan was to grab the packet data and build the links using a lemur listBox.

World server has no other uses. Just stores packet.

Game servers will all be run by me on cloud virtual servers, plan is 6 total, 3 US, 2 england, 1 germany, based on the networks data center locations. Since I will know all the adresses, should be easy to make it work I would think.

No. Its a generic java server.

So the world server will already have many DDOS entry points. There is whatever is used to request the available servers, etc. all could be spammed. Even if you just receive UDP then you will be susceptible to malicious clients that do nothing but spam you with UDP packets.

I’m not sure you get around that.

Probably you want your game servers to update the world server only occasionally. And this can be through the same REST service that clients are using to lookup worlds. They POST/PUT their status while the clients GET the active list. Have them send their status when they startup and shut down and then maybe every minute, every five minutes, whatever.

I mean, if this is a simple REST service wrapped in a .war then you can essentially deploy your world server anywhere. No JME-specific code or dependencies required. Just drop it in a web container. If your back end data store is shared then you could even expand to elastic style services if your game gets super popular or something.

P.S.: It only takes about 20 minutes (including learning curve of following the quick start guide) to get a simple SpringBoot REST service up and running. Really simple. Can even be run stand-alone from the command line for testing or just dropped into tomcat, whatever.

Got some learning to do, I will get back shortly.

If you’re interested in what I was talking about:

1 Like

Ok, this is just awesome.

So from here, I would add a new service to SimEtereal game server, have that service just be a thread that makes a :
post on startup,
put every so many seconds or minutes to update,
put upon shutdown saying offline or optionally delete.

Then for the listbox presented to user just build using get getForObject.

I will have to study more but assume I can restrict post, put, and delete to certain addresses?</>

I see there is a security link. Will look into that.

It’s a lot of magic… but some of the best kind of magic.

If you add an HttpRequest parameter to your method then it will get automatically passed and you can interrogate all kinds of stuff about the requestor. So even if the security stuff doesn’t work exactly like you want there are always ways to brute force it… even just temporarily as you figure out the rest. (pun intended)

Just a bump to sorta catch up.

I was interrupted for a couple of weeks with a honeydo list from hell.

I was able to actually get about two days of study during that period. I had to learn Spring, JSON and a ton of things I never expected but it was worth it. I finally got back to coding last Friday. All in all I spent about 4 days total learning and was easily able to develop a working restful server using annotations. It was awesome.

After I wrote the client into SimEthereal, literally right after testing completed, I discovered Reactive webflux.

Needless to say I was hooked on it immediately. Problem was I absolutely hate lambdas with a passion and I have up to this point avoided them as much as possible. Although I realized I could write a annotated webflux server, it was quickly apparent from searching that this would be a complete hassle to do since almost all webflux examples use lambdas and functional programing so I had to byte the bullet and learn about lambdas. I got through that and have finally written a functional server and integrated the webclient into SimEthereal.

I still hate lambdas but I absolutely love Springboot / webflux. Maybe after I get used to them, lambdas wont be so bad but as of now I still despise them.

This has definitely help increase my coding skills and been a excellent journey.

Anyhow, I will post some images sometime soon after I integrate things into the gameclient and finish with security and stuff. Both of you helped a ton. Thanks again.

3 Likes

Glad you got things working so well.

So often, my personal REST services are just relatively thin pass-throughs for MongoDB so I’ve never had to do anything beyond basic spring-boot wiring. I’ll keep Reactive Webflux in mind, though.

yeah, since this ones so simple of use an in memory repository (@repository) that uses concurrentHashMap seemed to be best.

When I write the advertising server I may use mongo, not sure until I research what is expected of me from the suppliers. Haven’t got that far yet.