Announcement

Collapse
No announcement yet.

Clash Coding Standards Discussion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    I must agree with Mark; while realism and complexity are important, we don't need a
    quote:

    micromanagement nightmare
    =) Basically, how I see it, we don't want to make an Action, Rolepaying, Shooter, Strategy Game; that's overkill.

    quote:

    You can mix and match chassis, bodies, weapons, armor and special abilities to custom-make units. That is the approach I am after here.

    Like Master of Orion Too (Another Great Microprose Stategy)... This is a good idea, and should be implemented sometime in the later stages. As always, this would be by user choice, and there would be plenty of default "units".

    quote:

    I hope when we're done with it, it can be used to play any level of detail.


    Don't think this should be much of a problem =) Looks like thats the basic idea of the game, and that's one of the tings I like most about it, or any other game.

    Comment


    • #47
      Coding Gurus:

      A book I've been reading "Thinking in Java" maintains that it is evil to use inheritance unless you intend to use it functinally thru upcasting to a base class. So use of a Vehicles class is ok if you will have a container of Vehicles that each have their own version of move(), stop(), pickupPassengers(), pickupCargo() etc.

      But the author (Bruce Eckel) says that if your inheriting classes add more methods or variables, then its the sign of bad design.

      Is this becoming-accepted-truth about good OO practice, or is this guy on the lunatic fringe? I'm trying to improve my coding style, and keep getting different messages from the 'experts' .
      Project Lead for The Clash of Civilizations
      A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
      Check it out at the Clash Web Site and Forum right here at Apolyton!

      Comment


      • #48
        I agree that you should use subclassing only if you upcast somewhere. Otherwise, you (ab)use inheritance by tying classes which may share a method but this method is never used per se, thus there is no common semantics to that method. This may mean you avoid copy-paste of code, but if one of your class should evolve, then the second implentation may follow the code change inadvertently, or you may change both codes and end up with an inheritance you don't remember the purpose of. Better to use a third object to which you delegate the common code in that case.

        quote:

        Originally posted by Mark_Everson on 01-04-2001 08:14 PM

        But the author (Bruce Eckel) says that if your inheriting classes add more methods or variables, then its the sign of bad design.




        In java, everything derives from Object, and the author cannot write a book on java and say you should derive from Object without adding methods to your subclasses.
        You couldn't even write main() with such a philosophy!
        What can make sense is that you shouldn't test for subclasses in upcast (through the instanceof construct FE) and then use the additional methods in the upcast.
        Clash of Civilization team member
        (a civ-like game whose goal is low micromanagement and good AI)
        web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

        Comment


        • #49
          In all programming languages theres many ways to do the same thing... Do what feels best to you in most cases, even if it is a little less "proffesional" (except If the easier code takes a lot longer to run or has other problems, of course.)
          Basically: Don't do what authors tell you to do. They likely tell you a) how its supposed to be done in the most ideal situations which isn't always good, or b) what works best for them. Find what works best for you and do it, you dont need to do what some expert says you should.

          Comment


          • #50
            Thanks for your interpretation Laurent. It makes sense to me. I think I was trying to take the author's words a bit too literally
            Project Lead for The Clash of Civilizations
            A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
            Check it out at the Clash Web Site and Forum right here at Apolyton!

            Comment


            • #51
              In heritance is there to be used , and fairly central to OO. However it can be badly used. If you have a large inheritance hierarchy then there probably a problem , but there's probably nothing wrong with a few levels, it depends largely on what your modelling.

              To say subclasses addding methods is bad design is in my opinion twoddle. it's probable that he java creators thought so , take at look at some of the docs and you'll find examples of classes 2,3, or 4 levels down a heirarchy adding methods to their superclases - most Swing or AWT classes spring to mind.

              The most important rule in my opinion is does it make sense in the context of what you are developing.
              e.g an app used in aircraft design may well subclass passenger and cargo planes from parent AirPlane class , but an arcade game probably has one class with a flag for the type to determine score for shooting it.

              don't forget interfaces , in a lot of cases these are probably far more appropiate than a class, the obvious example alluded to above is where the subclass would not really have common code with the parent or siblings. e.g petrol/ deisel / electric cars are probably good examples to subclass from Car Class - they probably share lots of common code , with just a few differences like how they are started. Car and AirPlane though are probably not best SubClassed from Vehicle Class as although they have the same methods ( start , drive , stop or whatever ) the methods would probably be implemented differently for each subclass with no real common code, a Vehicle Interface would be better.

              But as was said earlier do what you feel best with , there are lots of correct ways of doing things

              lee

              Comment


              • #52
                Thanks guys, I'm proceeding ahead, and trying to do things that make sense! I'm trying to make things more encapsulated than I used to, and use casting and inheritance wisely. I think I partly misinterpreted what the author was saying in my bit above also.

                I'll have the demo 5 econ model out by the end of the month. Perhaps it won't be the most refined code, but it'll get the job done!
                Project Lead for The Clash of Civilizations
                A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                Check it out at the Clash Web Site and Forum right here at Apolyton!

                Comment


                • #53
                  One more thing that came up elsewhere and has relevance here.

                  IMO most of the variables in Clash should be floats not ints. This allows the game dynamics to always proceed smoothly rather than jumping around because things are always in discrete chunks. I think this can help us avoid much micromanagement.
                  Project Lead for The Clash of Civilizations
                  A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                  Check it out at the Clash Web Site and Forum right here at Apolyton!

                  Comment


                  • #54
                    I can't comment now because I seem to have forgotten everything I ever learned about Java classes. I'll try to see if I can refresh my memory.

                    Comment


                    • #55
                      Is there any standard for tests?
                      What I read about Extreme Programming went as "do a lot of tests". I also know people whose policy is 1) define the API 2) code the tests 3) fill the API with actual code.
                      I suggest we should have packages like game.data.military and each such package would have unit tests like game.data.military.test.
                      That way tests are easy to find and can be removed fast from the real game.
                      Any comments?
                      Clash of Civilization team member
                      (a civ-like game whose goal is low micromanagement and good AI)
                      web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                      Comment


                      • #56
                        Well, I personally think Integers are fine, as long as you leave a wide variation open for them (maybe 1-200 instead of 1-20 as it is in civ2 pretty much) Basically you can still get the same level of detail while it is easier to understand, edit and customize.

                        Comment


                        • #57
                          Laurent:

                          Your suggestion sounds reasonable to me. I was hoping some of the other coding pros would discuss... but for now we can do it your way. Lord knows I have generated enough tests already in coding the econ part!

                          Twinge:

                          I just don't agree. If you have 200 integers, there aren't big jumps anymore, but you still need to keep track of a reservoir to say when the integer goes up! So it just seems counterproductive to me. Now, the Player need not see the floats, and probably Should Not see most of them.

                          Can you explain to me why integers are easier to understand, edit and customize? The player will only see "Metallurgy tech level = 37" in either case...
                          Project Lead for The Clash of Civilizations
                          A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                          Check it out at the Clash Web Site and Forum right here at Apolyton!

                          Comment


                          • #58
                            Hey Rüdiger:

                            We are using Java 2 for the forseeable future. I don't have any experience with the free IDEs, but I'm sure you can get some good info on the newsgroups if not from someone in the project itself. Gamedev.net also has a decent java programming forum with a focus on game development of course. Its here: http://www.gamedev.net/community/for...va+Development .
                            Project Lead for The Clash of Civilizations
                            A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                            Check it out at the Clash Web Site and Forum right here at Apolyton!

                            Comment


                            • #59
                              Hi!

                              I am new to Clash, and I hope I will be of help in the programming department.
                              I would like to know what development environment you use for coding java, if any at all. I am asking, because it`s been some time since I last used java, and I have seen there are several IDEs available for free.
                              Besides, what version of Java are you using?

                              Comment


                              • #60
                                And now for something completely different:

                                I volunteered to code the Map Generator and had a first look over the code that Mark sent me. I have seen that strings are often used as parameters for function calls. Isn't that a little slow, parsing strings "all the time"? Maybe one of the more experienced programmers could answer that?

                                ----

                                Programmers don't die, they just GOSUB without RETURN.

                                Comment

                                Working...
                                X