Tag Archives: Adobe Flash

Wacky Words Facebook Game – My Newest Programming Project

Wacky Words

So this is my newest project: a massive multiplayer text based comedy game I’ve been working on for the last few months in my free time.

http://apps.facebook.com/wackywords/

The Game:

The idea is a worldwide competition to see who can invent the funniest or wackiest concept or product. You can bet or invest in the ideas you think are the funniest and gain experience points, level up and buy skills either by being funny or deciding what you think is funny. It’s a very bare-bones game currently but eventually it will have a large social element tied to your facebook friends, walls and posts and stuff. Kinda like how the other facebook games utilize wall posts, except that everything in my game will be funny and unique… or at least will try to be.

You start by reading other people’s creations and voting or investing, or you can jump straight into the second tab and start drawing random words which you can then drag to combine into funny phrases and concepts. Write out a description or “sales pitch” for your wacky concept, submit it, and start earning gold and experience points from the votes. Wanna get really intense? Hound your friends to vote for your creation… or if you’re a real dick… hound all your friends to vote against someone else’s idea.

Future:

At this point the game has just the basics: ability to create new concepts and write out your sales pitch, with some text formatting. Ability to browse creations, vote up, vote down, invest and gain money. Currently I’m building the leveling system and a set of half a dozen different skills like more votes and investment tokens. Then I intend to add sharing features and hopefully tie the commenting with the Facebook posting system. Maybe I’ll add live chat for all that smack talk. Then it’ll need some friends integration, so you can see your Facebook friends in-game and with that, the ability to challenge each other and hold mini-competitions to see who can get more votes. (At this point the popularity-contest aspect of this game could be very important.) I will hopefully be able to bust out some apps for iPhone and Android, and finally, I plan to create a website that automatically makes a new post every time someone posts to the game so that regular web viewers who would never go to a facebook game or download an app would get to see all the funny crap.

Of course… this is all under the assumption that people actually find this game kinda fun and want to play it. I haven’t had the most success in the past with getting people to play my games, so please follow the link up top and give it a try on your facebook account and send me your feedback.

Nerd Stuff:

You may notice the front-end is built in flex. I debated this decision for quite a while, but finally chose flex over HTML5, mainly because of the ease of development. At this point, HTML and JavaScript just can’t compete with Flex in terms of rapid development and being that I’m only one developer I want to be able to  get this done as quickly and easily as possible. Flex should also allow me to easily create mobile apps for all the major devices. I’m hoping it’ll be just a matter of moving some stuff around to fit on the smaller screen or breaking functionality into smaller screens. Flex is so modular that that should be simple to achieve.

On the other hand… I have to learn JavaScript for my job right now anyway and I may become much more comfortable with it and depending on how the future of Flash unfolds, I may wind up regretting my decision.

For the backend I chose Google App Engine and Python. App Engine was an easy choice. It makes perfect sense because I’m already a fan of Google products and seem to feel more comfortable within their design methodologies than most others. Again, rapid development was most important and App Engine certainly helps with that. No worrying about setting up databases, background processes, security or–god forbid–load balancing. A massive-multiplayer game like this wouldn’t even be possible for a lone programmer like me without all the pre-built systems. Now it’s a piece of cake.

I picked Python to use with App Engine. I wanted to use PHP, since that’s got the biggest programmer base and I’m already comfortable in it, but of course, PHP is not natively supported… why I have no idea… and I’m not gonna trust a third-party App Engine PHP interpreter. So it was between Python and Java. I’ve worked in Java before, a couple years ago when I made my first Android App and… meh… it was okay. It’s no ActionScript, but really, what is? So I did a few Google searches for “Java VS Python” and most people seemed to prefer Python, so that’s what I chose. Maybe not the best way to decide, but there ya go.

ActionScript Interview Study Notes

About a month ago I lost my job making Flash banner ads, so I had to get out there and look for another ActionScripting job. I updated my portfolio website, uploaded a resume to Dice.com and the calls and emails started rolling in. I decided to start studying for my job interviews, having been in many ActionScript interviews. I took some notes of the kinds of things most likely to be asked, and thought I’d share them with anyone interested in making themselves look like an ActionScript expert.

I didn’t have time to complete these notes, so there’s some buzzwords and OOP concepts missing and I wanted to write a section about coding methodologies and office tricks like XP, Agile, Scrum, standup meetings, planning poker etc. I wound up finding a job too quickly and didn’t have the need to finish this post.

Describe the event cycles for a mouse event:

(This question seems to be asked in most of the ActionScript interviews I’ve been in, so make certain you brush up on everything relating to events.)

three phases: capturing, target and bubbles. Capturing phase starts at the top-parent movieClip and moves down the display list, firing the mouse events on every clip. Then the target phase is when it fires the event on the inner-most object that was actually clicked. Bubbles then goes back up the stack, firing the mouse event again on each of the parent clips.

by default, addEventListener listens for events in the target or bubble phase. Third parameter, called “useCapture” can tell addEventListener to listen in capture phase. Doing this allows you to call stopPropagation() on the event object to stop the rest of the event phases from firing.

mouseEnabled property on movieClips allows you to turn off the event firing, if for example, you want something in the background to be clickable but it’s being covered by another clip.

Event object properties: type:String, eventPhase:uint, bubbles:Boolean (tells IF this event will bubble, not if it’s currently in that phase), cancelable:Boolean, target:Object (the actual object that was clicked, the one that fires during the target phase), currentTarget:Object (the object that is currently firing the event)

The difference between target and currentTarget is important if you are listening for a button click, for example, but there is another movieClip inside that button. If the internal movieClip is clicked, that will be the target, but if it’s clicked around the outside of the internal clip, the button will be both the target and the currentTarget. Usually you’ll use currentTarget because that’s usually the object you’re actually listening to.

addEventListner params: type:String, listener:Function, useCapture:Boolean, priority:int (priority for multiple listeners attached to same object), useWeakReference:Boolean (usually want to set this to true so garbage collection doesn’t count the function reference, so it can be cleared from memory if you forget to removeEventListener)

more info: http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html

 

Loops

I’ve found that whenever an interviewer wants you to code something on the whiteboard, it’s almost always a simple loop-based puzzle, like ordering items in an array, finding a duplicate item, copying an array, etc. If I had more need of studying, I would search Google for these kind of basic loop puzzles. I suspect that this is a common whiteboard exercise in a lot of different coding language interviews as well as ActionScript.

Buzzwords and OOP concepts:

(In my experience the most important things for an ActionScript interview to have a handle on are the model-view-controller architecture, the concept of encapsulation and abstraction, abstract classes and interfaces.)

Model-View-controller (MVC): view listens for model events and dispatches user events, controller listens for view events and calls methods on the model, model behaves as the central data storage so everything knows where to go to get info

encapsulation: encapsulates the internal workings, like an API or the plastic shell of a VCR

Abstraction: process of generalization – taking a concrete implementation and making it applicable to different, albeit somewhat related, types of data, like a generic database connection class that doesn’t know which database its connecting to

Abstract Class: a class that must be extended in order to be used. Provides common functionality for similar classes

cohesion: how clearly defined something is (strive for high cohesion)

coupling: how dependent a code element is on another (strive for low coupling)

inheritance: classes extending each other. Avoid this. Inflexible

composition: when one code element contains another. more flexible than inheritance. video player may contain a slider for example

aggregation: when one code element references another so the internal one has no knowledge of its ‘parent’, but fires its events and can accept method calls, and may not be destroyed when its ‘parent’ is destroyed

service delegate: a class or something used to interface with an external service, so all service calls can go through this delegate to make code more flexible

command structure: encapsulates a method call or action as an object so it can be stored, reused, undone, etc (most useful for projects requiring undo buttons)

Object Pool: an array or collection of objects that you can grab when needed and return to the pool when you’re done with them. Reduces overhead from needing to recreate the objects each time.

Singleton: If a class is only intended to be created once, add a static function getInstance(), which creates or returns an object of itself, ensuring it never gets accidentally created a second time

Polymorphism: objects of various types define a common interface or set of methods, like how + operator can be used on strings or numbers. they may do different things depending on the type, but will have same methods

Factory: creates objects without specifying the exact class of object that will be created, providing an interface/abstraction for object creation. technically a singleton is a type of factory

Decorator: allows you to add behaviors to an existing object on-the-fly; once class sort of encapsulates another, sometimes passing one class into the other’s constructor. Or conceptually it can be as simple as two different functions that both call a single function, adding their own changes to the result

Adapter or wrapper: translates one class interface into another

Composite: treating groups of objects as a single object, can be used if you find yourself doing the same operations repeatedly on similar objects

Kalin’s Farmville Game Ideas

Last week, after countless automated requests from Facebook friends, I finally found myself playing (and subsequently addicted to)  Farmville. My first thought, naturally, was “I coulda built this game myself!” and since then my imagination has been running wild with ideas for Farmville ripoff games I could build in Flash. I’ve always wanted to build web games, though my one hangup has been the fact that I can’t make things look good. I can write code and make it functional, but actually making a successful game on my own would be nearly impossible because I don’t have any visual artistic skill. However, these days if I came up with a good idea and a good implementation, I could afford to invest some of my own money and hire an artist.

Unfortunately, I have two other programming projects as well as fifteen or twenty different writing pieces I’m currently working on and on top of that, laziness still pervades my soul, so I probably won’t get around to these ideas.

But I thought my Facebook game ideas were pretty cool so I figured I’d outline them here and see if others think they’d be as cool as I do.

My first idea has the same basic form as Farmville except you are building an underground lair in a side scrolling view instead of a farm in overhead view. At first the terrain of your area would be auto-generated to form a basic platformer game level. You would then buy industries, mines and businesses instead of crops and animals and place them anywhere in your lair. You would also have a spaceship/airplane that you would fly through your level and use to collect the income from your businesses and money-making items in the level.

Then, instead of farm decorations, you would buy turrets, enemies and other obstacles for your level, then you would invite your friends to bring their ship from their own lair and play your level. You could then get a bonus if your level is able to destroy your friend’s ship, or they would get a bonus if they were able to complete your level.

Everything would be upgradable, of course. I could take ideas from numerous other side scrolling plane shooting games and let people buy special weapons and defenses for their ship, perhaps letting them switch out ship components between levels. Boss characters could exist at the end of the levels as well, as again, could be upgraded or perhaps improved through an experience-point system.

The key to the success of this game would be similar to Farmville: it would rely heavily on the Facebook social aspect, giving players bonuses for dragging their friends into the game and relentlessly harass people with free special items. The other key, of course, would be the variety of quality graphics, allowing people to fully customize their level. I would need a good cartoonist or two to pump out countless good-looking graphics. For me, that’s the biggest stumbling block.

——————-

My other idea was fairly similar: you start with your ‘farm’. This one is overhead view and the grid is laid out just like in Farmville. This time, however, you start with automatically generated terrain like mountains and rivers which sit on your grid in the same way Farmville objects sit on their grid in Farmville. Then you buy mining operations, industry and businesses and place them in your land, these items behaving similarly to the money making items in Farmville. You would then need to tend to them in the same way you do your Farmville farm.

But then the important part of this game is buying soldiers, tanks, planes, artillery, transports, ships, etc. You can place them anywhere on your ‘farm’, ready to attack or defend. Then you invite your friends to do combat with your military. If they agree, a battle instance is created and a copy of your land and assets is created, but with your friend’s land tacked on right next to it. The armies then do battle, which may take a few hours to a few weeks to complete.

While in a battle instance, your pieces would have a set movement distance per unit of time. For example, a tank might gain the ability to move 40 pixels every six hours. Once you move it all 40 pixels you’ll have to wait until it’s ready to move again. Once you get within range of your enemy’s army, you could begin firing. Different pieces would have different firing power and different ranges. They could also be set to automatically attack if an enemy moves within range. The number and frequency of shots would of course be limited based on the piece.

This kind of battle would be good for people who want to play against each other but are not online at the same time or can only play for short sessions throughout the day. However, there could be an option where, when you are done moving everything you want to move, you can hit a ‘done – skip ahead’ button, then if your opponent agrees and hits the same button on their turn, both parties will have their movement numbers replenished, easily turning this into a turn-based game.

More than two players could be involved in a single battle. In fact, I believe dozens or more players could be involved in a single battle, each adding their own battlefield onto all the others, without causing any notable performance issues. At the same time, a single player could be involved in numerous different battle instances, since the destruction from the battles would not be permanent.

On top of this main idea, I could add all sorts of other gameplay elements. I was thinking of a skill system similar to EVE Online where your skills continue training when you’re offline. There could be a system of alliances, so the battles are not ‘every man for himself’. Then there could even be cities, perhaps represented as an icon on the map, but then you could drive into them, opening up another area where you could buy decorations, buildings, money-making industries etc. However, your enemies could, of course, come in and attack that city. And as well as your city, you could upgrade your landscape, buying bigger, more interesting mountains and forests and moving rivers, though I’m not sure how that would work from a story perspective–perhaps God rewards you for killing your enemies or something.

——————–

But for now these are just a couple ideas floating around in my head. Maybe I’ll start on one of them if I find myself unemployed again, but until then I still need to get the last of the kinks worked out of my WordPress PDF creation plugin so I can post it to the community.

I also need to keep working on a program I’m building in the Appcelerator/Titanium platform, called “Batch Rename” which gives an interface which creates a script that’s kinda similar to SQL that can parse through a directory and rename, move, delete or copy any files it finds based on regular expression (regex) code. This is probably a lot more useful than any Farmville knockoff, as I actually came across a situation yesterday where I would have used it.