Blengband - 3D angband in development

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jplur
    Scout
    • Oct 2009
    • 31

    #16



    I'm getting to a comfortable pipeline for the monsters. So far 4/50 done.

    As for using classes I'm trying to figure out the advantages. I ran a benchmark test and they're a bit slower to use. I guess attaching functions to the objects could be useful.


    Code:
    Data Types Benchmarking Test:
    TestNumber: 10000
    TestData: ['string', 45, 213, 'flag']
    Make a list of Lists:           0.00896666615881
    Make a list of Dicts:           0.0205114743512
    Make a list of classes:         0.0233675179952
    
    Reading the lists:              0.00368395061378
    Reading the dicts:              0.00413803981428
    Reading the classes:            0.00895489892719

    Comment

    • Pete Mack
      Prophet
      • Apr 2007
      • 6697

      #17
      Is 1 microsecond per operation really going to make a difference? I expect the gfx is going to be the part that needs optimization.

      Comment

      • zaimoni
        Knight
        • Apr 2007
        • 551

        #18
        This is testing speed for basic operations that are going to be done en masse. Better to find out now than later.

        Based on those numbers, I'd probably go with dicts over classes for a first attempt. It may only be microseconds now, but Python is very sensitive to whether supposedly immutable data types are being churned over into garbage quickly.

        Any advantage with lists (the one internally mutable data type in Python) is going to vanish the instant one has to deal with the indirection from readable names to numerical indexes. They're usually the best native Python structure for anything that "should be" an array.
        Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
        Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
        Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

        Comment

        • Remuz
          Apprentice
          • Apr 2007
          • 75

          #19
          Without adding much to the debate, or even offering any help, I have to say that I am impressed by this project. Monsters look very nice, and if you can produce something playable, I will definitely be one of those playing it.

          Good job!

          Comment

          • Derakon
            Prophet
            • Dec 2009
            • 8820

            #20
            For now, you should be concentrating on writing clean, easy-to-read code. Later, if you find out that you're running into speed problems, you can profile the program and find out what's actually slowing you down. Remember Knuth! "About 97% of the time, premature optimization is the root of all evil." I'd lay good odds that the use of classes is not going to be even close to your primary source of slowdown. That's almost certainly going to be in graphics display, physics calculations, or AI/pathfinding. Those three are the classic sources of slowdown in games, after all.

            Comment

            • zaimoni
              Knight
              • Apr 2007
              • 551

              #21
              Originally posted by Derakon
              For now, you should be concentrating on writing clean, easy-to-read code. Later, if you find out that you're running into speed problems, you can profile the program and find out what's actually slowing you down. Remember Knuth! "About 97% of the time, premature optimization is the root of all evil."
              True, but irrelevant. The cited test wasn't optimization. It was testing undocumented features of Python, that are useful in deciding whether the programmer time cost for Python object orientation is defensible.
              Originally posted by Derakon
              'd lay good odds that the use of classes is not going to be even close to your primary source of slowdown. That's almost certainly going to be in graphics display, physics calculations, or AI/pathfinding. Those three are the classic sources of slowdown in games, after all.
              True. And all three have an implementation choice: whether to favor lists, dicts, or classes.
              Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
              Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
              Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

              Comment

              • Derakon
                Prophet
                • Dec 2009
                • 8820

                #22
                If you feel that lists, dicts, and classes are all equivalent choices as far as ease of development, ease of reading, and ease of debugging are concerned, then sure, go with the one that's fastest. Personally, I find classes to be more readable than dicts, and lists to be an entirely different ballgame.

                Comment

                • jplur
                  Scout
                  • Oct 2009
                  • 31

                  #23
                  Hey, thanks for the input guys. I decided to go with classes, you can see what I came up with here:

                  definitely more readable, and I'm seeing uses for attaching functions to the objects.


                  Tonight I guess I'll start working on inventory, and all the associated command menus. I'd like to have a playable demo with melee and ranged weapons within a month.

                  Comment

                  • konijn_
                    Hellband maintainer
                    • Jul 2007
                    • 345

                    #24
                    Originally posted by jplur
                    Hey, thanks for the input guys. I decided to go with classes, you can see what I came up with here:

                    definitely more readable, and I'm seeing uses for attaching functions to the objects.


                    Tonight I guess I'll start working on inventory, and all the associated command menus. I'd like to have a playable demo with melee and ranged weapons within a month.
                    There is this great science fiction story where we are all part of an experiment with built in safe guard controls so that the experiment doesnt go haywire. So scientists that are about to discover that we live in a simulation/experiment die from a mysterious disease; but leave enough evidence that humans get closer and closer to understand reality so that ultimately we'll break through the safe guards etc.

                    Anyway, all that to say that many coders are trying to code Angband in a scripting language, and we're all advancing but not yet quite getting to the ultimate goal

                    Here's the js hellband source for monsters, not much different from yours.




                    T.
                    * Are you ready for something else ? Hellband 0.8.8 is out! *

                    Comment

                    • Derakon
                      Prophet
                      • Dec 2009
                      • 8820

                      #25
                      Javascript? Now I've seen everything.

                      I've considered writing a roguelike in Python (not using Blender as a backend, though), but given the number of other projects I have that aren't getting attention, it's not gonna happen. Procedural content generation is nifty stuff, though.

                      Comment

                      • jplur
                        Scout
                        • Oct 2009
                        • 31

                        #26
                        I made a new tileset and expanded the ceilings in rooms 3x. The skylight tile is
                        for the first few levels where rooms are lit. A player with no lightsource should't
                        be able to see much in tunnels or lower rooms.



                        Comment

                        • Derakon
                          Prophet
                          • Dec 2009
                          • 8820

                          #27
                          So are we going to need a mod where we can tape a lantern to our longswords?

                          Looking good! I never was much use at low-poly modeling myself. How much experience do you have modeling, anyway? And what about animations? (Now that is something I consider myself to be marginally decent at)

                          Comment

                          • jplur
                            Scout
                            • Oct 2009
                            • 31

                            #28
                            Ha, yeah i guess the player light will just be magically hovering.. at least the light color and radius should reflect what you're using.

                            Texturing and modeling are my strong points. I'd love some help with the animations, and there will be a lot. Each enemy model will need its own set, walk, sleep, die. For things like attacking or taking damage they probably need a couple variations, so an orc pit doesn't go into synchronized convulsions when you cast a fireball inside it.

                            Comment

                            • Nick
                              Vanilla maintainer
                              • Apr 2007
                              • 9351

                              #29
                              Originally posted by jplur
                              For things like attacking or taking damage they probably need a couple variations, so an orc pit doesn't go into synchronized convulsions when you cast a fireball inside it.
                              I think synchronised convulsions would be great.
                              One for the Dark Lord on his dark throne
                              In the Land of Mordor where the Shadows lie.

                              Comment

                              • getter77
                                Adept
                                • Dec 2009
                                • 210

                                #30
                                Originally posted by Nick
                                I think synchronised convulsions would be great.
                                He's right....get them to do the wave with a beam spell!

                                Even better, imagine how nice that would look on a birth option screen to all comers "Synchronised Convulsions Y/N?"

                                Comment

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