game code

  • Anonymous - 2009-11-28

    Code refactoring

    • about 90% of the code in should be in
    • should only be used to use the Game object.
    • has much of the logic for Wizards and Fireballs. That logic belongs inside the W
    • about 90% of the code in should be in
    • should only be used to use the Game object.
    • has much of the logic for Wizards and Fireballs.
      That logic belongs inside the Wizard and Fireball classes. Problems may occur
      when moving the logic to their respective classes. One problem I see would be
      dealing with collisions. My solution is to use custom SDL_Events for
      collisions. The game loop tells the Wizards they are hit and the fireballs
      that they have hit something.

    my opinion is:

    when one is programming outside of a

    class, the code should tell the class

    object what to do, not how to do it.

    It's the objects job to know how by

    the code defined for it's class.

    A simpler method for animation loading:

    The Game object uses directory scanning to get list of images to load.

    A naming standard is drafted for optimized FLAW devlopment using file naming
    convention blender outputs for animation frames.

    The game uses regular expressions to load the images into RAM accesible be
    animation objects. This can be done with C/C++ string functions or using
    libpcre so you don't have to roll your own. Using the pcre library might be
    cool anyway. Regular expressions are useful.

    Physics and Chipmunks

    The 2D Chipmunk Physics library could be very useful for some of the effects
    you desire in the game such as sliding on ice. We could use simulations by
    setting the gravity to zero, and giving everything friction. This will
    probably change the way Wizards move, therefore, some play may be involved to
    get a good feel for realistic, responsive motion.

    When reading the library's documentation I had an idea for making maps. A GUI
    tool could be made for FLAW level development. Standards should be drafted for
    FLAW maps, that the game and the developement tool will agree on. The GUI tool
    will use physics bodies with images/animations attached.

  • Anonymous - 2009-11-28

    Please let me know what your thoughts are on this. As always, thank you for
    making an enjoyable, memorable game.

  • Denis Comtesse

    Denis Comtesse - 2009-12-02

    These are some interesting thoughts.

    Of course you are completely right about the code. When I started this game I
    didn't really know how the code would be structured. I just included more and
    more features and with every feature it became more complicated. So far I
    avoided restructuring the code, because this would definitely cause new bugs.
    Well, I guess sooner or later it will be necessary if we want to expand the
    game. I think collisions will be the biggest problem, but your solution sounds
    reasonable. I don't want to change the complete code at once, but I will try
    to move some things around and improve the code bit by bit.

    Directory scanning might be nice if we wanted to have different gfx-packs with
    different animations etc. But as all animations (Number of frames etc.) are
    hardcoded at the moment, we would have to change more than just the image
    loading functions, to have any advantage. I don't see the benefit at the
    moment, but you might prove me wrong.

    The file naming is already based on Blender. For example, the wizard-
    animations are rendered with expressions like "hit _ 0 _ ##" as blender
    output, so I don't have to rename them after rendering the animation.

    About physics: I don't know the library you are speaking of, but I will look
    into it. Of course, sliding isn't too hard to implement, we wouldn't need a
    new library for that. But if we want to have a map-editor and different maps
    with collidable objects (more than just the borders of the screen) that
    library would make sense. I'll look into it.

    Right now I'm planning to finish the next Version with different screen
    resolutions and updated graphics, before doing the next step. After that, we
    can mess around with the code and experiment with physics and maps, because we
    might have to rewrite big parts of code.

    Anyway, thanks for your ideas. You are successfully pushing me to improve the
    game. ;-)

  • classMember

    classMember - 2009-12-04

    You're very motivated anyway. You've made it farther than I have... I have
    like 50-some small demo programs that do very little. You've made it this far,
    and after I submitted a feature request that was completed successfully the
    next day, I was impressed. I'm going to help to help when and where I can.
    It's usually more fun when you're not the only one involved.

    About the image-naming thing, I meant more like having a function that would
    use the naming convention used for outputting images. There is already code
    that does this in FLAW, but it's hard-coded with the animation names.

    The Chipmunk2D physics library is not necessary, but may prove useful for a
    more arcade-like experience.

    Some form of mapping system needs to be devised... just something to think
    about and research how other games tackle the issue after the improvements
    we're currently focusing on.

    As of right now, I'll continue to look into moving the bulk of the code from into and use strictly for things outside of
    the game and for initialising the game object, letting it do it's thing, and
    cleaning up anything outside of the game.

  • Denis Comtesse

    Denis Comtesse - 2009-12-08

    A very simple approach to maps: We could just put some additional blocks and
    walls onto the map. They could even be part of the background, if they are not
    moving. With this approach, a map would just consist of a background and a
    single data file with information about the type and position of the
    additional objects. Aside from walls, there could be many different obstacles:
    puddles of ice, teleporters etc.

    As for the physics engine, we might also look into Box2D, which even can be
    found in the debian repositories.

  • classMember

    classMember - 2009-12-20

    I'm trying to push changes to the trunk. Very small changes... A few comments
    and commenting out an extraneous SDL_Flip(screen) right after an
    SDL_Flip(screen). Small performance increase on the winner animation.

  • Denis Comtesse

    Denis Comtesse - 2009-12-20

    Thank you, the commit was succesfull, and I could merge your changes with

    The double SDL_Flip() was a mistake of course. Thank you for noticing.

    I added two requested features:

    • a small notification when loading and reloading the graphics before the game starts (instead of a black screen)
    • the ability to skip the rest of a match and just show the result (e.g. as a shortcut if no more human players are alive)

    By the way, you can add your name to the AUTHORS file if you like.

  • Denis Comtesse

    Denis Comtesse - 2009-12-20

    We have a new developer on board. Athalean wants to look into implementing
    network support.

  • classMember

    classMember - 2009-12-25

    Merry Christmas!

    Wow. I really like how the project is developing. The wizards powers blink
    faster when they go away now. Before it blinked once and I just thought it was
    a glitch. One of my friends here in Japan enjoyed playing the game with me.
    She really got into it. Being chased around by fireballs and what-not.

    About the Wizards having more power in general, like spells they could cast, I
    think it would be great to give them more powers, if they had a wave that
    could hit fireballs easier, but that spell had to refresh... or if they could
    use a spell to enable them to knock an opponent farther. Stuff that still only
    allows wizards to indirectly kill opponents, but still gives more strategy and
    power to the player.

    If nothing else, I could try to make a simple map implementation and start a
    story-mode where the player could battle other beings, and spells could be
    implemented there.

  • Denis Comtesse

    Denis Comtesse - 2009-12-25

    Merry Christmas to you too!

    Your ideas for a spell system are interesting. We can implement something like
    this as an option. It might be interesting to let each player choose only one
    spell at the beginning of a game. This way players would have to think about
    which spell best fits their playing style and strategy, and there would be
    more diversity among players. Some things have to be considered if we
    implement a simple spell-system:

    • We might have to find a way to indicate how much "mana" a wizard has. This should take up as little space as possible. Or we could simply say that each wizard can cast a spell 3 times (mana potions would increase that number). That would be simple enough, and we would not need a visual indication.
    • The spells shouldn't require the player to use any additional buttons, because this would make the game more complicated. One possibility would be that a spell can be cast by holding the fire button down for a short time.

    Another Idea: Someone has reported a new bug that makes the game unplayable
    for him (the player setup menu goes mad).

    So I am thinking about opening a "1.2 maintenance" branch. This way, we can
    easily add new features to trunk and still have bugfix releases for the stable
    version (1.2.2, 1.2.3 etc.)

  • classMember

    classMember - 2009-12-26


    In my opinion, "mana" is such an over-used word. Let's use imagination or
    dream-strength, lucidity, something else. It could even be something as
    far as "cheese lust" as long as it's something unique and memorable.


    after a fireball hits someone and sputters off into a transparent state of
    nothingness, it is still deadly. Intentional, or not, it's annoying to win a
    game, then see a fireball disappear on the screen while the game recognizes it
    still moving and kills your wizard. lol. we could either use a boolean class
    member as a toggle to specify whether it will still hurt the wizard or not, or
    we could have a separate object for dead fireballs that is triggered as part
    of the fireball's cleanup.

    Naked women

    They're wonderful, aren't they? I forgot what else I was going to say...

    I should work on a mapping system, or write a tutorial on how to use the FLAW
    menu system.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks