Tuesday, April 8, 2014

Day 30 - Publish Game & Source Code/Data

 Taco Run Game

Today i've put my game online, as a web game, rather than a MacOS standalone. Clic on the image above or this link to play the game. Note that you might sometimes have to wait 2 sec of black screen before the game actually show up.

(if you just arrived here by accident, i completed a game to learn the ropes of Unity 2D in 30 days... in my spare time... more information in my first post : Day 1 - A simple goal)

I decided to share my source also, to contribute to the community. I found a vibrant and passionated community of game developer while exploring Unity 2D workflow. A lot of people use this engine and share their passion and knowledge. Clic here to download the tacorunsource.zip 

Finally here're my general notes about Unity and its 2D workflow, organized in a i liked / i didn't liked fashion.

I LIKED
  • Simple and customizable interface.
  • Prefab workflow.
  • Component based Architecture (once you get it, it makes you life simple ^^).
  • 2D sprites importation and animation.
  • Physic engine ready with collision detection and other essentials functions.
  • Develop and Play: i was testing a lot and it was fast.
  • In the box Code editor with good basic functionality (completion, etc.).
  • Simplicity of export for MacOS or Web player.
  • C# syntaxe (coming from Flash "Action script", i'm happy to find a generic C language)

I DIDN'T LIKED
  • 2D cut-scene editing : frankly it was a pain to figure out how to create a simple "cut-scene" using 2D sprites. I didn't figure it out completely, i may have miss something here.

Not much things i disliked... So overall, it's a fun editor to prototype games. I'm happy to have invested some spare time into learning it. I look forward to use it again. Don't hesitate to leave me comments, and as always, have fun kids!

Z.

Monday, April 7, 2014

Day 29 - Playtest + Bug Fix


Today i played the game and list last modifications. I then prioritize those modifications and made the most important, discarding the less important one. Again, my goal is not to make the "best game ever". I made this game to learn about Unity Editor and its 2D pipeline ^^

So here's the changes i made :

Problem: "There's no tutorial on HOW to jump". Space Key is used for navigating the menu and controlling Taco (jump). So no need of a real tutorial, i just linked the SPACE key with the JUMP to make sure player understand. I added an animated "press space" and now each time player press SPACE to start or continue a game, Taco Jump, feed backing the space-jump control.

Then i fixed some minor bugs :
  • an APP icon
  • Tweaks score position on Score Screen
  • Tweak Ball animation on Intro Screen
  •  an Author/copyright mark on the menu screen.

Some other things i notice but decided to not fix : 
  • Taco's animation should stop running when jumping
  • the HighScore should be displayed on the Menu Screen
  • there's sometimes a "too" long loading time after Unity Screen Splash Screen
  • During the intro screen, Taco start to run before the scrolling start

And that's it for today. Tomorrow, i'll finally release the game as a downloadable for MacOS ^^

Day 28 - OFF

"Our doubts are traitors, and make us lose the good we oft might win, by fearing to attempt." - Measure for Measure (Act I, Scene IV).

Saturday, April 5, 2014

Day 27 - Menu Screen & Sound SFX

i've add the big logo menu screen and some sounds on jump, hit and win! I recorded a video with quicktime but the sound is not recorded. i'll look into that.

Otherwise, i decided to not tweak taco's sprites for idle and jump. I've also drop the idea of adding a Bush and a Bone bonus for now. All this would add quality, but i won't really learn new stuff about Unity by doing that.

Friday, April 4, 2014

Day 26 - Intro Screen + Background Scrolling


Everything's in the Title. I miss working on pure mechanic. Doing screen flow is necessary but ... kinda boring to do! ;)

Day 25 - OFF

"what 's done is done." - Macbeth (Act III, Scene II)

Wednesday, April 2, 2014

Day 24 - Save Game & Intro Screen


Today, i've done :
  • the Highscore is saved, so you can try to beat it!
  • i started some animation for the intro screen : the girl thow the ball ^^

Tuesday, April 1, 2014

Day 23 - Score Screen


Today's i've done...
  • Show a score screen each time Taco catch a ball 
  • Keep track of an HighScore, and tell when player beat it
  • Added 2 new solid obstacles : bin & table
  • Adjusted Taco's ray cast & collision 2D box to have a better feeling 

Monday, March 31, 2014

Day 22 - Ball Objective + Ball-Run Score



Today's i added the Ball Taco is running after! Player's score is the number of Ball Taco has catch without hitting an obstacle. Each time Taco catch a ball, the re-start with a more challenging run. If Taco hit a small wall, the game re-start from the beginning and score is reset to 0.

Each "Run to the ball" has a length equal to the number of obstacle sequences (ie. 1 to 3 small wall).
Run 1 (ID = 1) has length = ID + 1. So Run 5 has 6 obstacle sequences to jump over to reach the ball.

Sunday, March 30, 2014

Day 21 - Sprite Animation & What's left to do.


I searched a lot about sprite animation in Unity to finally use the simplest approach : 2d sprite frames. I discovered and used Pixelmator to edit my drawings. This app is really powerful: it's as good as Photoshop but for only something like 30$ ^^

Taco's run is made of only 2 differents sprites:


Next time, i'll add other states like jump and hit. I'll also add the other game ingredients : bush and bonus bone. 

I've list what's left to do to complete this little game :

Day 22 - Ball Objective + Ball-Run Score
Day 23 - Score Screen
Day 24 - Save Game
Day 25 - Intro Screen
Day 26 - Background Scrolling + Menu Screen
Day 27 - Taco sprites + New ingredients: Bush & Bone
Day 28 - Sounds Effects
Day 29 - Playtest + Bug Fix
Day 30 - Build Package + Put Online

April 8th, the game is complete, and i celebrate =)

Day 20 - OFF

"There's places and means for every man alive." - William Shakespeare

Saturday, March 29, 2014

Day 19 - OFF

"A fool thinks himself to be wise, but a wise man knows himself to be a fool." - William Shakespeare

Thursday, March 27, 2014

Day 18 - "Procedural" Challenge


Today's goal was to generate procedurally increasing challenge : spawn forever more and more small walls with progressively less space between them. When Taco hit a small wall, i also properly restart the game from the beginning difficulty.

I has some trouble with Array (apparently there's no basic push() or pop(0 function in c#), so i tried to use List. I almost succeed but there was too much references errors, which i don't want to put time in because i won't learn much... so i fixed by using static multiple variables rather than a list (sigh...). It's crappy, but it works! so everything's fine =)

Wednesday, March 26, 2014

Day 17 - OFF

"Love all, trust a few, do wrong to none." - William Shakespeare

Tuesday, March 25, 2014

Day 16 - OFF

"We Know what we are, but know not what we may be." - William Shakespeare

Monday, March 24, 2014

Day 15 - Jumping Behavior & Ray Casting


Today i've made the jumping behavior better. Taco (the dog) was not feeling responsive and his jump speed was not feeling fast enough. There was a bug on the control : sometime it misses a keyboard input, so pressing SPACE was doing nothing. i fixed that. I also increased the gravity to -20 (instead of -9.81) and adjusted the jumping force applied on Taco. I increased a bit the speed of obstacle. Taco jumping feels better now.

As soon as Taco collided with an obstacle, it was game over. This was ok most of the time... but not ok when Taco just landed a jump on a small wall... he should have been able to jump again instead of being hit... To make that happen, i changed a bit the way collision detection happen. I added a ray cast to detect collision in front of Taco (the red thin line in the video). Only an obstacle in front of Taco stop him. An obstacle below him is just like the ground, he can jump on it. This is true for the small wall, but maybe not true for the slowing bushes. Anyway, i'll check that another day. Today, Taco has a much better behavior =)

Sunday, March 23, 2014

Day 14 - Refactoring


So what does "refactoring" means for game development? Basically it means that before the programmer (me) was not knowing what he was doing =) ... And so i need to "refactor" my code as an attempt to organise it in a simple and clear way, because now, i KNOW what i'm doing =) ... So that's what "refactoring" means.

I clarified my structure to follow the component-based simple structure principles. As you may see in the video, i now instantiate the player and obstacle during run-time. Before, they were just a bunch of prefabs in the scene. I'll be able to start on the procedural level design now, or maybe tweak the jumping behavior.

Saturday, March 22, 2014

Day 13 - Build & Run



Today, i've build & run the project as a stand alone App on Mac. The process is again quite simple to have a version built. What took most of my time was the adjustment of resolution. I wanted to have some kind of "long format", like 16:9, to give player some time to anticipate obstacle movement. 


Friday, March 21, 2014

Day 12 - OFF

"I say there is no darkness but ignorance." - William Shakespeare

Thursday, March 20, 2014

Day 11 - Screen Flow and Procedural Level Design


Today, i designed the screen flow for the game. I kept it as simple as possible. While doing it, i adjusted the ingredient design. I was not completely happy with the idea of Taco having hit points. It was adding a resource to manage, which could be cool, but it was not satisfying that a bush ingredient remove 1 HP and a solid wall kill you. In fact player were managing only the resource to survive bush, but it had no value in front of wall. So i simplified, by removing the management of Hit Point. I instead focus on making ingredients related only to movement. A bush slow you. A wall stop (kill) you. A bonus increase temporarily your speed. 


I'm a huge fan of automatically generating levels. Because, well done, it keeps thing unpredictable. Each time you play, it might be different. Also, it's possible to generate more content in less time. So i designed a simple level design principle : player encounter a challenge, with obstacles, then player has a rest moment where he might find a bonus. These challenge and rest moments always alternate until the player hit a wall or reach the ball. Then as the player progress toward the ball the difficulty of the challenge rise progressively. An algorithm increase the difficulty parameters steadily and insert a bit of randomness. Between "run" (each time taco catch a ball, we start a new run), the algorithm increase the number of challenges and overall challenge difficulty. here it is! procedural level design!

Wednesday, March 19, 2014

Day 10 - Component-Based Architecture


While searching about the best ways to structure my code in Unity for further refactoring, i discovered the component-based architecture. Being used so far to object-oriented programming and some coding patterns (singleton, etc.), this was quite a surprise, but a good one!

Component based architecture has its pro and cons, but basically it seems appropriate to game development. When you develop a game, you usually come up with ideas on the ways to make your game better. OOP actually make this process tedious because you always needs to re-think/re-organise your class structure. Component-based architecture aim to avoid that workload, by thinking differently.

Now that i know that, i'm going to explore and experiment with that approach :)

References : Game development : from OOP to component-based - Lightweight Component ArchitectureWikipedia reference

Tuesday, March 18, 2014

Day 9 - Sending a message: Scroll(false)


Hey, sorry for the video quality. I'm using quicktime to capture my screen and i'm not sure how to get the best results yet. I'll look into that eventually. 

Today, i've made the background sprites (trees and grass) scroll. All thoses objects are contained in a game object named "Background". I've attached a dedicated script to this game object. This script apply a constant translation to the left to make the background move. I've made it loop, so it's never ending.

Then i ran into a common issue : how may i structure my code properly? I have 3 game objects : Taco, SmallWall, Background. When Taco hit a SmallWall, the Background has to stop scrolling. But as, i've attached scripts to each objects, i have no "main loop" which knows all the object in the scene and so can't communicate with all of them to synchronize them. 

Rather than setting up a "main loop", i used TAGS and MESSAGES...  which allows me to stays more object oriented =) 

In Unity, you may define and set "tags" to objects. I set the tag of my background as "Background". This allows me to find it from the SmallWall script, using the function FindGameObjectsWithTag("Background"). Then i sent a message to my Background object: SendMessage("Scroll", false). It actually execute a function ("Scroll") and pass it some parameters ("false").

it worked really well :)

Monday, March 17, 2014

Day 8 - Basic Newtonian physics


Basic Newtonian physics: constant force results constant acceleration, zero force results constant velocity.

I was applying a constant force to the small wall. It was accelerating like crazy and was going out of control. So i made sure to rather update its velocity, so i can control how fast it goes and if it should accelerate to increase the challenge. Now each time taco jump over the small wall, it comes back a bit faster, giving the impression that taco run faster.

I explored a bit collision. On collision with the small wall, Taco fall through the ground and the small wall stop moving. Just hit SPACE again the reset the game and start again. But as you may see at the end of the video, there's a bug... the small wall continue to move although Taco has been hit. Let's fix that next time and maybe scroll the background =)

Sunday, March 16, 2014

Day 7 - Jumping over obstacles


Today, i changed TACO's behaviour to make him jump when SPACE is pressed. I added the first level ingredients : the solid obstacle. After setting up this ingredient as a prefab and adding a script to make it move from right to left, i can *play* TACO RUN! for the first time. Not so bad for day 7 =). 

There's still work to be done, but i have 23 days ahead of me. I'm confident i'll have TACO RUN! working well at the end of this 30 days run!

Saturday, March 15, 2014

Day 6 - Rigidbody and (Easy) Physics.


Alright. Today i added some movement control to Taco. It quite easy to setup the collisions and physics, as Unity manage them directly. I mean there's no need to code or import a 2D collision or  2D physic system. it's already there by default, which is great! So i added a Box Collider to the Grass to have a ground for Taco to run on. Then i added a Box collider and a 2D Rigidbody to Taco for him to collide and be able to move (thanks to the rigdbody). 

Last i've write some code to make him move when SPACE is pushed down and stop if space is released. 

void Update () {            

  if (Input.GetKeyDown("space")){            
    Debug.Log("space down : Taco Run.");            
    isRunning = true;                   
    movement.Set(10);         
  }        
  if (Input.GetKeyUp("space")){            
    Debug.Log("space up : Taco Stop.");            
    isRunning = false;            
    movement.Set(00);        
  }        
  if (isRunning){                        
    myBody.AddForce(movement * speed * Time.deltaTime);        
  }    
}

You can see the *amazing* result in the video. I'm please at how it goes. it's quite simple to setup those basic components. 

Friday, March 14, 2014

Day 5 - Day Off

"It is not in the stars to hold our destiny but in ourselves." - William Shakespeare.

Thursday, March 13, 2014

Day 4 - Importing Sprites


















Today i created my first ATLAS sprite sheet : it's basically an image containing multiples sprites. Unity can process those image automatically to create multiple sprite images. Still you have some constraints to respect, but it's pretty simple to do. I used SEASHORE, a free image editing software to create an alpha layer.

















Then i created some sprites objects : Taco, Tree and Grass. I transformed each sprite object into a prefab (which is as simple as drag droping the game object into the project window. I wonder how i may set the screen pixel size of the game. Probably by adjusting the camera. I'll look into that tomorrow.

Wednesday, March 12, 2014

Day 3 - First Unity Tutorial















Alright so i completed the first Unity tutorial today: project roll-a-ball.

I like the simple editor interface, the prefab system, the c-sharp editor and the documentation. Everything works well together and it's a pleasure to work with this editor so far.

Tuesday, March 11, 2014

Day 2 - Graphics.















I'm pretty happy with this drawing.

I like to have an idea of what kind of graphic the game would have from the start. It ties the setting with the game ingredients together. It's motivating, as i can picture the game better now. Also it gives a good sens of scale and rise some question for later about Unity, like how work the 2D art import flow? How do we create 2D animation?

Monday, March 10, 2014

Day 1 - A simple Goal.

Alright, you got to start somewhere.

I want to learn the basics of Unity. I'll use this blog to track my day by day progress. Let's define a simple achievable goal... 30 days to make my very simple first game with Unity. I won't commercialize this game... it's a personal project to get a good idea of how work the Unity 2D Editor. I'll probably put the game on download here eventually. So on Tuesday April 8th, i'll have complete my first game with Unity. Wish me good luck ^^

Here's the design overview :


TACO RUN!

A girl at the park play with her dog. She throws him a ball. TACO, her dog, run and jumps over obstacles to catch it. The girl throw the ball further. How far TACO can go?

Features

  • 2D Side scrolling Runner  
  • 2D graphics and animations (free-hand drawing)
  • One button Interface (play, jump, continue)
  • Dog behavior : run normal, run fast, analogic jump, HitPoints
  • Procedural level design, with a few ingredients : fragil obstacle (HP Dmg), Solid obstacle (Death), HP bonus (+HP or speed boost when HP full) 
  • Simplistic leaderboard (Best distance ever stored)
  • Generic Sounds to feedback gameplay 
  • Platform : Mac Desktop