All posts by Charlie Cliff

Coordinate Conversions

Last time, I held off on going over our method to add Platforms to our SKScene. The reason I did this is because I wanted to take some time to go over a bit of background before diving headfirst into the code.

This time I’m going to go over the coordinate system that we’ll use to place our Platforms.

The strategy that we’ll use is to break our SKScene into a grid. Every column of our grid will have exactly one Platform, so the width of our grid will be the size of our  Platform Buffer and the size of each square of our grid will be the size of our Platforms.

The trick is going to be finding a way to change the coordinates of our grid to the coordinates of our SKScene.

To do this, we’ll add two new methods to our PlatformNode  class:

- (CGPoint) convertGridCoordinate ToSceneCoorindate:(CGPoint)gridCoordinate {return CGPointMake(gridCoordinate .x * self.platformBrickTexture.size.width,
gridCoordinate .y * self.platformBrickTexture.size.height + self.platformBrickTexture.size.height / 2);}
– (CGPoint) convertSceneCoorindateToGridCoordinate :(CGPoint)sceneCoorindate
{return CGPointMake(roundf(sceneCoorindate.x / self.platformBrickTexture.size.width),
roundf((sceneCoorindate.y – self.platformBrickTexture.size.height/2)/self.platformBrickTexture.size.height) );}


These two methods will convert a CGPoint between the coordinate system of our grid and the coordinate system of our SKScene.

The Black Star

Te namesake and capital of the Hyperiad Empire is the Hyperion System, revolving around the remains of the main sequence star, Hyperion.


Before the founding of the Hyperiad Empire, the Hyperion star system was the capitol of the Titanic Hegemony, the ruling body of mankind. During the Astromachy, the Promethean Emperor waged a war against the Titanic Hegemony that spanned across the galaxy and culminated in the Hyperion Nova, when the Promethean Emperor forced the sun of the Hyperion star system to go Super Nova and then rapidly collapse in on itself forming a black hole. Most of the remaining Hegemony forces, as well as the majority of the remaining Titan, were dragged into the gravitational pull of the remains of the Hyperion sun, ending the Astromachy.

After stabilizing the remaining black hole, the Promethean Empire decided to establish his capitol in the remains of the Hyperion system, constructing several artificial satellites to orbit the gravitational singularity at the center of the system.

History of the Hyperiad Empire

After the Standing of Holdencourt, Titus Furius and his 13th Legion were left stranded deep behind the front line. Without support of Hyperion Command, Titus was forced to lead his Legion through 112 Lightyears of Hegemony occupied space. Throughout the 10,000 year long  history of the Hyperiad Empire, such a feat has never since been accomplished. The march of Titus Furius and the Abandoned Thirteenth has become almost as legendary as the rise of the Promethean Emperor.

-Tantillius Varus

A March Across One Thousand Suns

Buffing Up Our Platforms

Last time we built a quick class to get our scene moving, but that’s not particularly helpful until we have something to move. In this post, we’ll add a set of platforms to our scene.

This first step is to create a new class that sub-classes our ScrollingNode that we built in the last post.

#import “ScrollingNode.h”
@interface PlatformNode : ScrollingNode

This will ensure that whatever we add to this whatever we add to our PlatformNode will be able to scroll at whatever speed we decide, which was the point of our work in the last post.

Now that we have a class to get things started (or scrolled), we will build a way to keep track of a set of platforms.

One of the advantages of using a procedural level generator, is that it can lower our overhead when it comes to keeping a number of  large map or level in system memory. So, as we build our platform side-scroller we have to keep in mind that we want to limit the total number of platforms that our program will need to keep track of at any given time.

To do this, we’ll build a platform buffer to limit the number of platforms we track. Change our PlatformNode.h file as shown below:

@interface PlatformNode : SKScrollingNode
NSMutableArray *platformBlockBuffer;
@property (nonatomic) NSUInteger platformBufferSize;


What we’ve done is to add:

  1. A Mutable Array that can store any number of objects. We’ll use this to store our Platform Nodes.
  2. An Integer to track how many Platform Nodes we’ll keep track of.

The next step is to make sure these two variables get set up correctly; in our PlatformNode.m file, change our init method as shown below:

- (id) init
if (( self = [super init] ))
platformBlockBuffer = [[NSMutableArray alloc] init];
self.platformBufferSize = 10;// Generate the first set of platform tiles on the Ground
for (int i = 0; i < self.platformBufferSize; i++)
// Generate a New Platform
return self;


All this code does is to:

  1. Instantiate our Platform Buffer array.
  2. Set our Platform Buffer size to a default value (I’ve just used 10 here because it’s easy.
  3. Added a loop that will fill up our Platform Buffer.

Now all we’ll need to do is to come up with a way to Generate our Platforms, which we’ll do in our next post.

The Horatians


The Bridge of Piles almost afforded an entrance to the enemy, had it not been for one man, Horatius Cocles; he was the bulwark of defence on which that day depended the fortune of the Armies of the Hyperiad.

-Livia Auguria


The Familius Horatius is one of the more prominent in the Hyperiad Empire. Counted among the Twelve Greater Houses, the Horations carry significant political influence, and several of their members have risen to the rank of Consular over the history of the Empire.

The founder of the family, Horatius Cocles, was an accomplished military commander who led the defense of the Bridge of Piles, during which the Titanic Hegemony almost over-ran the Imperial Armies. But through his skill and bravery, Horatius was able to disengage from the battle and make an orderly retreat, saving the lives of many of his soldiers. Although his descendants have never shared Horatius’s military inclinations, the Familius Horatius has maintained one of the larger and more capable fleets in the galaxy.

A fleet that must either be destroyed or co-opted by any of the galaxy’s would-be conquerors.


If we want to build a procedurally generated level for a side-scrolling platform game, then the first step is to get it to scroll to the side.

Crazy notion, right?

This is a pretty easy task when it comes right down to it, and takes only a few lines of code.

To accomplish our task, we’re going to take full advantage of the way Sprite Kit handles it’s scenes. Every object in Spite Kit is basically a sub-class of the SKNode class, and every SKNode has a parent and a bunch of children, forming a hierarchy or tree.

So what we’ll do in order to get our platforms to scroll is to create a new class: an ScrollingNode that is a subclass of an SKNode.

@interface ScrollingNode : SKNode


We’ll have to manage some way of determining how fast we want our platforms to scroll right? So we’ll have to add a property to track that.

@property (nonatomic) CGFloat scrollingSpeed;


Since the only functionality that we really want from our ScrollingNode is to scroll (it is in the name after all), we’ll only have a single method, which over writes the update method that’s already present.

- (void) update:(NSTimeInterval)currentTime
[self.children enumerateObjectsUsingBlock:^(SKSpriteNode * child, NSUInteger idx, BOOL *stop)
child.position = CGPointMake(child.position.x-self.scrollingSpeed, child.position.y);

This method is what takes advantage of the SKNode’s design.

The only thing this method does is to enumerate through every child of our ScrollingNode, and move them by the scrollingSpeed that we’ve already added.

And that’s it.

…I told you it would be simple…

iAd Framework

One of the things we’ve been working on is incorporating the iAd Network into some of our applications.

In order to make our lives a bit easier, we’ve built a simple framework around it:

AdViewFramework here.

Feel free to give it a try!

History of the Hyperiad Empire

No one really knows where the Promethean Emperor came from.

Some say he was sent as divine punishment to the Titanic Hegemony for its overweening hubris. Some say has was the abandoned son of Kronos Deverin and sought the overthrow of the Hegemony out of a desire for revenge. Some say he was a slave that rose up to slay his masters. But really it does not matter from whence the Promethean Emperor came, only that he did.

-Plinny Primus

The Promethean Flame

Announcing: Project Red Sun


Project Red Sun is our latest project here at Electronic Graffiti, a space-themed strategy game focusing on optimizing a fleet of space ships as the player conquers the galaxy, all of which is optimized for phones and tablets.

We her at Electronic Graffiti are quite excited about this project and are really looking forward to sharing with you our progress throughout development.

Stay Tuned!

History of the Hyperiad Empire

Not all of the Twelve Great Houses have held their position since the foundation of the Hyperiad Empire. As Families jockey for influence and position, it is not unheard for a Major Family to lose favor or for a Minor Family to ascend the social ladder. Such families are called the Familia Novae.

-Plutarchus Maximinius,

The Rise of House Severan