I moved to a new URL! Check it out!

posts tagged with: gamedev

Dev Log: Slopes and Slopes

Dev Log: Slopes and Slopes
Still working on the re-make of my Global Game Jam game! The most recent development I can talk about is this:

Image


Image

Look at those beautiful SLOPES! I haven't actually done any platforming with slopes since all the way back in 2009 when I first made Jottobots (and before that, Verge.) This is my first time doing slopes of any sort in Flashpunk. There were a couple of hurdles to get over to get them working smoothly though.

Game Making Tools

Game Making Tools
Since I posted the time lapse video of me making a game for Global Game Jam 2013, I got a couple of questions regarding the exact tools I'm using for my game making needs. This is a pretty long post, so I'm going to put it all behind the jump tag. If you want to know my secrets, then click read more!

Flash Develop Pre-Build Command Line

Flash Develop Pre-Build Command Line
Last week I posted an asset generator script that will go through the contents of a folder and spit out an Actionscript class with static embeds for all of the assets. It's been pretty useful so far in my current project, but then I found a nifty feature of FlashDevelop that made it even better! Using FlashDevelop's Pre-Build Command Line option, I'm able to automatically execute my assetGenerator.py script every time I build my game, which means I don't even have to manually execute the script whenever I add content.

To hook it up in your project, just go to Project, then Properties in FlashDevelop. You should get a window with a couple of tabs across the top. Select the "Build" tab and you'll get something that looks like this:

Image

In that screenshot I've already added the command to run the script every time I build. The first part of the line is c:\windows\system32\cmd.exe which just calls up the command prompt in Windows. The next part is the /C which is a flag that is set on cmd.exe which roughly translates to "run the following command, then terminate." The last part is $(ProjectDir)/assetGenerator.py which is basically just telling cmd.exe to run that command. $(ProjectDir) is actually a special string that FlashDevelop recognizes, and will replace with the full path to the project. In my case I had to surround the command with quotes due to having a space in the full path.

I also checked the "Always Execute" checkbox... not really sure what that means, but as far as I know I want assetGenerator.py to be run every time I hit build, so I want that checked.

Right now this makes adding level content to my game even easier. Now whenever the game builds, the assetGenerator.py will reassemble my Assets.as class, and then my "Universe" class which manages the entire game world will look at everything in my Assets class with the prefix "LEVEL_" and assemble the interconnected game world out of everything embedded with that prefix.

I absolutely hate any sort of tedious work, like adding content to a game by hand and copying pasting the same line 100 times and modifying each line slightly... so if I can spend a few hours coming up with methods to spare me of those tasks then it's totally worth it in the end.

Asset Class Generator for Actionscript 3

Asset Class Generator for Actionscript 3

The Reason


As I set forth to try and jam out the rest of this metroidvania game before GDC 2013, I've been trying to think of ways to make content generation as fast as possible. One of the big hurdles that I run into with AS3 when making a lot of content is constantly having to embed assets into the code. FlashDevelop makes this incredibly easy though. Right click a file, click generate embed, and there you go. However this still takes a lot of time when I'm talking about a game that is going to have nearly a hundred level files and who knows how many image assets, and I'm constantly switching assets around.

After a quick consultation with Twitter I got a crash course on Python and spent a couple hours making assetGenerator.py.

Download!


Download assetGenerator.py 1.0, along with an example project right here. You can also just view the code. All the files in the example project are blank files just to use as an example, and keep the download size tiny. Here's an example of the code it spits out. If you want to know more, then read the rest of the post!

Dev Log: Some Bitmap Text

I guess I'll start calling these posts Dev Logs now? Yeah, that sounds good.

Image

The latest thing I've been chipping away at is handling bitmap text in my Flashpunk extended framework thing. There have been a couple of people that have posted Bitmap Font classes but they didn't do what I wanted, and I'm way better at coding my own thing from scratch vs. trying to modify someone else's code to do what I want.

Right now my bitmap text secret technology can do some cool stuff, like three different align modes (left, center, and right) which sounds pretty simple but it actually took me awhile to think of the proper solution for lining up text in a certain way. I also have some colored text as you can see in that awesome screenshot, and the way I do that is pretty cool (I think.) My code for coloring text ends up looking something like this:

//make da bitmap text
var bmpText:BitmapText = new BitmapText("This text will be #1GREEN!!#0 Yeah.", Global.bitmapFont);
//define the color "1" as green
bmpText.defineColor("1", 0x00FF00);

You can see a little bit how it works. I can define colors, which are assigned to certain characters (any Ascii character can be used) and then I can mark colors with a special character like '#'. Text after that character will then be drawn with a tint of that color. It's super easy to do colored words with this system, but it makes some other stuff pretty difficult.

One thing I still haven't figured out is how to escape the special character. Like if I wanted to actually display a '#' in my string, I don't have a way of doing that right now. I wanted to have '##' just escape out to a '#', and I was trying some fancy stuff with regular expressions for awhile but... yeah, things have not worked out yet. This is something I can probably just tackle later though.

Bitmap text comes in handy for a few reasons, and I think I'll make a more detailed blog post about that at some point down the road!

GGJ Game: Screenshot Saturday

GGJ Game: Screenshot Saturday
Still poking away at this Global Game Jam game I started last weekend. If you missed the timelapse, just scroll down a little bit and you'll find it, or just click here. Here's what it's looking like at the moment:

Image

I'm super excited about that minimap in the upper left hand corner. You have no idea how excited I am. I've been wanting to have a real time minimap in a game for so long but I've always been limited by my programming knowledge or the software that I was using to develop the games, but now I'm finally at the point where putting together that minimap on the HUD only took a few hours of work!

Another thing going on is the crazy blue splashes on the screen, which is actually just me testing my particle system. I don't seem to do particles like most people, and I prefer all my particles to be individual instances or objects in the engine... but this does mean some performance issues unless I have some sort of pooling system set up for at least the bitmapdata being used for each particle. I recently added a new parameter to my particles which is delay, so I can specify how long a particle should wait before it starts doing its thing.

I'm pretty happy with how particle and effects creation works in my latest iteration of my framework that sits on top of Flashpunk. Right now the code for creating those blue particles looks like this:

 //make dem blue rings
KParticle.spawn(level.mouseX, level.mouseY, C.EFFECT_RING, {
frames: [0, 1, 2, 3, 4],
lifeSpan: [20, 40],
delay: [30, 120],
center: true,
color: C.COLOR_BLUE,
scale: [0.5, 1],
layer: -5
});

Just to clarify a few things, the C.EFFECT_RING is just a reference to a string that I've used to pool the particles ahead of time, so the function here ends up looking for the next particle in the C.EFFECT_RING pool. "C" is just my big static class for all sorts of constants that I want to be able to easily remember.

As far as the yellow and red pixels in the middle of the screen -- those are some helpful markers to show me how my camera system is working. I just got some neat camera blocking stuff working (similar to Jottobots) but it's been so long since I've coded any sort of "advanced" camera stuff that I'm feeling totally rusty and it took me probably two days of thinking to get it working the way I want. I still have some other problems to solve with that, like how to get the camera to properly block around corners, but I'll get to that soon enough. A lot of the inspiration for this comes from games like Super Metroid where the game will hide areas from the player until the player crosses into them, and then the camera will adjust to reveal the new area.

That's it for now! Trying to just post more to my blogosphere in general, so I'm going to just try and post as much as possible for the next few weeks and see how it turns out.