Archive for the ‘ game development ’ Category

Getting started with HaxeFlixel

With Haxe gaining so much popularity, flash work declining and my want to make 2d games with a language I’m already fairly familiar with that I can publish to multiple platforms, I’ve decided that Haxe is the right move. With that decision I had to pick a game engine and it was really between Flambe or HaxeFlixel.

Since I don’t care about a html5 target and I feel slightly more comfortable in the HaxeFlixel API, I have decided to use it.

Getting started is actually pretty easy but there were a few points that tripped me up slightly. The official documentation for installation is actually spot on. Check it out here.

Once installed, you need some more of editor/IDE. Since I’m developing on a Mac, I have pretty limited options. Since the IntelliJ plugin is wonky at best, I’ve gone with Sublime Text.  When setting up Sublime I was easily able to set up the plugin following the instructions but could not for the life of me get it to actually get it to highlight or code complete.

The issue was the instructions I was following didn’t point out the need to set up some path variables.  The easiest way to do this is to add these variables to your .bashrc

In your home directory (~/) run nano .bashrc . If you have this file it’ll open it, if not it will create it. Then add this:

export haxe_path="/usr/bin/haxe"
export HAXE_LIBRARY_PATH="/usr/local/lib/haxe/std:."

Exit and save.

Once you have all your libs set up for HaxeFlixel you want to add a symlink to the subl command in Sublime. This will allow HaxeFlixel to open the project for you when creating new projects.  There are official instructions on this but it didn’t work for me.  My path was slightly different :

ln -s /Applications/Sublime\ /usr/bin/subl

And that there covers the initial setup issues I encountered. I’ll likely post more findings as I learn more of HaxeFlixel. I actually never used Flixel before, but have several years of Flash development behind so most of my findings will likely be differences from Flash to Haxe .


Moving from Actionscript to Unity one of the things I missed the most was a framework like Robotlegs that has been the base for any as3 project I’ve done in the last year or two. Recently a buddy at work discovered StrangeIoC and I must say, it is awesome.  If you haven’t used and IoC framework before you should really check it out.

Anyways, if you are familiar with Robotlegs then this is definitely for you since the API is very similar. So similar in fact that a guide for RL users exists!

Give it a shot. It’s bloody awesome

Unity development – 3rd party tools I couldn’t live without

For the last few months, I have primarily been doing only Unity work and have come to rely on a few third party tools every day:


  • Generate 2D vector graphics inside Unity Editor with bézier splines
  • Fully adjustable colors and gradients + emboss styling
  • Multi-texturing with easy texture positioning
  • Automatic physics collider generation with BoxCollider and MeshCollider options
  • Adjustable vertex count for visuals and physics.
  • Grid & snapping gizmo for accurate drawing
  • Good peformance on iOS/Android
  • RageSpline API for run-time code access


2D Toolkit provides an efficient and flexible 2D sprite and text system which integrates seamlessly into the Unity environment. Our key focus with this product is mobile performance and workflow efficiency.

2D Toolkit is designed for rapid prototyping, and is built to take you all the way to a shipping game.


NGUI is a powerful UI system and event notification framework for Unity (both Pro and Free) written in C# that closely follows the KISS principle. It features clean code and simple, minimalistic approach to everything. Most classes are kept under 200 lines of code. For a programmer this means a much easier time when it comes to working with the kit — from extending its functionality to tweaking the existing one. For everyone else this means better performance, less frustration, and more fun.

Bonus! Playmaker

This is possibly the most powerful tool I have used to date in Unity, but I haven’t been able to explore it as fully I would like to. In short, it’s a FSM that can easily hook into all aspects of your application. It allows the developer to quickly and visually create easy light switches to complex AI.

What is the best way to achieve a Flash/Unity app with shared Nodejs server?

Over the last week or so I have been looking into creating a shared nodejs server that has flash and unity interfaces. I’m still rather new to nodejs so this is a post to ask a question; I’m considering creating a JS file that flash and unity communicate to using external interface calls instead of putting the communication layer inside of the application.

My question is, is this an acceptable approach? One of the reasons I’m considering this is because it seems to be a pain in the ass in Unity to achieve this.

Let me know what you guys think!

Lantern's Market

I would like to explore and get some thoughts out of my head on this topic.  But before I get too far into this, I should first explain a little about Lantern’s item system, crafting, questing, rare items and in general how they are collected.

A feature that hasn’t been fully scoped out yet, but roughly exists in my head is the crafting system for lantern (another post later) which will rely heavily on a rather different stat system, but that’s another post as well. The crafting system will be similar to that you find in many other games when it comes to the end result. Players will be able to create items from raw materials to sell. The big difference is if I make a sword and you make a sword, these swords could end up being very different.  The quality of the sword, it’s bonuses and other attributes will depend on the maker. For the market this means that items won’t all be priced the same and players will need to figure out what is attributes are  valued when making and buying certain items.

The next interesting note is there will only be a handful of NPC’s that sell items. Most of the items in the game will end up being player made.

A third factor is that this game will maintain a living universe. This means that rare drops from a certain boss/challenge will likely only happen the once. This means there will actually be items in the game that only one person will ever have.

Fourthly with monsters having limited to no drops a player will almost be forced to play the market to make money. That’s right. No grinding for loot. You can grind for everything else but that 😛

And finally, markets will be localized. What I mean by this is that if you put an item for sale in a town ‘a’, those in town ‘b’ can’t see it. The issue with this, if I want the system to remain logical, is how the player can have an item on sale in town if they aren’t there? A few story idea’s have crossed my mind, but the one I think I’m going to go with is a group who offers you handle sales of items for a small percentage.

With all these different factors, my intention to allow the market to have the freedom to grow as it will (no imits on prices),  all players being able to craft to some extent and the ability to have players run a monopoly, I believe this could be a very interesting system.

Lantern Map

Look at this awesome map! Look at it!

This is a rough map I made in a few minutes for my friend William aka jetfx ( William is a cartographer, a world builder freak and an aspiring author. He will hopefully be helping me with my maps and story for Lantern as we move forward. Whenever he has a better map that the pretty epic one I drew, I’ll post it for you all to see.


William, being pretty damn quick, thought my map looked too crappy to share so he cleaned it up for me as you can see. I decided to leave mine so you can see how much better he is and why I’m pretty stoked he’s agreed to help.

Random Encounters

Progress on Random Encounters, a mini-game of sorts that I am using as a test bed for some of my Lantern concepts, is slowly trucking along.  The game engine along with it’s content creation tools are almost complete. Skinning hasn’t been thought about yet, but the game itself is close.  Something that I need to do and haven’t yet is find a *cheap* host that will allow me to install mongo and nodejs.  Emphasis on cheap as I am broke.

Random Encounters for me is a test for mongo, some simple js. though the initial build won’t have it and some gameplay concepts that aren’t nessicairly related to lantern but ones I am playing with.

The game will constantly be in beta and will be my playground for new idea’s and tests.  After the current road map I have in mind is complete, which I will write down and post later, I will likely publish all the code for people to use if they have the urge to host a crappy game.

Anyways, here’s a little snippet of code for mongo to get a random record that took me a while to get working.

$numOfCreatures = $collection->count();
$ranCreatureId = floor(rand(0,$numOfCreatures-1));
$ranCreateObj = $collection->find()->limit(-1)->skip($ranCreatureId)->getNext();

Windows + VirtualBox + Ubuntu + nodejs = hooray!

As I’m sure some of my readers (all four of you) may know because of the IRC room, I’ve lately been trying to get nodejs running on a virtual machine (ubuntu since nodejs doesn’t like windows and I don’t want to virtualize osx) that is accessible from my host (windows) so I can use it for Lantern. Well I had a few minutes tonight to sit down and do some reading and I figured it out, hence the post so I don’t forget.

I’ll go right from step one in case anyone else is trying to do this with no prior knowledge 😉 I should also mention if you’re on *nix you don’t need to do this.

  • Get virtualbox
  • Get Ubuntu (or whatever distro tickles your fancy)
  • Install a vm of ubuntu
  • Download nodejs on vm
  • Config/Make/Install – I had to install g++ and cmake to get it to build properly
  • (The tricky part) On your host (windows) navigate to your virtualbox installation via command – something like this : C:\Program Files\Sun\VirtualBox\
  • Run these commands :

VBoxManage.exe setextradata “ubuntu2” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol” TCP
VBoxManage.exe setextradata “ubuntu2” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort” 8000
VBoxManage.exe setextradata “ubuntu2” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort” 8000

  • Launch your vm, start node js and on your host in a browser go to localhost:8000- HOORAY!

So here’s what I know about the commands what you need to edit to make it work

  • Instead of “ubuntu2” use the name of your vm.
  • the guestssh isn’t important. Just a name use to group the settings. Call it whatever you want.
  • Guest and Host ports are the port you want to access on your vm.
  • If you change you’re installation at all from the default you’ll have to figure out the other changers yourself here :

Good luck ^^

Lantern Update

In my last post I was discussing Lantern’s combat and party system. These two features are very closely related to the map, which is going to be the main area of action in Lantern, so I have been thinking a lot about how to approach this map. I think from some discussions I have had with people in the #bbg irc room and with a few coworkers, I’m going to try to use nodejs for handling the communication and npc logic. From my understanding of nodejs (which is very limited so please correct me if I’m wrong) I can use it to push data to players that need it and create objects at run time on the server and run based on a timer. What I’m looking to do with this functionality is to run the npc’s logic independant of players input.  I’m pretty sure nodejs will allow me to do this. All I need to do is set up linux on a virtual machine and get everything all playing nicely together so I can continue to develop on my local machine.

But as I work on Lantern and think about, the need to a test bed is becoming more apparent to me. So to fix this need I’m going to take a quick break from Lantern to make myself a small game that I can use to test different parts of Lantern. This will range from Mongo scripts to game tools (for creating quests/items/etc). The scope of the test bed currently is very limited to the mongo scripts and the game tools. If I can think of a way to test nodejs in this that would be great, but for now, just testing some idea’s around those other elements would be enough. This small game test bed will be call Random Encounters. The game is exactly what it sounds like. You click a button and you encounter things. The game will suck, but it’s purpose is testing.  This small game will hopefully be online in the next few weeks. Work has be pretty busy of late, so I haven’t been able to look at anything lately.

So that’s where I am. If anyone can confirm or deny my thoughts on nodejs that would be great.

Lantern Combat and Party System

The time has come, the walrus said, to speak of many things: of swords and clubs and player groups, of adventures and rings… Ah to hell with it. Let’s talk about how to create a party system for pbbg’s that doesn’t require players to be online, but is still interactive and fun, and killing things!

The thought of a party system is by no means a new idea. The challenge arises when you try to apply the principle to an environment where players won’t be online when actions concerning them will be occurring. What I mean is that if a party of six players are on a quest, there’s a good chance a when one player logs on, everyone else is offline. What will this player be able to do if they are a member of a party? Can they move the party? Will they be able to move around themselves but remain a member of the party? If so, will their gains be party gains?  And then we have party combat; Will the leader direct each member or will combat pause until each member can log in and take a turn. Or maybe it would be better to allow players to create a rule set that will manage their character in battle for them.

Party Formation

With the party we have a few options to look at as mentioned above. First up is each player in the party has the ability to move the party. With a party of six where each player has the power to more the party this, I think, would quickly dissolve into players arguing and fighting amongst each other about how movement and combat should be handled. In a game where movement and actions will likely be limited to a tick, this outcome could actually ruin the game for some players.  You also don’t have the same clear definition of roles that can bring a lot of fun to party play.

How about party members being able to control themselves and their actions instead of being dictated by the party? This approach solves the what do players do when they are online and the combat because they are in full control. The issue is though is this is no longer party play. You are now playing the game on your own but yet remain in a ‘party’ of other individual players.  A thought that would give this style more of party play and still resolve several issues with combat is to not allow the members of the party to move more than 10 or so tiles away from each other.  Then if you make combat turn based, a player could engage an enemy and instead of fleeing stop playing until another member of the party or two and come and attack the enemy as well. I like this idea. It give players the option to still explore the world, combat and train while party members are not online but still gives the sense and benefits of a party.

The final concept I have for this is to have a leader that is the only one that can move the party. This means that when a player that isn’t leader logs in there would need to be something they could logical do while in a party adventuring. And I can’t think of anything. A player could log in and train or study, but that isn’t really that fun in contrast to the leader where when they log in they have the power to move the party, enter battle and make all the quest decisions.  While this limits player interactivity, combat and general fun… Actually, that’s pretty much all it does.


This issue is tightly related to the type of party system that is in play, and I can think of three possible (read as not necessarily good) ideas for this. Let’s start with the idea for combat and party system that I am leaning too; Turn based combat with players able to control themselves and move about the area the party is in.  This approach would allow for players to decide how to enter combat. If an enemy is spotted five tiles over, the group may decide it’s best for the tank to engage first and then have the other members join the fray. The enemies combat would also be turn based. The only point that is nagging me here is how would the enemy operate. Would they only respond when they have been ‘activated’ – attacked, tile entered? If so what happens when the tank attacks, the enemy strikes back, and then the archer 3 tiles away attacks? Does the enemy attack the tank or would it start to move towards the archer? Or maybe even move towards someone else that is in the area. Or flee. And what if the enemy is attacked simultaneously? Or if the archer attacks and then runs? Should the aggro stay active for a few turns and every time the archer moves, he calls the enemy to runs it’s AI script and decide an action?

Keep in mind I only came up with this idea as I am writing this post, so this is what I think I would do with only a few moment of thought. I would have each player that engages an enemy active it for a number of rounds, even after combat. This means if the player tries to flee, it may be chased. But what this system also implies is that the enemy when it is engaged/activated/whatever it will run it’s AI script and determine course of action around it. This means and could be really interesting, is that if a player that has attacked an enemy and decided to wait for help could still be killed when help arrives and triggers the enemy to make a move. My only concern is that this would lead to a player dying without knowing what happened. If all six members of a party attack an enemy at once and the enemies AI tells it to kick the crap out of the guy beside me six times before that player has a chance to refresh the page, they will refresh dead. This though would lead to party tactics and communication which I strongly support.

Another option for the party being control as a whole either by a leader or each member in the party is the concept of a combat rule set. What I mean is that a player will have a screen where they will see a list of options and how they would want their player to react to each own when they entered combat. For a system like this to work in my mind the players would need to receive rather detailed reports about the battle so they can tweak their rule set. And while this would be interesting, the party formation still limits much of the players actions and in the end rather boring (I think) way to do it. Not only can you not move yourself, your combat consists of conditional statements.

In the end for me, I think allowing the players to explore a limited area around their fellow members and creating some form of activated AI system seems like the best solution for me.  What do you think?


For those who are unfamiliar with how I write posts like this, I literally come into it with the topic and almost no other thoughts on the topic.