May Project – Bottles

bottles_banner

It’s been a while since I’ve done a project update (a month roughly), so I thought it’d be best to post something rather than nothing at all. So here it is my “unpolished” demo Bottles it was basically finished at the end of last month but was missing a key element and I couldn’t let it go without fixing*, so that’s why there was no update last month. In the meantime while waiting on helpful feedback from the people on the Starling and Nape forums I’ve also been working on a level editor for Flat2D which is functional but nowhere near finished so I’ll try to get it out by the end of the month (no promises) as well as an update to Flat2D which should include my ‘Fragile’ class which is used in this demo for the fracturing of entities with polygonal shapes.

So Bottles! this is really just a more improved version of the March project with a few more additional features:

  • The fractures now occur relative to the point of impact.
  • The fracture now works on concave and convex shapes.
  • The amount of pieces produced are relative to the impact force.
  • *The Image from the original entity is cut up appropriately for the child entities.
  • The entities produced from the fracture can be fractured again.

Didn’t quite get the last one unfortunately, it works fine apart from a bug where the 3rd-generation entities produced from a fracture seem to be incorrectly placed when being added back to the world. I think it’s something to do with the way I’m handling the aligning of the Nape bodies. Click the link below to give the demo a go:

Bottles Demo

Before I go back to working on the level editor I’m going to try and polish the Phluid and Bottles Mobile Demos and try to get them on the Google Play Store and if I can’t or it takes to long for approval I’ll just post the APKs on the site in the coming weeks.

Mochi Scores API Insecurities

Last month’s project is going to be a little late so I thought to make up for it I’d post some interesting info I got sent to me awhile back by a fellow CMP student (Tom Le Cornu) at UEA. He managed to hack the Mochi Score API in one of my games allowing him to post fake scores to the high score board.

Encryption: you’re doing it wrong!

Okay, so, here we go…

This is a game online: http://caffeinatednightmare.com/blog/evocannon/
From a fellow CMP student.
(click the “Evocannon” link mid-way down the page.)

The high score was 1 million or something. Too much time would be needed. So,
let us use them skills.

When you die, you can submit your score. Using Firebug you can see that a HTTP POST request gets sent to scores.mochimedia.com. Cash monies. So if you use tamper data or something similar, you could change the score! Win! But wait…

Here’s a sample capture:

It’s encrypted. So we have an MD5 hash and RC4 encrypted data.

Okay, so we need to get the key for the encrypted data, decrypt it, alter it, presumably hash it, then create a crafted POST request then send it.

So I decompile the game and after a bit of sifting, I see that the Mochi media company have their own API for doing stuff with the leader boards and whatnot.

The call to update the leader board uses this function call:

Which in turn calls this function:

However, there was nothing of interest in this file. But then, by chance, I see this at the top of the MochieServices file:

So, I go the “services.swf” file and I’m presented with a pink screen. Not very useful so I decompile it. To find what I’m looking for I search for “RC4″ in the text and this pops up:

The encrypted RC4 data is just some JSON stuff encrypted with the key and the MD5 is a hash of the data and the key. But where is the key?

Maybe they used SSL.
Maybe they used TLS.
Maybe the generated it randomly.

Or maybe, just maybe, it was in the source code. And thus, without further ado:

static var _key = “REDACTED”; (I’m not going to actually publish the key.)

I can decrypt data, create the correct the hash, but how to actually do the attack? Well, I
wrote a socks server a year or so back that comes in handy every now and then.

So I alter the code to change the name and score, encrypt it all, hash it properly, then send
it as if nothing happened.

And thus, two hours later, Unroc El Mot, with a score of 2,000,000 is at the top of the leader-board.

Disclaimer. This is absolutely nothing to do with the creator of the game, or an attack on his person. But to do with the software provided by Mochi media.

It’s all good and well using encryption, but sheesh, don’t put the key in the code!

- Thomas Le Cornu

March Project – Shatter

shatter_banner

It’s been one hell of a busy month at work I’ve moved off doing bet histories and started porting my first game to a new platform, so it’s been a mad rush trying to finish fixing all the bugs that were assigned to me. As a result I haven’t had much time to work on this month’s project which was to implement breakable objects using my engine Flat2D.

There’s a lot of stuff I didn’t get to add e.g. concaved polygons, textured polygons, slicing (Fruit Ninja Style), impact shattering, and irregular shattering. So I may work on this in between work and next month’s project. Once it’s all polished up I might even push the feature to github. My other main concern at the moment is getting my engine to dispose properly when switching between states, the main culprit being Nape at the moment so I’ll also try to look at that as well this month.

Shatter Demo

Controls:
Pause: P
Reset: R
Debug Draw: D
Shatter Entity: F + Click
Select Slices: 1-9

February Project – Phluid

phluid_banner

This month I’ve been working on simulating liquids using a different physics engine called Nape and Starling/Stage3D. I used a similar approach to an example I made roughly this time last year using the Box2DFlash library and the built-in Flash Graphics API. I found I could get a lot more particles on-screen without too much lag using Nape instead of Box2D (especially on mobile) which was what prompted the switch from Box2D to Nape on my Flat2D game engine, however both the Nape and Box2D versions are available on GitHub under their relative branches. The Nape version has also now been merged into the master branch as it is clearly more efficient.

To achieve this liquid-like effect I would create a single texture from a bitmap of a blurred blue colored circle created at run-time  Then when I create a particle I set it’s view to an Image created from this Texture, this saves a lot of memory as every particle uses a single Texture. However this has a few disadvantages as it means all the particles have to be the same size which can detract from realism of the effect.

All the particles are added to a single Starling Sprite to keep them separate from the rest of the layers. Then I apply a Threshold Filter that I got from Andy Saia’s blog to this Sprite and fine tune the tolerance to get a convincing effect.

Phluid Demo

I also thought it’d be cool to see how the demo performed on my mobile (Samsung Galaxy SIII LTE) so here’s a video of it running relatively smoothly (for a AIR Mobile application). I also enabled the accelerometers to modify the world gravity, making it quite the executive’s toy.

Phluid Mobile Demo

Controls:
Drag Water: Mouse / Click
Reset Simulation: Backspace
Toggle Debug Draw: D
Toggle Filter: F
Pause: P

January Project – ParaLayer

ParaLayer Banner

ParaLayer is the first game produced for my monthly game jam, I had to rush to get this game finished for this month so it’s a bit buggy and rough around the edges.

This game is just a prototype for gameplay mechanics based around a “Flatland” like universe, where the player could interact with parallel 2D universes (layers) and the objects within them.

Box ‘H’, is you the “Hero”.
Box ‘P’, is a “Phase Box”, exists and moves when you’re in its relative layer.
Box ‘F’, is a “Freeze Box”, exists in all layers but only moves when you’re in its relative layer.
Exit, your objective is to get the “Hero” to the “Exit”, which only exists when you’re in its relative layer.

ParaLayer

Controls:
Move Left: Left Arrow
Move Right: Right Arrow
Move Up a Layer: Up Arrow
Move Down a Layer: Down Arrow
Jump: Space
Reset Level: R
Pause: P

Flat2D

Flat2D Logo

https://github.com/SyntheCypher/Flat2D

I’ve decided to make the AS3 game engine I’ve been developing for awhile using using Box2D, Starling, and Signals open source. So it’s now available on GitHub for anyone to download and try it out. Some of the features include and ability to import bodies from PhysicsEditor using the AndEngine Exporter (XML).

Also easy to use utilities such ContactManager and KeyManager that use Signals:

I’ve also started my new year’s resolution to make a playable/functional game every month. I’m using this as an opportunity to get use to finishing a project and start producing more material for my portfolio. Also it’ll give me a chance to prototype ideas and game-play mechanics that may be used in later games.

Also a special thanks to Andreas Löw for giving me licenses for both of his brilliant applications TexturePacker and PhysicsEditor ideal if you’re developing a game for the mobile platform. I’ll should be writing a tutorial soon on how to use Flat2D in conjunction with PhysicsEditor sometime in the near future.