Thornwind Progress

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sirridan
    Knight
    • May 2009
    • 560

    Thornwind Progress

    Well, things are actually moving on nicely so far. I have it in C#, the display and input is separate from the core game, and the whole thing is event driven. Any ideas for a good place to host the code so others can look at it easily?

    So far all I can do is run around a pre-generated map, I'll add collision detection tomorrow, its a bit late and I'm getting sleepy, but it will be easy to do.

    Screenshot included.

    Current Issues: Screen flickers when moving (double buffer? or maybe add a boolean to repaint only if something changed). Also screen doesn't show up immediately until a key is pressed, this is due to the events I think... I bet if I push a "REPAINT" event to the game core it will display immediately.
    Attached Files
  • Sirridan
    Knight
    • May 2009
    • 560

    #2
    Flicker is fixed. I had it working where it displayed initially, but now it doesn't, oh well. That's a very minor issue I'll figure out later, now I'm working on collission detection.

    Comment

    • Sirridan
      Knight
      • May 2009
      • 560

      #3
      Collision detection added, anyone interested in the source or the .exe?

      Comment

      • Sirridan
        Knight
        • May 2009
        • 560

        #4
        Added a monster, and it chases me! AAAAH!

        Comment

        • Sirridan
          Knight
          • May 2009
          • 560

          #5
          Okay todays goals have been met:

          1. Display no longer flickers.
          2. Collission Detection
          3. Monsters added
          4. Monsters chase player and collide with him (however they can still move through each other)

          Tomorrows goals:
          1. Monsters cannot move through each other
          2. Player can attack and kill monsters, vice versa
          3. Monsters can sleep and may be unaware of player
          4. LOS

          If anyone is interested in the code, or the exe let me know and I'll zip it up and post it. Currently it's building under visual studio 2008, should work in 05 though.

          Comment

          • Pete Mack
            Prophet
            • Apr 2007
            • 6883

            #6
            I'd take a copy, but I'm only running OSX at the moment. Are you using the same base class for player and monster? (It makes things much easier if you are planning on complex monster behavior like pets, etc.)

            Comment

            • Sirridan
              Knight
              • May 2009
              • 560

              #7
              Originally posted by Pete Mack
              I'd take a copy, but I'm only running OSX at the moment. Are you using the same base class for player and monster? (It makes things much easier if you are planning on complex monster behavior like pets, etc.)
              Actually no, they are separate for the moment, although that's actually something pretty easy to change right now.

              class GameCreature
              class Player: GameCreature
              class Monster: GameCreature

              or I could make an interface and have the monster/player implement it, we'll see.

              I'll put the source up a little later after I wake up and you, and anyone else, can take a look at it.

              Comment

              • Pete Mack
                Prophet
                • Apr 2007
                • 6883

                #8
                interface isn't the right model. GameCreature is an isa, not a hasa. You'll want abstract functions for some things, but Move(Point()), Hp {get; set; } can be implemented as concrete methods.
                You may even want to inherit from a base object, VisibleObject, which encodes the basics for location and appearance.

                Comment

                • Sirridan
                  Knight
                  • May 2009
                  • 560

                  #9
                  Originally posted by Pete Mack
                  interface isn't the right model. GameCreature is an isa, not a hasa. You'll want abstract functions for some things, but Move(Point()), Hp {get; set; } can be implemented as concrete methods.
                  You may even want to inherit from a base object, VisibleObject, which encodes the basics for location and appearance.
                  Yeah, I think you're right about that one. I'll have to rewrite a few things, but in actuality it will be nice to have some reusable code. I'll post the source after that's done.

                  Comment

                  • Sirridan
                    Knight
                    • May 2009
                    • 560

                    #10
                    Thorn Source

                    Here's the code, and the EXE if anyone wants to try. The exe is in the bin/debug folder, ThornEngine.exe

                    Some things are still NYI (not yet implemented) but movement and monsters chase. No combat yet.

                    Any questions/comments let me know!

                    -Yes, I will be actually commenting this code.
                    Attached Files

                    Comment

                    • Pete Mack
                      Prophet
                      • Apr 2007
                      • 6883

                      #11
                      I took a look. You might want to consider these design patterns before you go much further:

                      Normalization -- dependent values should not be duplicated. (That is, the symbol for a monster species is fixed--it's a descriptor of the species, not the monster itself.)

                      Flyweights -- Similarity between objects can be extracted out and represented only once.

                      These ideas are somewhat related; the second is a generic caching scheme; the first is the canonical way to represent large numbers of similar data.

                      Comment

                      • Sirridan
                        Knight
                        • May 2009
                        • 560

                        #12
                        Originally posted by Pete Mack
                        I took a look. You might want to consider these design patterns before you go much further:

                        Normalization -- dependent values should not be duplicated. (That is, the symbol for a monster species is fixed--it's a descriptor of the species, not the monster itself.)

                        Flyweights -- Similarity between objects can be extracted out and represented only once.

                        These ideas are somewhat related; the second is a generic caching scheme; the first is the canonical way to represent large numbers of similar data.
                        Good ideas, I'll look into my code and implement those where it's needed if not already. I should probably look at my software engineering textbook and find a copy (at least online) of the gang of four's patterns.

                        Right now I'm making it as such.

                        Basic overview:

                        OS - ThornInterface (Abstract) - Game Engine

                        ThornInterface is the abstract class holding methods to display, capture input, etc. Creating this and passing it to the game engine should be all that's required to port it to a different system, or change the way it's displayed.

                        ThornGame Guts of the game, event driven, events are pushed by ThornInterface and by some things in ThornGame.

                        VisibleObject Contains data for color, display character "@ for player, etc", name, and position.

                        Monster Extends VisibleObject, contains data for monsters

                        Player Extends VisibleObject, contains data for player

                        MonsterCollection List type object with some methods to deal with all current monsters in the level.

                        AI Monster AI, right now only stationary and chase AI is implemented, others will follow. I also need some LOS calculation methods, that will come soon as well.

                        Comment

                        • Pete Mack
                          Prophet
                          • Apr 2007
                          • 6883

                          #13
                          VisibleObject Contains data for color, display character "@ for player, etc", name, and position.
                          This is what I meant by normalization. VisibleObject needs things like a position and an abstract (delegated) Display() method, but the actual symbol it encodes is probably an attribute of some other class (like a monster species, or a feature type, or an object type, etc.)

                          Comment

                          • Sirridan
                            Knight
                            • May 2009
                            • 560

                            #14
                            Alrighty, I'm hoping to get something "playable" done today, where you can at least kill monsters.

                            We'll see how it goes... although I may get distracted trying to free my paladin from the unholy grip of Gorlim's helmet... heh.

                            Comment

                            • Sirridan
                              Knight
                              • May 2009
                              • 560

                              #15
                              I have combat ready to implement, that is collision detection is ready and I know exactly where to add combat code. But yeah, did some code restructuring and as I said collision detection is implemented.

                              Woot!

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎