[Book Review] Unity iOS Game Development Beginner’s Guide
While going through this book, I tried to imagine myself as a beginner with little to no previous experience with Unity. With that perspective in mind, I felt like I came away with little to show for my time invested into this text. That isn't to say there wasn't useful information to help one get started out. However, there just didn't seem to be an appropriate pacing or coherent order of material to help me feel confident when continuing with Unity.
To the book's credit, I never felt like it was swamping me with too much information at once. It stayed reasonably comfortable to follow along with and had me never feeling completely lost. But again, the general topics covered seemed to jump around with little warning, at times feeling like a wild ride through someone's last minute check list. I had a difficult time anticipating where the instructions were going to inevitably lead me, and it offered myself only a slight sense of being an active participator in its exercises.
An example to help relate the book's textual inconsistency is revealed by the fact that quiz questions are given at the end of the first two chapters but fail to appear in the following chapters. This may seem trivial, but it is an odd pattern to begin with and to suddenly drop. And just so everyone knows, I love quiz questions at the end of a chapter! :D
I wish the book spent less time on how to use third party plugins and more time going through real world examples of how to achieve varied control styles or game mechanics tailored for iOS devices. I believe it could have benefited from including such a topic as raycasting, something which I considered vital for my own projects, as the iOS version of Unity does not recognize user input on game objects like the PC or Mac version. For example, the OnMouseDown() callback is not recognized on game objects for iOS, thus requiring raycasting to be used inorder to directly interact with objects when touched.
I found too many subjects just briefly touched upon. Some chapters have a sense of being incomplete and not following through with teaching the functionality promised in the book's advertisement. I wouldn't be so bothered by this fact if the book didn't advertise itself with overhyped expectations.
Being somewhat of an experienced Unity user, I was satisfied with some useful morsels of information which I gleaned from this book, but I am glad that I have the experience already behind me to fill in the blanks that I felt were missing on some subjects.
If you are a fledgling beginner with Unity and iPhone development, this book might be okay to start with. Despite its shortcomings, I still found myself able to get through it quite easily and learn some new things along the way. But, don't expect it to make you a whiz or even leave you with a well rounded knowledge of Unity basics. Expect further books, tutorials, and hands on experience to fill in the other basic concepts you will need to know along your adventures.
FINAL VERDICT: 5/10
[Game Maker] Grid Movement -PART 2- Collision Detection
Accompanying video tutorial. Suggested to watch in fullscreen at quality of 480p or higher:
NOTES
***
If you have not already done so, I highly suggest going through Part 1 of this tutorial series as what follows will be based upon its existing code. Links to other lessons can be found here:
Part 1: The Basics
Part 3: Character Animation
An editable gmk for this lesson can be downloaded here: Part 2 Download
***
1) Create a new object, naming it obj_grid
2) Create a new object, naming it obj_block
3) Assign obj_block a 32x32 sprite
Our obj_grid instance is going to manage our grid's collision information. It will initialize and hold a 2-dimensional array for storing locational information in our rooms. We will use the number 0 to represent an empty location, and the number 1 to represent a wall
4) Inside obj_grid, Add Event -> Create
, then add a piece of code
containing:
var i, j; // Not required but helps speed up 'for loop'
// Use the room's height and width divided by grid size (32) to
// initialize grid with 0
for (i = 0; i <= (room_width div 32); i += 1)
{
for (j = 0; j <= (room_height div 32); j += 1)
{
cells[i,j] = 0;
}
}
// This 'with()' statement will cycle through all obj_block instances
// within our rooms and use their relative x/y properties
with(obj_block)
{
// Use block's x/y divided by grid size to set relative location
// in cells[x,y] array to 1
other.cells[x div 32, y div 32] = 1; // 'other' refers to obj_grid
// For performance, we can remove the instance
instance_destroy();
}
Now we are going to add some conditionals to our keyboard_check() blocks from part 1 to see if the corresponding direction next to our player is free. The code to be added will be marked by the comments '// <- ADD'
5) Inside obj_player -> Step
-> piece of code
, modify to match:
if (isMoving == false)
{
if (keyboard_check(vk_right))
{
if (obj_grid.cells[(x div 32) + 1, y div 32] == 0) // <- ADD
{
isMoving = true;
moveTimer = gridSize;
speedX = moveSpeed;
speedY = 0;
}
}
if (keyboard_check(vk_up))
{
if (obj_grid.cells[x div 32, (y div 32) - 1] == 0) // <- ADD
{
isMoving = true;
moveTimer = gridSize;
speedX = 0;
speedY = -moveSpeed;
}
}
if (keyboard_check(vk_left))
{
if (obj_grid.cells[(x div 32) - 1, y div 32] == 0) // <- ADD
{
isMoving = true;
moveTimer = gridSize;
speedX = -moveSpeed;
speedY = 0;
}
}
if (keyboard_check(vk_down))
{
if (obj_grid.cells[x div 32, (y div 32) + 1] == 0) // <- ADD
{
isMoving = true;
moveTimer = gridSize;
speedX = 0;
speedY = moveSpeed;
}
}
}
With this work done, we can now set up our room with walls to run into. Before doing so, make sure you have a 32x32 background tile to represent as a wall.
6) Go ahead and add the wall tiles to our test room, anywhere you like, making sure to use a 32x32 grid size in the room editor's settings.
7) Place obj_block instances on top of the tiles you just placed
8) After selecting the room's 'Settings' tab near the top, find and click the button titled 'Creation code'. Once doing so, add this code:
instance_create(0,0,obj_grid);
There! Making sure you have obj_player in the room, go ahead and run your level. Your player should now properly detect the walls you have set out. Notice that the actual wall instances are removed, and only the more efficient background tiles remain.
Again, feel free to contact me with any comments or questions.
Happy coding!
[Game Maker] Bettering 4-Direction Player Movement
This tutorial assumes you have some experience with Game Maker's scripting language, GML.
However, even if you are unfamiliar with it, you should still be able to follow along and find this useful if you take the time to understand it.
Controlling a character in any game should be as intuitive as possible for the player.
Thus, control should function in a predictable manner and avoid any little quirks that could arise and leave your player falling down an endless pit.
One small quirk I'd like to address here revolves around 4 direction character control, and the issue of key direction input/release dominance.
To help illustrate this issue, play around with the character in this example:
BAD CONTROL EXAMPLE
Take note of what happens when you have one direction held and then press down another while holding on to the first direction. Then, try holding down the second direction first and press down the original direction afterwards. Do you notice anything odd?
If you play around with the rest of the directions, trying the different combinations of starting with one direction and then pressing and holding another, you will find there are keys with dominance over other keys. It doesn't care which key was pressed last, but only which key returns true. But if more than one key direction returns true, it simply takes the first key returning true and uses it.
We will now look at one solution for this issue.
Note: This solution includes both ARROW/WASD key movement.
1) Start a game maker project and create an object called obj_input and set it as persistent
2) Inside obj_input, add Event -> Create 
3) Inside the Create event, add -> Code
for initializing a few global variables
globalvar g_keyDirection, // holds value for active direction key pressed g_keyDirectionIsPressed, // is true when direction key first pressed down g_keyDirectionIsReleased; // is true when direction key is released g_keyDirection = -1; // initialize as -1 to ensure no initial false input g_keyDirectionIsPressed = false; g_keyDirectionIsReleased = false;
4) Inside obj_input, add Event -> Begin Step 
5) In this event, add -> Code
to check for the last direction pressed and set g_keyDirection/g_keyDirectionPressed accordingly:
// First, clear global Pressed/Released states
g_keyDirectionIsPressed = false;
g_keyDirectionIsReleased = false;
// Second, Check for ARROW or WASD presses
if (keyboard_check_pressed(vk_right)
or keyboard_check_pressed(ord('D')))
{
g_keyDirection = 0;
g_keyDirectionIsPressed = true;
}
else
if (keyboard_check_pressed(vk_up)
or keyboard_check_pressed(ord('W')))
{
g_keyDirection = 90;
g_keyDirectionIsPressed = true;
}
else
if (keyboard_check_pressed(vk_left)
or keyboard_check_pressed(ord('A')))
{
g_keyDirection = 180;
g_keyDirectionIsPressed = true;
}
else
if (keyboard_check_pressed(vk_down)
or keyboard_check_pressed(ord('S')))
{
g_keyDirection = 270;
g_keyDirectionIsPressed = true;
}
Okay, this is great, but what about key release variances? If a player has two keys pressed and releases one of them, it should always return the direction to the remaining key held.
6) Add the following code below the code we just wrote in the Begin Step event
// Third, Check for ARROW or WASD releases
if (keyboard_check_released(vk_right) // Arrow keys
or keyboard_check_released(vk_up)
or keyboard_check_released(vk_left)
or keyboard_check_released(vk_down)
or keyboard_check_released(ord('D')) // WASD keys
or keyboard_check_released(ord('W'))
or keyboard_check_released(ord('A'))
or keyboard_check_released(ord('S')))
{
g_keyDirectionIsReleased = true;
g_keyDirection = -1; // Make sure to clear this first
if (keyboard_check(vk_right)) g_keyDirection = 0; else
if (keyboard_check(vk_up)) g_keyDirection = 90; else
if (keyboard_check(vk_left)) g_keyDirection = 180; else
if (keyboard_check(vk_down)) g_keyDirection = 270; else
if (keyboard_check(ord('D'))) g_keyDirection = 0; else
if (keyboard_check(ord('W'))) g_keyDirection = 90; else
if (keyboard_check(ord('A'))) g_keyDirection = 180; else
if (keyboard_check(ord('S'))) g_keyDirection = 270;
}
There, once you have added obj_input to your game's starting room (remember to make it persistent!), you should now be able to have any object in your game access the g_keyDirection variable and set its movement accordingly. You also have access to g_keyDirectionIsPressed and g_keyDirectionIsReleased for when you need to use those states.
For example,
7) Create an object called obj_player
8) Inside obj_player, add Event-> Step
containing -> Code
for moving the player accordingly
// Set speed and direction when key pressed
if (g_keyDirectionIsPressed)
{
speed = 4;
if (g_keyDirection == 0) direction = 0;
if (g_keyDirection == 90) direction = 90;
if (g_keyDirection == 180) direction = 180;
if (g_keyDirection == 270) direction = 270;
// Or simply...
// direction = g_keyDirection;
}
// Set speed and direction when key released
if (g_keyDirectionIsReleased)
{
if (g_keyDirection == -1) speed = 0; // Stop if no direction pressed
else if (g_keyDirection == 0) direction = 0;
else if (g_keyDirection == 90) direction = 90;
else if (g_keyDirection == 180) direction = 180;
else if (g_keyDirection == 270) direction = 270;
}
Now, the second direction key pressed will always be dominate when two keys are pressed down, and when a direction key is released, the remaining key pressed will take over as one would hope.
The character movement should now be like this:
BETTER CONTROL EXAMPLE
Again, notice the difference when compared with the BAD CONTROL EXAMPLE
You can download the completed example gmk for Game Maker here:
[Windows Version]
DOWNLOAD
[Mac Version]
DOWNLOAD
If you have any questions or comments, feel free to contact me!
[Epic Tic Tac Toe] Released for iOS (Free)
After what has felt like years of development (maybe it has been) I have finally released my first game for iOS devices.
See here: Epic Tic Tac Toe on iTunes
Work on the game began early this year, but despite its apparent simplicity, many discouraging frustrations surfaced. I had to learn a new engine (iTorque 2d) and the ins and outs of working through Apple's process for publishing a game to their service. All of this was completely new and at times confusing. These things mixed with pockets of lacking motivation and haunting distraction really made this process painstakingly tedious.
But, what was truly accomplished?
1) A game was actually completed from start to finish!
2) I learned how to register and form an official business with my friend Cody Penner (DagurDragon.com)
3) Improved skill at working with engines at both the high (scripting) and low (programming) levels.
4) Maintained persistence and worked towards completion, even when unmotivated.
5) Established a foundation for further games (hopefully even more epic) to be released.
And now its time to see how yet another tic tac toe game is received out there. But I do believe it does have its own unique charm which should help it shine above the plethora of others.
Epic Tic Tac Toe can be downloaded for free from the app store.

Canadian Videogame Awards
So, tonight I attended the Canadian Videogame awards. I just found out about it recently, so it was a mad rush to register and get myself organized to go.
It has been a great night of seeing Canadian talent displayed in the gaming industry.
There was also amazing music performed the Videogames Live Orchestra. I was especially impressed with who sang a Tetris Opera, I will have to get her name later... just amazing.
This has been part of my start to get a up close experince with othere people involved in the industry, and a chance to improve my networking skills.
However, tonight felt like a primer for the Canadian Developers conference happening over the next cople of days...
I shall write on that later.
Btw, please forgive my many typos, im typing on my phone.
