Part 4: Create a multiplayer iOS game: A step by step tutorial

  Рет қаралды 3,304

Anyone Can Code

Жыл бұрын

Welcome to @AnyoneCanCode Swift and Xcode tutorial part 4 of 4! Today I'm going to show you how to make a multiplayer game.
You'll learn how to:
- Create the game UI with SwiftUI
- Set up a real time match with Game Center
- Sending data between players
- Handle network events such as player disconnecting
- Use PencilKit, SwiftUI, Combine, GameKit, and more!
Download the assets (images and custom colours) here:
madebyyuma.gumroad.com/l/iOS-multiplayer-game-assets
Download the finished Xcode source files here:
madebyyuma.gumroad.com/l/iOS-multiplayer-game-source
Part 1 - Creating the menu screen UI with SwiftUI and setting up game data:
kzfaq.info/get/bejne/idScZtKptc_Kh6M.html
Part 2 - Creating the game screens UI with SwiftUI:
kzfaq.info/get/bejne/mpNldrKQmNbcoIU.html
Part 3 - Multiplayer functionality with GameKit (1):
kzfaq.info/get/bejne/ftOcipRpsMXVj5c.html
Part 4 - Multiplayer functionality with GameKit (2):
kzfaq.info/get/bejne/oNuarLicxMvdhXU.html
#xcode #gamekit #swift

Пікірлер: 26
@davidecastaldi221
@davidecastaldi221 Ай бұрын
Hey your tutorial was very interesting. I was wondering how would I implement a turn based game? Would it be much different from what you did? Are you going to do something similar?
@mohjb
@mohjb 4 ай бұрын
Thank you for the tutorial, it was therapeutic, and it was an opener for what swiftui can do
@ahdiverse
@ahdiverse Күн бұрын
Did you go over the matchmaking menu or is the video missing?
@Isaqiu
@Isaqiu Жыл бұрын
thannk you
@pgress1867
@pgress1867 8 ай бұрын
I like your coding style. Well done!
@AnyoneCanCode
@AnyoneCanCode 8 ай бұрын
Thanks!
@florenciadiaz9219
@florenciadiaz9219 Жыл бұрын
Hi! It would be very helpful if you could make a video step by step on how to make an app to read books in pdf. I would like that when I enter the app it allows me to put the covers of the books and when they press the photo that I put as the cover it opens the pdf with the content of the book. from chile 🇨🇱 thank you very much!
@pedrompecanha
@pedrompecanha 10 ай бұрын
Is this a hosted match or a peer-to-peer connection? I would need a hosted one, could you help? Brilliant tutorial!
@AnyoneCanCode
@AnyoneCanCode 9 ай бұрын
Thanks! This tutorial is about peer to peer multiplayer. I’ll consider creating one for a hosted multiplayer!
@pedrompecanha
@pedrompecanha 9 ай бұрын
@@AnyoneCanCode That would be great! I was able to set up my whole game using peer-to-peer, but would love to use a private server.
@eduardoguerrero9876
@eduardoguerrero9876 Жыл бұрын
the game is good, where do you learn this stuff mate?
@AnyoneCanCode
@AnyoneCanCode Жыл бұрын
Thanks! I’ve been making apps for a while so I’ve gained some knowledge from there. Otherwise, the Apple documentation and Stack Overflow help a ton 😅
@tylerguest7497
@tylerguest7497 7 ай бұрын
Thanks for the series. Followed it all the way through. Only issue I'm running into: attempting to find players from the simulator instantly leads to a "Failed to find players" error message. While joining from my standalone device seems to function fine. Do I need to clear the error message from the simulator or something like that?
@AnyoneCanCode
@AnyoneCanCode 7 ай бұрын
I encountered a similar issue when trying to start multiplayer matches on the simulator. Restarting it worked for me, and I figured it was a bug when running multiplayer games through the Simulator. Also, make sure you’re using different iCloud accounts on your devices! Hope this helps!
@FishCraftxd
@FishCraftxd 7 ай бұрын
@@AnyoneCanCode Im also having this issue I was wondering if you were using a sandbox tester account for the simulator or if you had a whole other account? Just from what im thinking it might be because I cant verify the sandbox account because I dont have another phone number to use
@AnyoneCanCode
@AnyoneCanCode 7 ай бұрын
I created a new (non-sandbox) iCloud account for the simulator and that worked for me. If a sandbox account has issues then you might need to create a separate iCloud account. Hope this helps!
@tylerguest7497
@tylerguest7497 7 ай бұрын
@@FishCraftxd I use a free google voice number to receive the texts to verify my second iOS account to use for testing. Have had no issues.
@melihmete807
@melihmete807 6 ай бұрын
Hey man! I've been getting the same error "Failed to find players". I'm using dfiferent accounts. Did you find a solution other than Google Voice?@@tylerguest7497 @anyonecancode
@wadihibrahim1266
@wadihibrahim1266 3 ай бұрын
How can I run it on the simulator and my phone at the same time? because I want to test it and it's not working
@AnyoneCanCode
@AnyoneCanCode 2 ай бұрын
Hi! You’ll need to use different Apple IDs for each device/simulator for multiplayer, but otherwise it should work normally. Hope this helps!
@stlog
@stlog 5 ай бұрын
Hi, while testing, I get a "player not found" error in the simulator. Why might this happen? I even bought the source code thinking I might be doing something wrong, but it doesn't match.
@AnyoneCanCode
@AnyoneCanCode 5 ай бұрын
Hi! That error is most likely a bug with iOS simulators. I would recommend trying with a physical device if possible. I’ve encountered this issue before, and restarting the simulator helped. It might take a few attempts to get working! Hope this helps!
@lukasrosenke5459
@lukasrosenke5459 2 ай бұрын
@@AnyoneCanCode I have this very error too, and thus cannot test my app. Do you know the exact steps to fix this?
@xperrttt
@xperrttt Жыл бұрын
Hey menu button doesn’t work when time runs out what can i do Thanks
@AnyoneCanCode
@AnyoneCanCode Жыл бұрын
Hi! This can be due to many reasons. Make sure there are no typos and the game over code and variables are the same as in the tutorial!
@xperrttt
@xperrttt Жыл бұрын
@@AnyoneCanCode I checked everything they all should be everything else works as well