A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: I'm back! + new iso tilebased engine (open source)

  1. #1
    Lunatic Baukereg's Avatar
    Join Date
    Nov 2000
    Location
    Lowlands
    Posts
    853

    I'm back! + new iso tilebased engine (open source)

    Hey, I guess most people have no clue who I am, but I used to be very active on this board years ago. The last couple of years I haven't created any games due the fact that I lost attention when AS2 and OOP was introduced. But I recently started to do some flash work once again, so I decided to get used to OOP (finally!) and try to pick up my old skills.

    My most *****ious project in the old days was the Action RPG Tales of the Lost Warrior, you can still play the demo at this location. I also created the Chicken War games (Chicken War 2 was quit a hit, Chicken War 3 was never released as a full game) and I won a Flashkit 24 Hours competition in 2004 with Bar Keeper (screenshot).

    As said, I did some new project recently, like the puzzelgame Amnesia and Digital Far-leaping (both Dutch).

    And now I'm trying to learn OOP!

    So I created this simpel isometric tile based engine as a testcase, and I decided to release it as an open source.

    It's very basic but it works! Previously I stored the maps in arrays, but this time I used XML. The game uses a 3D class system, almost like 3D arrays: a World class contains Map classes, and a Map class contains Tile classes, that should make sense. There is also a Hero class, but the World class is the most important class since it contains al the methodes related to the gameplay. The other classes are basicly only used to store variables.

    Anyway, check it out, post comments what you think of my engine or how I could improve it, use it to develope a game, whatever.

    Anyway, I'm back!

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    your engine has a very static move implementation its digital- meaning no tweening or natural movement from cell to cell.

    You could add a movement that works within a cell meaning that given the character collisin radius is smaler as a collision cell the character can move thus within the cell giving it more freedom.

    If you are starting to digg yourself into OO coding design better start right away with AS3 as it is already free available and will surely be the future for a long generation fo future flash applications. AS2 imo. is rather a messy attempt from switching of AS1 into real OO design.

  3. #3
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    Hi Bauke

    Why not give a 5min speech and say what makes your engine better then the 21323 other ones already available?

  4. #4
    Lunatic Baukereg's Avatar
    Join Date
    Nov 2000
    Location
    Lowlands
    Posts
    853
    Haha absolutely right, but as I said, I just started OOP and this is just a testcase for me. And since there are a lot of people having way more experience with OOP then me, I'm destined to learn from their comments.

    @ renderhjs
    You're so true, but this is just my first OOP attempt so I tried to keep things simpel. I'll keep improving it with more options tills it progress far enough to make a game.

  5. #5
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    Didn't mean to make fun of you, I was actualy serious.

    Didn't mean you was that eager for feedback, so here it is:
    - There are quite some grammar, spelling or translation errors in your code. (You use quite an amont of Dutch words).
    - You should realy dive into the whole MVC (model view controller) scene. This allows you to sepperate your application logic. For example; you have a world class that pretty much does everything, while instead this class should only contain data about tiles and heroes.

  6. #6
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    And since there are a lot of people having way more experience with OOP then me, I'm destined to learn from their comments.
    is there a part of your code or a class you think you did great or solved it in a nice way- we could discuss some of it here and see what others think from their point of view how they would have done it or how it could be perhaps improved.

    oh and almost forgot: welcome back on board

  7. #7
    Lunatic Baukereg's Avatar
    Join Date
    Nov 2000
    Location
    Lowlands
    Posts
    853
    @ SaphuA
    Open source since rather a big word, I only meant I'm learning by practice and keep it open for everyone to feedback. Since MVC is very OOP related, it is something completely new for me, and I'm not sure how to use that with actionscript. But I'll try to figure it out. Thanks for the suggestion. Right now the World class indeed handels everything, but that's because I'm used trying to get as many AS in one place. Does MVC means I create a special class for the gameplay actions?

    @ renderhjs
    Yeah I wonder if the 3D class structure I used is common for these type of applications.

  8. #8
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    pardon,- wich 3D class?,- are you refering to the map rendering? - please specify

    what I can rahter advise or directen you to is regarding the XML setup. The xml file looks very big for such smal information because you wrote quite long tag names. Some time ago I used a reference system for a map format that allowed me to setup a smal prefix for a certain content,- see this thread for more information:
    http://board.flashkit.com/board/showthread.php?t=706063

    prefix list:
    w = water tiles
    s = sand tiles
    0 = empty

    <map author="bla bla" startPos="1,4">
    <r>w,s,0,s,w,w</r>
    <r>w,s,0,0,w,w</r>
    <r>s,s,s,s,w,w</r>
    <r>w,w,w,s,s,s</r>
    </map
    that way one could easily exchange meanings or tile sets without editing the whole map file- you´d then just need to change the prefix list at the top of your map or within your engine.
    Also my example is much easier to read regarding lines and rows because each node content e.g "w,s,0,s,w,w" can be read out as an array using rowString.split(",");
    Currently I am developing a Tile-map Editor that automaticly loads alot of different map styles- if that sounds interesting for you have a look at it here:
    http://board.flashkit.com/board/showthread.php?t=725001


    As for the general coding style,- you seem to mainly store properties in your classes. That´s excact the opposite of what I am currently expierencing with AS3 programming, in my case I mainly keep functions within classes and just a tiny part of public variables. I consider classes rather as toolboxes that give me usefull tools I need to handle data, structures or other elements.

  9. #9
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    Hey welcome back Baukereg. Nice attempt at using OOP. I remember when I first started using OOP it took me a while to get used to the concept of what to create a class for and when. But you seem to be doing fine. I just looked at your source, looks good. One thing I would like to say though is you should look into OOP design patterns. Its sort of like proven solutions for common OOP problems. Like the most common ones I use in flash are Singleton and the MVC design patterns. I normally use the Singleton on my main game class. All this really does is make sure there is only ever one instance of the the world class. I'm looking at doing a mini tutorial for OOP sometime this week. On some basic set outs that can be used for games.

    Other then that great work mate. Good to see you back.

    [h]ooligan

  10. #10
    Lunatic Baukereg's Avatar
    Join Date
    Nov 2000
    Location
    Lowlands
    Posts
    853
    Very interesting. The xml looks long, but that's because every tile has its own element, and that is because the art (or frame label) is not the only piece of information. Some tiles contain conditions, some items. Portals even look like this:

    Code:
    <tile art="portal" con="cM" newMap="grass01" newY="2" newX="0" />
    This elements tells that this tile is a portal, the condition is 'cM' (changeMap) linked to the map grass01, and the hero will start on row Y coll 0.

    And after all, once the engine is ready and a mapeditor is created, one doesn't have to bother with the actual XML code, that should be handled all by the editor (in my opinion).

  11. #11
    Lunatic Baukereg's Avatar
    Join Date
    Nov 2000
    Location
    Lowlands
    Posts
    853
    @hooligan2001 thanx for the reply!

    Quote Originally Posted by hooligan2001
    I normally use the Singleton on my main game class. All this really does is make sure there is only ever one instance of the the world class.
    Is that very simular of only using static variables and methodes in a class?

  12. #12
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    @Baukereg: I did the codes in the very same way,- just creating a shortcut or prefix for it and use that instead of the big information each time. That way the code or function is way better reuseable without needing to assign for example an enemy each time.
    But it was anyway just a direction suggestion,- it took me a long time getting that concept and the main force that drew me in the end was lazyness and big big maps to edit.

  13. #13
    Member
    Join Date
    Jul 2006
    Posts
    50
    Quote Originally Posted by Baukereg
    Is that very simular of only using static variables and methodes in a class?
    It's more like a series of global properties and methods (although it's a bad idea to use it wholy in this way).

    You just create an instance of the class, and make sure you can't ever have more than that one. There is an example over the Flash help.

  14. #14
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    It works something like this.

    Main.as
    PHP Code:
    class Main {

    private static var 
    instance:Main undefined;

    private function 
    Main() {
    trace("Main Created");
    }

    public static function 
    getInstance():Main {
    if(
    instance == undefined) {
    instance = new Main();
    }
    return 
    instance;
    }

    Then when you use it in your fla. Simply use.

    PHP Code:
    var game:Main Main.getInstance(); 
    What it does is if there is an instance of Main already created it passes that instance else it creates a new one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center