Max Did It
Coding
,Thu
Post the First Comment
Tagged

Generate Procedural Motor Sounds in Flash

When developing a racing game like Rubberband Racing, you will need decent motor sounds. Driving a silent car just feels weird (Maybe it won’t 50 years from now?).

If I had a loop of a car engine, I could then change the volume and the pitch of the sound dynamically depending on the velocity of the car.

The MP3 Gap Problem

My problem was that usually, you can’t make clean loops and save them as MP3 files. Doing so will always introduce gaps into the audio file that will prevent it from repeating seamlessly.

If you are using Adobe’s Flash Authoring Software to save your MP3s in a SWF file, then you will be able to loop them, as the program uses a trick to avoid the gap introduced by the compression.

However, I am not using Adobe Flash and I am loading the sounds as single files during runtime, so I didn’t have that option.

Instead, I decided create seamlessly looping engine audio by creating it procedurally during runtime.

Read more…

Coding
,Mon
Post the First Comment
Tagged

Rendering Silhouettes for Concealed Objects

If you are creating a 3D game which gameplay requires the player to know the exact position of the character, then you have to think about what to do when the model is behind other objects.

You can either test whether the 3D object is occluded by other objects and then make the objects where this is the case transparent.

Or, you can save yourself the trouble of performing a raycast and use another trick which uses mostly GPU functionality to render an outline for concealed objects. Many games, like Torchlight 2, use this method.

Torchlight 2 Silhouette Effect

Source: Torchlight 2, ©Runic Games, Inc.

I wanted to implement the same mechanic for Rubberband Racing in Away3D, since the new track I’ve implemented has a lot of objects that can appear in front of the car.

Read more…

Coding
,Wed
Post the First Comment
Tagged , ,

Testing Rubberband Racing on Android Devices

Even though I am currently concentrating on developing and optimizing Rubberband Racing for desktop browsers, publishing it to mobile devices is an interesting option that I like to keep in mind.

Before I worked as an independent developer, one of my assignments was to test how fluent Flash games that have been ported to mobile devices ran. At that point, I was introduced to the AIR Development Tool for the first time, which, among other things, allows you to package SWF files as iOS or Android apps.

I fell back on that knowledge in the last couple of days to test how well the game would run on my Nexus 4. And considering that I barely changed or even optimized the desktop version of the game for mobile devices, the answer is: surprisingly well.

Rubberband Racing Title Screen on a Nexus 4

The title screen of Rubberband Racing on an Android Phone. (Click to enlarge)

Below, you will find a video of the game running on my Android phone and some details on how I packaged it.

Read more…

Coding
,Mon
2 Comments
Tagged , ,

Asymmetric Encryption with Flash and PHP

I have recently delved into the topic of encryption, since I wanted to send encrypted data from a Flash application to a PHP script. I had to implement this manually since I didn’t have the option of using HTTPS on my web space.

In this article, I describe

  • how to generate an asymmetric encryption key in PHP,
  • decode the public key in Actionscript 3 and
  • use it to encrypt data which is then sent and decrypted on the server side.

Asymmetric encryption works by generating two keys, the public and the private key. The public key is used to encrypt data, while the private key is used to decrypt data.

In my case, I generate the key pair on the server, sending the public key to the Actionscript client, while the server keeps the private key. This way, the client is able to encrypt data with the public key, but only the server can read the encrypted data with the private key.

Intercepting the public key doesn’t enable you to read the data sent by the client. This method is still vulnerable to man-in-the-middle attacks, since it still enables others to send their own encrypted data with the public key if they manage to intercept the communication between server and client. This means that there should be further authentication between server and client.

I am using the as3crypto library to encrypt the data on the Actionscript 3 side. Some missing features in the library still make it necessary to implement your own key decoding functionality. This is needed to actually use the public key sent by the server.

Read more…

Coding
,Tue
Post the First Comment
Tagged , ,

Testing Google Ads In Flash

I plan to pay my bills with the games I create as soon as possible. The first experiment I’m conducting in that regard is displaying advertisements within my games.

Is that a viable source of income for what I’m doing? What amounts of money can I expect to earn with ads? Will I be able to make enough money off this to finance a couple more games with the same business model or do I have to quickly move on to more promising ways of monetization?

Blank Billboard

©2011-2012 ~seraphunk

Basically, I’m about to make a similar step that Flash programmer and web developer Emanuele Feronato made five years ago. He started an experiment in 2007 where he tested how much advertisement money he could make with Flash games that took different amounts of time to develop.

He mostly used MochiAds, which I will check out as well. But for now, I want to see if I can get ads from the big one: Google’s AdSense.

Being a developer, one of the first things I want to know is how I implement Google ads into my game. This is how that went:

Read more…

Coding
,Sun
2 Comments
Tagged , ,

Hitting a Dead End with Facebook and Flash

I have made good progress the last couple of days. I learned a lot, and I got a lot of classes and neat features done. Too bad I won’t be able to use any of them in my upcoming game.

I managed to create a working implementation of the Facebook Connect button in Flash. And I would have gotten away with it, too, if it wasn’t for Flash’s meddling security features.

Dead End

©2004-2012 ~NoxxStock

The work I got done will not go to waste. I’m sure I will be able to reuse most parts of it in the future. But for now, I have to admit that I’ve hit a dead end. This is what happened:

Read more…

Coding
,Fri
Post the First Comment
Tagged ,

Inheriting From Ivy XML Files

I have now talked about how you can publish artifacts to your local repository and how Ivy resolves dependencies for your project.

As mentioned, Ivy uses the ivy.xml to know what files and libraries your project depends on. Ivy tries to retrieve these and will copy them into your project folder.

In another post, I have described how I keep my Ant build.xml files small and clean by putting targets I use often into central files. But not only build.xml files can contain information you need time and time again. Certain dependencies or Ivy settings might be used in many projects, and I don’t want to copy them around, either.

Matryoshka Dolls

© 2012 Max Knoblich


Maven has parent POM files, which are pom.xml files you can inherit from. All settings, dependencies, plugins etc. from the parent POM are used and can be extended or overwritten. With this, you can create a hierarchy of build files that you can combine as needed.

Ivy has a similar mechanism, though it is not as refined as Maven’s. Still, you can use it to put often used dependencies in “parent Ivy XMLs”.

Read more…

Coding
,Sat
1 Comment
Tagged ,

Resolve Dependencies With Ivy

In my last post, I wrote about how you can use Apache Ivy to automatically store your compiled components and libraries in a local repository. Now, why should you even do that? What’s the point?

The point is, that now you can use Ivy to

  • automatically copy the libraries you need into your project’s folder structure,
  • always retrieve the latest version of a library,
  • download libraries from remote repositories, provided you have access and
  • get dependencies that aren’t even in any of your repositories.
Ivy: Work, Work

“Work, Work”. Apache Ivy can take a bunch of manual tasks off your hands. © 2012 Max Knoblich

This is how I use Ivy to make working with libraries easier:
Read more…