Max Did It
Coding
,Wed
Post the First Comment
Tagged

Polygon Outlines With Uniform Inset

I want users of my hardware text rendering library firetype to be able to render characters with outlines.

Sounds simple enough, right? Adding an outline to text is a matter of setting a simple value in all major graphic softwares. Since firetype is able to retrieve the shapes of characters from font files, it should not be a problem to add an offset to these and render the result.

Turns out that adding an outline to a simple polygon is not as straightforward as you might think. In fact, to have a robust method of creating polygon outlines means to implement a relatively complex algorithm that encompasses several steps.

Even seemingly minor details like how far each vertex has to be moved to create the outline can create problems. The solution, however, is pleasently elegant, as you will see below. I will cover the other aspects of the outline algorithm in the next posts.

Read more...

Coding
,Thu
Post the First Comment
Tagged

How To Properly Render an X-Ray Silhouette Effect in Away3D

Back in February, I published an article which described how the silhouette/X-ray effect works that is used in some games for concealed objects. In the first half of the article, I described the principle behind the effect, in the second part I described how to implement the effect in Away3D.

This is a follow-up to that article, introducing a more elegant, improved way to implement the effect in Away3D.

Rendered Silhouette (XRay) Effect in Away3D

The method described in the original article involved complicated geometric transformations and sharing the 3D context between several separate View3D objects.

The version shown in this article only requires a single class containing a few methods and a single View3D.

Read more...

Coding
,Mon
Post the First Comment
Tagged , , ,

Rendering Text In Flash Via The GPU

In this article, I want to look at what options you have for rendering characters and texts in Actionscript projects using Stage3D.

I also want to introduce my latest project, the firetype library, which lets you render hardware accelerated texts in Flash in a similar way to Scaleform.

Steps In Using firetype

Rendering Text In Stage3D Projects with On-Board Features

I'm trying to use the current Flash Player's 3D abilities as much as possible to implement higher quality and more fluent graphics in my games.

However, there are certain cases where Stage3D is not on par yet with the classic software rendering features of Flash.

One thing that bothered me while developing both Satellite and Rubberband Racing was the unwieldy way of displaying texts in a project relying on Stage3D to render its content.

Read more...

Coding
,Thu
1 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
5 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...