Welcome

Welcome to my blog. I mainly blog about the basics of running Flash games over the internet, but sometimes I get distracted. Here you will find my efforts at programming turn based Flash games, plus links to all the games I have written. You are free (as in beer) to get all the code, just email me - nicolas_evans at yahoo.com (sorry you cant click on it - I dont want more spam).

Building Multiplayer Games in Flash.

The Posts

Tuesday, March 07, 2006

Hi. How did I build Scramble, a multiplayer game played over the net? Well I started by building the game for two people sitting at one PC. I dont think I could have built it to play over the net at first. Flash games are fairly complicated, and start by building a net version would have been very hard. What I should have done, was build a save/restore function. This would have been really useful, because the variables you need to save are also the ones you need to send over the net. I also put as much code as I could in a class file. This avoids all the problems that dog actionscript with its weak type checking, variables with the same name, etc. Here is the framework I have used for a couple of games:
class GENERIC {
    public var clip:MovieClip;
    function GENERIC (ca:MovieClip) {
        clip = ca;
    }
}

import GENERIC;

class MyScrambleGame extends GENERIC {       
    function MyScrambleGame (ca:MovieClip,pTarget,pAsPlayer:Number) {
        super(ca);
        mcCa = ca;   
    }
    function fnStartOfRound() {
    }
    function fnStartOfTurn() {
    }
    function fnEndOfTurn() {
    }
    function fnEndOfRound() {
    }   
    function fnEndOfGame() {
    }
    function fnShuffleTiles() {
    }
    function fnDisplayBoard() {
    }       
    function fnHideBoard() {
    }           
    function fnEnableTableDrag() {
    }
    function fnDisableTableDrag() {
    }   
    function fnStartDrag (mc:MovieClip) {
    }
    function fnStopDrag (mc:MovieClip) {
    }
}
There are other methods specific to this game. My next post should deal with a net version of Scramble.

# posted by nicolas_evans @ 2:30 PM
Comments: Post a Comment




This page is powered by Blogger. Isn't yours?