Member-only story

Naked Networking with SwiftUI gamification

Mark Lucking
4 min readFeb 2, 2020

Hopefully you got here through my other articles, this one the fourth in the same series. They all build on each other, so you need to step thru them to get here. Here is list of links.

Naked Networking with SwiftUI
More Naked networking, more SwiftUI
Naked Networking, SwiftUI and the game plan

Where is here. I started on creating a UDP listening server under iOS. I went on to build a transmitting client, and in the last article tied it all together into a app that lets you play ping/pong with each other. The app needs to run on two devices on the same network.

But it isn’t finished. We need to introduce do some gamification. To build in an element of challenge, an element that will give two players a means of competing with each other.

Lets bring in a timing element. Lets give each player less and less time to return the ping until one fails to do so. We’ll need to keep track of who is winning too.

And what about a few more buttons and get the receiver to pick one at random when it gets the ping. It then becomes a game in which you need to press one of X buttons to return the ball. .

Finally lets add some spice to it by animating our buttons. Ultimately we might also like to think about how the game would/could work with more than two players. After all our UDP broadcast is catchable by up to 255 players.

--

--

Mark Lucking
Mark Lucking

Written by Mark Lucking

Coding for 35+ years, enjoying using and learning Swift/iOS development. Writer @ Better Programming, @The StartUp, @Mac O’Clock, Level Up Coding & More

No responses yet