ID:151582
 
Hi. I need some help on how could i implement the multiplayer functionality of two players in my rts. Say, placing them to their spawn points, making sure that they play fair, checking if either player lost or won. I've got a challenge function in and its via the challenge function that the players are going to fight each other.
Gamemakingdude wrote:
Hi. I need some help on how could i implement the multiplayer functionality of two players in my rts. Say, placing them to their spawn points,

This seems pretty self explanatory.

making sure that they play fair, checking if either player lost or won.

Depends on what you mean by play fair, and what the conditions are for a win.

I've got a challenge function in and its via the challenge function that the players are going to fight each other.

Okay, you might want to explain a little more. I have no idea what you are talking about. If you can post more information I can probably help you out.
In response to Ulterior Motives (#1)
Ulterior Motives wrote:
Gamemakingdude wrote:
Hi. I need some help on how could i implement the multiplayer functionality of two players in my rts. Say, placing them to their spawn points,

This seems pretty self explanatory.

making sure that they play fair, checking if either player lost or won.

Depends on what you mean by play fair, and what the conditions are for a win.

I've got a challenge function in and its via the challenge function that the players are going to fight each other.

Okay, you might want to explain a little more. I have no idea what you are talking about. If you can post more information I can probably help you out.

The challenge function is when a person requests a match with antoher person. Fair play means getting the resources fairly and not modifying their values to get more resources, the conditions for a win i think would have to be to ensure that their main building (which builds builders) and their builders are gone.
In response to Gamemakingdude (#2)
Gamemakingdude wrote:
The challenge function is when a person requests a match with antoher person. Fair play means getting the resources fairly and not modifying their values to get more resources,

If someone challenges someone and they accept, make one player one and one player two. Place them on the map where you want them to be.

I don't think modifying their resources would even be an option. They could only do this through insecure savefiles that are on their computers. So, unless you are doing client side saving, only the host would have the savefiles to begin with. I don't know a lot about savefile editing, but I don't think modifying a savefile in the middle of a game and the values being returned is even feasible. So, when they start the game make their resources 0 or whatever. Then that pretty much eliminates that problem.

the conditions for a win i think would have to be to ensure that their main building (which builds builders) and their builders are gone.

After the main building is deleted check to see if there are any builders left belonging to the player, or vise versa.
In response to Ulterior Motives (#3)
Ulterior Motives wrote:
I don't think modifying their resources would even be an option. They could only do this through insecure savefiles that are on their computers. So, unless you are doing client side saving, only the host would have the savefiles to begin with. I don't know a lot about savefile editing, but I don't think modifying a savefile in the middle of a game and the values being returned is even feasible. So, when they start the game make their resources 0 or whatever. Then that pretty much eliminates that problem.

If either player is hosting, that player has the opportunity to run a memory editor on the game. The problem is that if you let the players host they can modify values. Which means you have to do some strange things with all your sensitive variables to protect your game. The simple solution being not to let untrusted parties host. However, if you don't let players host, you have to supply a server or servers.