Using GameCenter for parallel turn based games? - iphone

I've played around with making turn-based games using GameCenter. I understand that by default, GameCenter assumes that out of a number of participants, at any given time, one player holds the "play baton", and that this player is the only one who can affect the current game state. Gameplay is asynchronous, i.e. whoever's turn it is can take their time, and the other players will be notified once it's their turn.
So far, so good.
Now I want to use GameCenter to implement a similar, but slightly different kind of turn-based game: an asynchronous game where, instead of a serial player succession, players make their turns in parallel, which are then consolidated into a new game state once all players have "turned in" their moves.
A good model game for this would be Rock, Paper, Scissors: both players secretly decide on their move ("rock", or "paper", or "scissors"). The order in which those are then submitted to the server is arbitrary; i.e. no player should ever get a "not your turn"-type error when they try to submit a move in an ongoing round. Once they both turned in their moves, all player choices are revealed, and the winner of the current round is determined/declared.
The question is: is it possible at all to use the GameCenter infrastructure for this kind of game, either by design or by work-around? And if so, what would be considered a good approach?

It is not possible to implement this with Game Center the way you suggested, but you can take an approach that will look as if you did manage to do this.
When you start a turn-based match, it's always the local player's turn. Either Game Center provides you with a blank match, or you will receive a match in which someone else already took their turn. There is no way to control this, so you need to be prepared for both.
The approach you can take is to have a player always take their turn before you show them anyone else's move. Only then do you check if in your local case, everyone has now taken their turn and you show the result. This will provide the illusion of what you are asking for. In the case of Rock-Paper-Scissors you can now decide the match outcome. The other player will be notified.
However, if not everyone has taken their turn in this round, don't show anything, update the game state as well, but tell the user you're now waiting for others to take their turn. You will be able to show the result when you are notified that it's your turn again, with a game state already indicating the outcome.

Related

How do I respawn all players of a particular player controller in ue4?

Hey guys,
As soon as a certain number of players is reached, a random player is selected and the "CatcherPlayerController" is assigned to him. All other players keep the standard PlayerController.
How do I get all players only with the standard PlayerController and respawn them at different points? The whole thing is for a waiting lobby system in which all players, except the "catcher", have to be respawned as soon as the game starts.
I've tried several approaches but haven't found a solution yet. Thanks in advance!
You could iterate over all players and get the player controller, try to cast it to CatcherPlayerController and if it fails you know it's a standard PlayerController. Since it's a once in bluemoon event I would not be worried about performance issues of all the cast you should do but it really depends on the number of players. Let me know more if I misunderstood your problem.

VR: How to form hands around object they are holding in Unreal?

I'm working on a VR project in Unreal and I'd like my player hands to form to certain objects whenever the user grabs them. (I.e. the way our hands work) Unfortunately, I haven't really found any examples online of others doing this.
For example, I'd like when the user picks up say a hand held tool like a hammer that the hand would wrap around the handle. When the user grabs a basketball the hand shouldn't be closed but, expanded like a you would if you were to palm a basketball in real life.
I haven't done a lot of testing with this but, I'm pretty sure since the hands are based off of a Animation Blueprint that they simply ignore collisions and follow the animation.
I guess the simplest solution would probably be based off of collision where the hand plays an animation and as the fingers of the hand wrap around the object they stop at that position where they collide with the object in question. If it is even possible that is.

Anti-Cheat / Glitch in game

Currently I am working with a team on a Unity-based game. The game is still in development and alpha version.
Recently, we saw that the game was vulnerable to Cheat Engine, speedhack etc. Updates after updates, cheats are now stable. We also introduced the ACT or anti Cheat Toolkit of Unity. As the game is Unity-based, it is easy to implement ideas in the game.
Though "hacks" are stablized, "glitches" are not.
This is an open world Survival game and it consists of picking/dropping items. The glitch is that when two players pick the item together, (currently you have to press E while the crosshead is over the item to pick it up) the item gets duplicated. We have been working DAYS to fix it, but no fortune.
We introduced that a player cannot pick up an item when there is another player nearby. It looks odd and we want the game smooth. We also tried auto pick up item. That's our plan, but are there any more ideas what we can do?
If your concerns are players cheating by modifying memory values, as well as maintaining a synchronized game state to avoid problems like item duplication, you should look into setting up an authoritative server that will contain and update the "official" values and state of the game.
Basically, rather than storing values and performing actions directly on the player's computer, the game will send a request to the server of what it wants to do, and the server will perform the actions, update the official game state, and send the new state back to the player so their game is updated.
This will prevent memory editing because even if a player modifies a value on their screen (such as currency or health) the server contains the true value.
It will also prevent exploits like speedhacks, because rather than having the local game directly move the player when a key is pressed, the keypress will just send a movement request to the server, which will update the player's position, and send back the new position.
Finally, this will prevent item duplication, because when both players attempt to pick up the item, they will both send an item pickup request to the server. Whichever player's request arrives first will receive the item, then the server will update the game state so that the item is no longer on the ground, and the second player's request will be ignored, because the item they're trying to pick up no longer exists.
Simply put, the best way to prevent cheating is: Don't store important values or perform important actions on the player's computer.

Unity help, indie horror game

I am making a game using a combination of Blender and Unity and have hit a wall. I am trying to make it so a lamp flies off of a table and smashes against a wall once the player walks past a certain point in the map.
I am having a hard time with this. Any help is appreciated.
You need to break this up into little parts.
The first part is that once the player walks past a certain point you want to do something. To do this, look at http://docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html
An on trigger event will let you run some code when an object collides with another object. In your case, when your player collides with a certain point in the game.
Next, inside that OnTriggerEvent, you want to fire the lamp off the table. To best do this, create a keyframe animation (or whatever you're most comfortable with) that animates the lamp to fly off the table. Lastly, play that animation in the trigger event. http://unity3d.com/learn/tutorials/modules/beginner/animation
To summarize, when the user hits a certain point, play an animation on the lamp.

Do there any dev who wrote iPhone wifi/bluetooth multiplay before?

do there any dev who wrote iPhone wifi/bluetooth multiplay before?
Recently, I'm trying to make my latest game Doodle Kart to have mulityplay via bluetooth. But I found that there are hugh data need to share between the 2 devices.
-your car's position and direction
-your car's status(it is in normal state, it is hitting by bullet, it is falling into to hole....)
-CUP car's position, dicretion, and their status
-items position and status (pencil, bullet...)
I'm thinking about one device calculate all the things, and the other device just wait and receive the data to display on the screen. Does it make sense?
Hey, I should ask you the most important question first: Do you think it's possible to make bluetooth multiplay work on my game? It's just too much data need to share between the device.
Usually Multiplayer Games just share "events", like:
Player begins to turn left/right.
Player begins to accelerate.
Player shoots from x/y/z to direction x/y/z.
Item spawns at x/y/z.
Player aquires item.
The other parts just calculate the rest themselves as if everything would happen for them.
This reduces the data needed to transmit but requires periodic "full updates" that sync the game state again (i.e. every 10 seconds).
In short:
Transfer actions, not data.