Archive for the ‘Games’ Category

Pokercoder

Monday, July 14th, 2008

So I’ve been alerted to the ridiculously cool Pokercoder event by my old pal Sean McSharry. Despite being probably the worst poker player on the planet, and having sworn never to play again after a high profile and humiliating defeat at Flash on the beach last year* I’m pretty tempted to go along. In fact, I’m definitely going along.

Apparently, it’s free entry, free booze, and really, really awesome prizes! Plus free tuition if you’re not sure of how to play (it’s Texas hold-em rules).

Check it out:

In order of finishing position, these are the prizes:

1. iMac 24” 2.8GHz (plus cab fare home)
2. MacBook 13” 2.1GHz (plus cab fare home)
3. Sony Playstation 3 (plus cab fare home)
4. iPod Touch 16GB
5. Nintendo Wii
6. Nintendo Wii
7. iPod Nano 4GB
8. iPod Nano 4GB
9. iPod Nano 4GB
10. iPod Nano 4GB

PLUS £20 free bet on Betfair for those players finishing in places 11-20.

Gift / goodie bags will be handed out also. At this point we don’t have the final details on what will be in them or how many of you will get them. Check back later on to find out.

ландшафт

Register now at pokercoder.com. You’d be crazy not to.

*Last time I played poker was at Flash on the Beach 2007, at a table with Sean, Nicolas Canasse and Joshua Davis - I managed to lose horribly in front of some of the people I most respect and admire :o … still, makes a good pub story, I guess.

The World/Controller design pattern

Friday, August 26th, 2005

One of the most basic things you will always need when making any sort of game is a World - that is, a class object which will track and mediate between your game logic and your display view. In conventional programming, the design pattern Model/View/Controller(MVC) would be popular in this situation - however, due to the unique nature of flash, some things bear consideration:

  • As flash itself has a Stage, there is an inherent, built-in View tier, which you have to use - for better or worse
  • One of the overheads in the MVC pattern is the draw phase - the model needs to be analysed, rendered and passed to the screen - however, to an extent, flash already does this for us, and making this a seperate phase is a duplication of work.
  • Although in many ways quite elegant, the flash stage interface can be cumbersome from a programming point of view - e.g. sometimes we experience difficulties traversing the tree, creating/destroying objects, and keeping track of the game’s movieclip structure.
  • The World/Controller pattern is an attempt at approaching all of these problems at the same time. Instead of having a seperate model & view, in our game, the model and view will be combined, so that essentially, the model *is* the view - that is, as soon as a change is committed to the model, it will be set to draw on the screen, eliminating the need for a seperate view pass. It also proivides a facade to the stage, allowing us to organise our movieclips in a more intuitive manner, and giving us a single interface to different types of object.

    For example:

    Suppose we want to create several different types of object on the stage, each of which will behave differently. Let’s keep it simple - let’s sat they all have a different move() method which needs to be called. If we have the move method situated in a controller class object, we’d need to do something like this:

    function moveSprites(){
        for (i in _root.group1){
              if (typeof _root.group1[i] == “movieclip”){
                    switch (_root.group1[i].type){
                        case enemy: doEnemyMove(_root.group1[i]);
                                            break;
                        case bullet:   doBulletMove(_root.group1[i]);
                                            break;
                   }
                }
    }
    

    As you can see, the sprite’s movieclip path is tightly coupled with the code, and if we decided to change the grouping of the different types, we would have to change a lot of code. However, let’s say we have a class World, which will handle the creation and management of our objects for us - our code would then look something like this:

    //world is passed a reference to the current clip scope:
    var world:World = new World(this);
    world.addGroup("enemies");//create a group callled "enemies"
    world.addGroup("bullets");//create a group called "bullets"
    //add an 'enemy' type object to the world, inside the 'enemies' group:
    world.addObject("enemies","enemy",{x:10,y:20});
    var enemies:Array = world.getGroup("enemies");
    for (var i in enemies){
        enemies[i].move();
    }
    var bullets:Array = world.getGroup(”bullets”);
    for (var i in bullets){
         bullets[i].move();
    }
    

    As you can see, it would be a matter of just adding an extra line to add another object, and we don’t have to worry about depth, instance names or identifying the type, as the World class does all that for us. It also acts as a factory to create the appropriate clips in the correct levels in the movieclip tree. We don’t ever need to know where they actually reside in the tree, we can just get at them through the World class. Moreover, they could all reside in totally different coordinate systems and movieclips, and our code wouldn’t care.

    The grouping is useful when it comes to be time for our collision detection to be worked out, as we’ll need to carefully plan how different objects are grouped - for example, static objects can be placed into lookup trees, and moving objects which don’t need to detect collisions between themselves (such as bullets) can be handled seperately to other objects.

    Performance:
    As far as performance goes, there is no noticable disadvantage, and possibly even a speed increase, depending on how you handle things - provided you follow a couple of basic rules:

    1) Always create a local var reference to the group - otherwise the World class will keep calling the accessor methods and this will make things *slow*.

    2) If possible, try and loop through the arrays by number, as this is much faster (up to x3 according to some of my recent tests)

    3)Generally, local registers are your friend - they will perform much faster than performing lookups on the tree - var myClip = _parent.myClip will be faster than always calling _parent.myClip - it will also make it easier to use in the debugger.

    The World class can be as generic or as specialised as you want it to be - it could handle a number of diverse tasks, such as creating/destroying objects, building a tree hierachy for space partitioning, or even saving game state.

    EAxploitation Games… Overwork Everyone

    Wednesday, December 1st, 2004

    It seems that the console games industry is on the brink of meltdown due to burnout staff working practices - EA (NASDAQ: ERTS) being the most prominent offender, and the potential recipient of a potential class action lawsuit. This comes in the wake of numerous reports of a corporate culture of abuse, burnout, death march development cycles, and gross management incompetence, according to both firsthand accounts and anonymous rants by family members of developers.

    There is talk of forming a Game Developer’s union, not to mention countless op-ed pieces on how to turn out a games project on schedule without losing half your developers in the process. I don’t know how, but I think it’s definitely time for something to change. I’ve eperienced long working hours on both games and web projects, and it’s true that working later and harder on projects is a fact of life in creative industries - however, EA’s alleged approach of a scheduled, unending crunch has got to be a sure way of destroying some of the games industry’s best talent. If I had to work 12 hours a day, seven days a week, that career in carpentry would start to look damned attractive…

    I, for one, am not going to be buying any EA games in the foreseeable future - and it’s been a long time since I’ve used any of their graphics applications

    GAMEFRAME::First Look

    Tuesday, September 14th, 2004

    I’m really stoked right now, because I’ve just finished the first milestone of GAMEFRAME, my current project. GAMEFRAME is a collection of libraries designed to assist in creating a game - it’s an AS2 framework which includes things like world management, sprite behaviours & collision detection - stuff that virtually every game needs. I’ll be talking about it at the LondonMMUG.org meeting this thursday.

    Here’s a demo: this demonstrates the usefulness of tree based collision detection (which gameframe makes it really easy to implement) - you can have a large number of sprites on screen at once, all moving independantly and reacting to collisions - with only a small drop in performance. This is it the expense of a small amount of accuracy, but for most games this will be good enough. I’m thinking arcade style shoot-em ups, that sort of thing. Anyway, this demo has 30 enemy sprites, and one hero sprite, moving around freely in 2 dimensions. As you can see, it performs pretty well. I’m pretty happy with the collision reactions, which I just got working tonight, thanks to Jobe Makar’s Macromedia Flash MX 2004 Game Design Demystified. Anyway, check it out, let me know what you think.

    Instructions: Note - this is not really a game. Just move the black square around with the arrow keys and bash into the other squares. Refresh the page to start again.
    View GAMEFRAME collision demo

    MMUG

    Wednesday, September 8th, 2004

    I’ve been asked by the London MMUG to do a talk on developing flash games for their next meeting. I’ll be talking about the World/Controller design pattern, which is a flash specific variation on the Model/View/Controller pattern, and also the basics of tree based collision detection. I’ll be posting articles & source on here to go with the talk, either just before or after the meeting.

    London MMUG (formerly mmug.co.uk) now have a new website, it’s at:
    LondonMMUG.org.
    The meeting is at 6.30pm on Spetember the 18th, doors open 6.00pm.

    The details can be found here. Don’t forget to register! Hope to see you there!

    GamePackage

    Monday, September 6th, 2004

    André Michelle has released a new package of game related libraries. It’s still in a very early version, but it’s got a good conventional tilemap engine. Check it out here.

    Really Good Tutorial on SAT based collision detection

    Wednesday, September 1st, 2004

    As you may know, I’m all about the collision detection. So I was quite pleased to find this tutorial on the Seperating Axis Theorem on the Metanet site. Basically, the seperating axis theorem lets you get early outs on a lot of collision checks, because of the brilliantly simple theorem that if two shapes are projected on a plane, and any one of those projections do *not* intersect, then the objects cannot be in collision. Go check it out! It may solve you sloping platform game problems!