Todays Work

I started today off with a pretty shitty morning, I ended up having to call a recovery firm to come and pick me and my car up to drop me to work because my car conked out on the way to work. This evening I am going to pick up a car rental.

Later on this evening I am planning on working on the following.

Pause Button Positioning 
Fire Button
Resume Button Sprite

Statistics

  1. Resume Game When close
  2. Number Of plays
  3. Max Score

The statistics are something that will not be visible per se, but I would like to store the statistics of playing the game because I think I could use this at some point in the future.

While I would like to say that I am not taking this too seriously, I'm making a concerted effort to create something reasonably playable & enjoyable.  I'm not a professional game developer, just a casual developer trying to learn new things while working away from home. I am putting quite a lot of effort into creating something thats specific to what I would play & ultimately able to put on the App Store. :)

 I will ponder a little more of the requirements to put this on the App Store when it's complete.

 

Post Weekend Update

With the weekend finally over and me working back down south. I've finally got a small chance to update the blog on what's changed. I can happily say that the kids enjoyed playing on the game, they found if a little difficult at first but happy that it worked...I mean it wasn't Minecraft, but was a game that can be played rapidly to pass boredom. 

Last week, I wrote that I wasn't using applyimpulse - even though i was expecting the physics to 'just work'. After a little tinkering the sprites now move with a movement force applied to them. The tricky part is getting the physics to be realistic, so when applying a force to Dappa; he manages to move - but not quite how i wanted him to move. It appears that I wanted all the benefits of what a physics world brought me, but not have the problem of sprites rotating when a force is being applied to their physics body. Dappa has a bit of a complex shape, which when force is applied to him - rotates in ways you sometimes don't want.

Rather than trying to get down to the physics, I have made slight changes whereby Dappa will move at a constant speed according to his Mass, and i've change the accelerometer to be used to balance him when rotating while jumping. I've did a few checks to determine if Dappa's angular velocity is above or below an arbitrary value so the player can apply an AngularImpulse to balance him.

Things that I have done over the past few days
Allowed Dappa to Shoot Something, allowing the monsters to not kill him instantly (this does need more work).

Today has been a little slow, and haven't really done much. I was mainly figuring out how to do trivial things in Adobe illustrator. I ended up re-creating Dappa. The main thing that was done was making the wheels transparent.

 

Movement

Looks like i have a fair bit to learn about physics and movement. This evening i was working on 

  • Making Dappa's Wheel Chair Run out of Juice.
  • Randomly Adding Battery packs to Charge Dappa's Wheel Chair
  • Killing Dappa should his Wheel Chair battery life = 0
  • Bouncing Dappa on the floor.

And noticed that how i was currently moving Dappa was incorrect, I wasn't applying any force vectors, just moving the sprite on an axis. This worked well for trivial things, however in a physics world...meh not so well. By using the ApplyImpulse i was able to affect dappa's velocity however bouncing on the floor appears to change the angle of the sprite causing Dappa to spin.  I am not saying this is completely incorrect; however being able to control this would be useful.

I've updated the resources. 

Sadly, I will resume more work next week now and eagerly await some feedback from the kids.

 

Never Ending Game

Today I worked on making the game never ending, essentially making the game loop create new platforms. It was pretty rudimental, whereby I kept the x position of the last platform that was created and compared the value to where the camera position is

func  createNewPlateforms()
{
   if(
    camera position.x > last platform position.x - seporator value.)
  {
      .
      ..
      ...
      create new platform and add to scene.
   }
}


In the update func I call a function to create platforms based on some criteria of where the camera position is.

func Update()
{
   ...
   if(!player.IsDead())
   {
       createNewPlatforms();
   }
}

This causes the game to loop until you the player dies. 

I have added the following things to the game so far:

Player is Killed by collision of Monsters
Game Score is shown when the player dies on game over score
Removing nodes from scene that are no longer in view
Randomly add monsters to platforms

All in all, the game is coming on and starting to feel like a real game now. I have experimented with SKActions on my sprites but will be adding some animations. Since this is only a test game, I am not trying to make the graphics absolutely crisp, however making them tidy is a must. I'll be show casing the changes in the game to my children over the weekend for their feedback. 

Things to work on
Running out of battery
Collecting battery power
Factory pattern to determine what actions to add to objects/monsters/platforms
e.g. Spinning Platform, monster types

Game Animation

It's been a little while since doing any work on my game, since personal time is very limited as of late. I've been meaning to try and add some animations lately, or at least figure out how to do simple sprite animations. Today I started with creating a simple character using adobe illustrator. Since i'm doing everything pretty much off the cuff; i'll probably just leave this character in the game but may just tidy it up a little and maybe add a few more frames.

 

 

So far I've had a little play with putting the character in the game, however it doesn't do too much at the moment...it just winks. I think i'll be adding one of these monsters to each platform randomly and getting it to move backwards and forwards at different speeds to try and get the monster to make the game a little harder. With that said, there is still alot to tidy up as the orientation of the ViewControllers does not seem to work as i intend them to. Each time a player dies, i try to reload the viewcontroller but it appears that causes the orientation to flip from landscape to portrait. I think i may be doing something incorrectly. I'll work on this a little later as i'm going to concentrate on adding the monster to the game tonight.

I plan to have a busy week working on this in the evenings. This week I plan to:

  1. Stop Man From Jumping Twice
  2. Monsters Moving back and forward randomly
  3. Battery Life Up (increasing power)
  4. Battery Life Down (losing Power)
  5. Change Background - This is a problem with me repeating the 3 backgrounds to make it look like the play is moving across the screen.
  6. Remove Sprites when off screen - When the sprites are not visible, the sprites can be removed. 
  7. Set Score On Game Over View Controller

Game Update

Just a quick update. After a few hours of playing around, I've managed to get a game that kind of works. I'll show my kids the game a little later on today and see what their feedback is. The guy in the chair races across the screen and eventually falls off the edge.  

Things that I have done so far
Score System (needs aligning a little)
Pause Game
Physics

Things that I am going to try in the future.
Add animation Sprites
Add some Characters to patrol the platform
Sort the battery life out for the scooter. At the moment it's fixed and does not run out.
Create a HUD - Not sure how this will work just yet as I'm still learning new things.

It will be interesting to see this develop into a working game which is kind of why the blog exists. A way of tracking back along a timeline and seeing it develop is an interesting concept.

 

Saving Data & Retrieving Data

Today I realised that it would be pretty neat to store some of the user settings in the phone app to maybe store the users score and where they got to should they close my game  unexpectedly.  After a little searching and checking the apple api documentation I found that there is a little database that is stored for each user called UserDefaults. You can store simple useful things here with very little code.

Some things may include User settings such as 

  • Sound
  • Volume
  • High Score
  • Name

Generally things that would be a pain in the ass to enter each time my game runs.

Example

let ud = UserDefaults.standard;
ud.set("my name is K", forKey: "name")
 ud.synchronize();

//Retrieving Information

         let ud = UserDefaults.standard;
        if let obj = ud.object(forKey: "name")
        {
            print(obj);
        }



IPhone Swift 3.0 Development Resources

I have attached as a much of the content that i have found while developing an IPhone game. Please feel free to leave comments and I will add further links the more that I progress developing a game.

Apple Api Documentation
https://developer.apple.com/reference/spritekit
 - I have referenced the SpriteKit api here, however all that is needed is on the Apple site. Sometimes it can be a little easier searching stackoverflow for answers before searching the api documentation.

Image Creation
Adobe Illustrator - useful for creating the sprints and scenes
Spriter

Courses
https://www.udemy.com/the-complete-ios-game-course-using-swift

Blogs
https://www.raywenderlich.com/ - This will undoubtably be the most useful blog you will ever visit looking for Swift Resources.

Books
These are the books that i found useful developing my own IPhone Game.

Swift 3
     Mastering Swift 3 - Jon Hoffman
     Swift Programming for absolute beginners - Arjan Egges

Tutorials
https://www.raywenderlich.com/89222/sprite-kit-animations-texture-atlases-swift - Great Tutorial on Animations in SpriteKit

 


Last Updated (6-2-2017)

About this Blog

Welcome to my Blog. I am K and this is my development blog. Over the years I have saw mobile development progress to the point where I finally decided it would be pretty cool to develop my own mobile game. 

I have almost no mobile development experience to date and certainly no IPhone Development experience. In the day I develop in .net and by night i am learning new things. 

I will try and document as much as possible, raw idea's to rough sketches that i have done. Over the next couple of months I'll document the resources of things that I have used to learn.

http://unlocked-networks.com/post/2017/01/12/iphone-swift-3-0-development-resources

 

K