SwiftDart
SwiftDarts is an AR darts game for solo or multiplayer games, which is based on a game SwiftShot featured in the WWDC18 keynote. Thereby, SwiftDarts is a customized version of the basic game which uses ARKit, SceneKit, Swift and MultipeerConnectivity. Requires Xcode 10.0, iOS 12.2 and an iOS device with an A9 or later processor.
- language: Swift 5
- platform: ios
- device: iphone/ipad
- license: MIT
Tag
Download
Key Features
Multiplayer Physics
Each peer in a session runs its own local physics simulation, but synchronizes physics results with a server. To send information between devices, the customized type PhysicsNodeData and PhysicsPoolNodeData encode it to a minimal binary representation. Every projectile's(dart) piece of data represents position, orientaion, velocity, angular velocity and a team of player who throwed it. A boolean flag isAlive indicates whether a dart should be spawned.
Each peer in a session runs its own local physics simulation, but synchronizes physics results with a server. To send information between devices, the customized type
PhysicsNodeData and PhysicsPoolNodeData encode it to a minimal binary representation. Every projectile's(dart) piece of data represents position, orientaion, velocity, angular velocity and a team of player who throwed it. A boolean flag isAlive indicates whether a dart should be spawned.Synchronizing
To synchronize game events between players, it uses an action queue pattern. The GameManager class maintains a list of GameCommand structures, each of which pairs a GameAction enum value describing the event with an identifier for the player responsible for that event. When the player touches the screen(making some action), the game creates and adds it to the queue. Simultaneously, the game sends encoded actions to other players for sync.
To synchronize game events between players, it uses an action queue pattern. The
GameManager class maintains a list of GameCommand structures, each of which pairs a GameAction enum value describing the event with an identifier for the player responsible for that event. When the player touches the screen(making some action), the game creates and adds it to the queue. Simultaneously, the game sends encoded actions to other players for sync.Sharing World Maps
As well as the SwiftShot uses MultipeerConnectivity framework, SwiftDarts is completely based on the same classes and logic which creates an ARWorldMap containing ARKit's understanding of the area around the game board and allows to share worlds with joining players.
As well as the SwiftShot uses MultipeerConnectivity framework, SwiftDarts is completely based on the same classes and logic which creates an
ARWorldMap containing ARKit's understanding of the area around the game board and allows to share worlds with joining players.Installation and Launch
The game requires an iOS device with an A9 or later processor. After launch choose a game type and follow instructions. A host player can place, rotate, scale board on vertical surfaces. In multiplayer games a new player can join an existing game session.
The game requires an iOS device with an A9 or later processor. After launch choose a game type and follow instructions. A host player can place, rotate, scale board on vertical surfaces. In multiplayer games a new player can join an existing game session.
Bug list
- There is a possible bug when a new player joins a multiplayer game and it doesn't load a game board,
- Fix projectile despawning when a player throws his dart outside game zone borders. Hint:
RemoveWhenFallenComponent type,
- Investigate the
CameraThrower spawning logic. A bug occurs when a new player joins a multiplayer session,
- There is a possible bug when a new player joins a multiplayer game and it doesn't load a game board,
- Fix projectile despawning when a player throws his dart outside game zone borders. Hint:
RemoveWhenFallenComponenttype, - Investigate the
CameraThrowerspawning logic. A bug occurs when a new player joins a multiplayer session,