- Home /
Business simulation in Unity
Hey guys,
I want to create a business simulation / planning game with a Unity frontend. It will run on iOS, and should allow multiple players and rudimentary AI (for testing and demo purposes) to play against each other. After each player has entered data like sale prices etc. the server should calculate the actual sales of each product for each player. Now here's my question: Does anyone of you have recommendations for the server backend? I am quite good at C#, but I am sure I would also be able to use PHP or JavaScript for the server. Any comments are welcome!
Taxel
Answer by phil_me_up · Dec 15, 2015 at 11:10 PM
It depends a little on what you want, but I'd suggest Parse.com as a starting point for both database and web service provision.
If you want to go custom then there are a lot of database options available (AWS DynamoDB / RDS, Azure, MongoDB, CouchDB ). You can also use more traditional systems like MySQL which may be appropriate depending on the data you're processing / load etc.
For servers, PHP will be fine. You might want to consider something like NodeJS but again, it really depends on what you're after.
Hey phil,
thanks, but I already got a server (with root rights, so I can really just do anything I want). Let's just assume I use PHP, could I also send data to the players (like "the current turn is over, here is what changed") or would I have to rely on the clients regularly checking in with the server if something changed? $$anonymous$$y PHP experience is limited to having created a few websites, but there I didn't have to update anything without someone requesting it. I think my question is this: How would you go about having a program on the server that runs in the background, plays for the AI, checks if every player has made a turn or if the time limit for this turn is up and then initiates the calculation of all the values in PHP? Are cronjobs a way to go there?
It's good you've got a server, but don't underestimate the maintenance required to run these. Should you have sudden load increases, or just s$$anonymous$$dy, heavy traffic then keeping the server responsive can be challenging. Simple things like a large number of simultaneous connections can cause havoc if not setup correctly. The same is true of Database technology and whilst things like $$anonymous$$ySQL are great, they are not necessarily the best tool for availability systems.
Actually addressing your question is a little tough without knowing all the details of the application, but, I would have a database which keeps a track of the players in the session, the data of those players and the responses of the AI. The client app can make requests to the server (or listen for notifications) to find the current status of play.
The AI I'd probably keep as a very simple simulations running as a webservice which you talk to via an API (PHP, NodeJS or otherwise). You'd be able to pass in some information (either from a client or another webservice acting as a layer between the client and DB) and have it return a response. Think of it like loading a web-page, when it only processes the data when it's requested rather than permanently or on a schedule.
You could also consider running the AI on one of the clients in the background and have that communicate the data to the server for collection / distribution to the other players. If this sounds like a good idea, you could actually consider using the GameCenter multiplayer systems to do all or part of this (again, depending on what you actually need).
Your answer
Follow this Question
Related Questions
Server software for multiplayer turn-based RPG like Pokemon 1 Answer
Turn-based small scale multiplayer: server-only-logic possible? 2 Answers
Purchasing seats of Unity Pro, iOS Pro, and Asset Server 1 Answer
Build Server, both Android and iOS 0 Answers
Run a script in background when the app is open or closed 5 Answers