I could not find it so I’ll have to ask. Im developing a MMO game but no real-time actions. It’s RTS style game with server resulted battles. No multiplies unit moving. I dont know which way to implement that multiplayer will be best.
I have not experience with programming multiplayer games. Im PHP developer which is making games now but calling external PHP scrips would be too slow I am afraid. Maybe .N ET sockets? But i dont know anything about them, are they hard to understand and implement? Maybe WCF which i heard is easier? Or maybe use MMO server framework with Unity? Server will run on Linux so i’ll use Mono to write server part.
what do you mean non real time? RTS means “real time strategy”. can you give us a little more detail about the gameplay? calling php isnt a problem, unless you call it a lot.
is your game like a pick a strategy, then watch the results?
User will prepare his fleet and send it to the enemy then watch results of the battle. No real-time control about the battle. Same as you said at the end of your answer.
User will also have a base when he can build buildings in real-time but no other actions are real-time, just base building so the server will be loaded in minimal value.
are the object positions important? what i mean is, will they change how a user behaves during game play? i assume this is sorta like a tower defense sort of thing. but the users build the “monsters” that come out of the towers?
No that’s not a tower defense game. Player builds the fleet in his own base then send it to enemy. He does’nt see his army moving towards the enemy, just pointer on the World map calculated on distance and fleet speed. Battle is calculated on server side, results are send to player. No realtime battle. Player can enter his base and build the buildings in real-time. Some of them produces units, some of them provides energy. He can open the world map and send his fleet to other player but without seeing entire battle. This won’t kill the server but still gives fun.
There’ll be one very VERY big world-map. On player login, server will send information about all bases, who owns them, are there any fleets coming to player (if he build early-detecting infrastructure) and they will appear on world map on position calculated by server using fleet speed and distance to base.
my first suggestion would be to focus on data in areas of interest. if the user cannot see it, dont send it. use the server to track building locations and unit graphs. you can sim on client side the motion of units. server does math when a timer finished, then update the db, then update clients with an aoi. do users need rotation info for the buildings they make, is it axis locked? if yes for both of those, you only really need to send the position rotation angle.
i am going to make another assumption on you game for my next bit of advice. i will assume that stars have paths to next stars, and wont be able to reach some. what you could do is build a star graph in the database that links all nodes and gives a length for the edge. this way you could do a subscription to updates for a star that reaches a certain distance without actually tracking everything in realtime.
btw, you dont need to use php for this. just use the server + database.
I understand all of your reply expect one word " then update clients with an aoi". What’s an AOI?
Yes for both and i already know it
You’re right
Of course but i can’t just hardcode database login and password into unity client exe and communicate with database. Cheaters would discover that very fast and destroy everything. That’s why i mentioned about PHP. I need a server but i don’t know which way should i write it. Using sockets, using WCF, using MMO framework? Can You give me an advice at this point?
You never want to expose your database to the internet. What you do it build the game server (using photon / ulink / smartfox / badumna / etc) and have that server access the database. When a user logs in, do something like you would do in PHP; never send the password. Do a md5 + salt or something, then check the DB.
As for designing the server, I don’t actually think you will have a really hard time. All you really need is a system that does the math for battles, and stores placements of objects / returns details on places of objects. As a user can sit in a system and only build, other users only need to be updated when something changes. They don’t really even need to know what ships are coming their way (unless you want them to). Just show a fleet is inbound, then set a timer on the server to execute a computation when the timer reaches an end (use threading here). Update the database, then update the clients for the results.
Now, as for the AOI: A user can only see so far, so only send data to them that they can see, not the entire data set. If a user only has one star, and they only have 3 linked neighbors, you only send data for those stars if something has changed (you will also send an update on connect to make sure they are current). I would treat this as a subscription type of thing. A user takes a star, they subscribe to it, and any neighbors. The server then checks for subscriptions when a change happens, then updates those subscriptions with a network update. The best part about your scenario, you can do it via TCP as long as you keep the size of packets down.
Ya know, thinking about it, you could use raknet / lidgren without issue. Your server code will be pretty simple. Build a service in dot net that listens to a port. I am pretty sure that Fholm has already made something for this:
This would be ok as well
One more addition… Your project reminds me of this one a little, maybe this will be a headstart for you
Sounds like you’re way in over your head to build a turn based strategy MMO.
I’d start with something simpler, like multiplayer Pong, then gradually improve your skills from there.
@Meltdown
I would do that too but i don’t have much time. I need to get to work now.
I ended with websocket-sharp with server running on virtualbox ubuntu and unity running on host windows with websocket dll compiled by me. Everything works great. Thanks guys.