Multiplayer turn-based 3D fighting game for iOS
This project is my attempt to use the best and newest practices in Swift and popular third party libraries; Combine, Firebase (Firestore, Authentication, Storage, Crashlytics), and uses MVVM pattern.
-
Collada (.dae files) for 3D models and animations. Animations were downloaded from Adobe's Mixamo by uploading the character's .fbx file
-
Swift
- App is mostly in SwiftUI, however, UIKit is required for SceneKit
- SceneKit is Apple's 3D rendering engine
- Combine is Apple's framework to handle asynchronous events declaratively
- MVVM pattern, common SwiftUI pattern
- Router pattern in charge of handling navigations and creating views which allows flexibility and testability
- Codable mapping JSON or dictionaries into a Swift object
async
andtry await
handling background tasks asynchronouslyResult
for error handling
-
Firebase
- Firebase Firestore for database
- Used Firebase's new property wrappers
@DocumentID
,@ServerTimestamp
,@FirestoreQuery
- Used Firebase's new property wrappers
- Firebase Authentication for authenticating users. This app also features:
- Register and log in accounts
- Forgot email and password
- Email/username authentication
- Assign profile picture
- Update unique username
- Remember email/username and password
- Reonboard unfinished account registration
- Firebase Storage for storing user's photo and other files
- Firebase Firestore for database
- Download repo
- Download Swift Packages by going to File -> Add Packages and paste the links below
- FLAnimatedImage (for GIFs): https://github.com/Flipboard/FLAnimatedImage
- Firebase SDKs: https://github.com/firebase/firebase-ios-sdk
- Make sure Add to Target's project these followung Package Products:
- FirebaseAuth
- FirebaseCrashlytics
- FirebaseFirestore
- FirebaseFirestoreSwift
- FirebaseStorage
- Make sure Add to Target's project these followung Package Products:
- Add GoogleService-Info.plist to the Xcode project by either:
- Contact samuelfolledo@gmail.com for a copy of the file
- Create your own Firebase project here and download its GoogleService-Info.plist into your Xcode project. Ensure to enable Firestore, Storage, and Authentication for email and password in the Firebase project
- Each round before the timer runs out, both players can select up to 1 attack and 1 defense move
- When the current round's timer runs out, damage is applied to opposing enemy's HP depending on each player's selected moves. Selected moves also goes into cooldown at the end of the round
- Attack rules:
- There are 3 types of attack:
light
,medium
, andhard
. Light
type of attacks are faster but does lesser damage, meanwhilehard
type of attacks does more damage but are slower. Cooldown are also longer for hard attacks compared to light attacks.- Landing an attack first gives the attacker a slight speed boost for next round and reduce incoming damage based on attack type. Hard attacks will reduce incoming damage much more than light attacks
- Some attacks can boost the damage of attacks that are not on cooldown for the next round indicated with fire
- Each attack type can land either
left
orright
- There are 3 types of attack:
- Defense rules
- There are 4 types of defense:
left
,right
,up
,down
- Defense type:
left
orright
defense move can dodge an attack and receiving 0 damage - Defense type:
up
will increase your speed, increase damage dealt, and damage received - Defense type:
back
will reduce your speed and reduce incoming damage
- There are 4 types of defense:
- The game ends when one of the player’s HP reduces to 0
- This game will never result to tie
- Uses Firebase’s
Authentication
for authentication - Account creation requires a unique username, unique email, and password. Profile picture is optional
- Email or username along with a password can be used to authenticate
- Account created but incomplete (i.e. user name was not set), after logging in, the app will transition to finishing account creation
- User’s data are stored in
Firebase Firestore
and profile picture inFirebase Storage
- Deleting accounts gets their
Firebase Firestore
’s data,Firebase Storage
’s profile picture, andFirebase Authentication
’s account permanently deleted - Locally stored account data and remembered email/password are permanently deleted
- Account deletion requires a recent authentication before performing
Account Creation | Account Deletion |
---|---|
- Username authentication fetches the user’s email using the unique username, then use that email along with the password to authenticate
- Logging in fetches user’s data from
Firebase Firestore
, user’s profile picture fromFirebase Storage
, and store cache them locally - With remember email and password feature which gets updated when updating the user’s username
Log In With Email | Log In With Username |
---|---|
- Recent authentication is required in order to update account
- Update email and profile picture is also supported
Update Username | Update Password |
---|---|
License under MIT License