Announcement

Collapse
No announcement yet.

Coding organization for Clash

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

  • Coding organization for Clash

    Well, we're now up to the stage were we have several coders working in parallel on different areas. Now that we're there, and hopefully growing bigger shortly, we need a serious amount more of organization in the coding area. I am frankly completely out of my realm of competence here. for this reason, I am just going to post my first take on that what I think we should do in terms of coding organization, and let the discussion go on from there. We need to reach some sort of consensus on the topic fairly soon, perhaps by the end of August. Otherwise, chaos will reign.

    I think we need an organizational structure that is as flexible as possible for this project. Due to Real Life glitches that are sometimes unpredictable, even committed individuals will essentially drop out for periods of up to a month or so, and the project needs to be able to make progress despite those problems. A flexible team approach seems to be the best way to handle this.

    I guess what I suggest initially is to break down game areas (e.g. military or main map) by types of competence in programming, for instance graphics, interfaces, model "guts", Internet capabilities, AI, etc. As an example, I think I can do a good job with model guts and AI, but get increasingly less competent, and less interested, as we move into the other areas.

    IMO there should be a programmer in charge of coding the guts for each major functional/model area. For most functional areas of the game we already have dukes to handle them (or hopefully will soon). My view is that combining the dukes in charge of the various areas, with the model guts coders, and with people doing other functional things (interfaces, graphics or tools) gives us fair coverage of what needs to be done.

    For each area, the person doing the guts of the particular model would have to go first, providing javadoc or better documentation of what classes and variables they plan to use. As the organizational structure for the code is built up, there will be very tight communication between the duke and the coder for that area. Once the guts coder has the area outlined, even if they are sidelined for awhile, someone else can pick it up if needed.

    The best level of documentation for each model or implementation area should show private variables and methods also, so that people doing the interface for it, etc. can see what's going on. Then there should be a lower level of documentation that just shows the classes, and methods, that interface with other modules. After that, the interface, graphics, and tools people can start in on their detailed specs.

    What this would mean, is that our people that, for instance, are good at interfaces, could move from area to area starting with whatever is ready first, and not have their unique talents wasted by coding up the "guts" of any particular model. People working in the "flex" areas like interfaces or graphics, should sign up in whatever area they're interested in. When an area's team has enough people with the right skills to do its job, then new participants will have to sign up for some other area. When an area is at the point where it can't proceed much further since it is being held back due to progress and other areas of the game, those team members that can should move on to another area of interest.

    I, and hopefully some others, will try to function as "flex programmers" to move along the areas that are progressing slowly for any of a number of reasons.

    Will my proposal work? I have no idea. But anyway, we can start the discussion, and hopefully have some sort of agreement by the end of August. Clearly we need to plan this out in somewhat more detail. I haven't even begun to discuss low-level things like who has a lock on which part of the code etc.

    Please let the group know what you think. I would especially like to hear from those of you who have done planned coding professionally. I'd like to hear your opinions on how to use your knowledge of how it works in a corporate environment, and how those planning tools might work in an amateur project like ours.

    Mark
    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!

  • #2
    Hi, Mark:

    If I understand this project correctly, we are going to be building a virtural 'world', populating it, and setting events into motion. So, may I humbly suggest as a starting point for discussion:

    We will need a 'Game' class that contains a 'Space' object (a map/world). Then we add a 'Life' object to that 'Space'. Finally we feed the world and it's inhabitants into a a 'Time' object (thread). We will also need some other supportive utility objects (IO, etc).

    The 'Space' object will need to have a 'Map' object and various 'Screen output' objects, including and especially the map displays.

    The 'Life' object will contain 'Player' objects, 'Civ' (non-player civs) objects, and all the AI.

    And the 'Time' object will need threads to control the timeline, 'turn' code for the 'interaction' of world elements, etc.

    So at it's simplest form, Game.class will look something like this --

    import java.whatever.*;

    public class Game
    {
    Time t;
    Space s;
    Life l;
    IO io;

    public Game()
    {
    IO= new IO();

    s = new Space();
    l = new Life(s);
    t = new Time(s, l);
    t.start();
    }
    public static void main(String[] args)
    {
    Game g = new Game();
    }
    }

    *******

    Again, this is just a starting point for discussion only. Please poke holes in it.

    And just remember, free help is usually worth what you paid for it!!!

    Comment


    • #3
      Let me be the first to critique my own concept.

      A little playing convinced me it would be better for the GUI to be it's own class, loaded first, perhaps (or not) containing it's own thread for refreshing the screen when changes have occurred.

      So, how about:

      import java.whatever.*;

      public class Game
      {
      GUI gui;
      IO io;
      Space s;
      Life l;
      Time t;

      public Game()
      {
      gui = new GUI();
      io = new IO();

      Space s = new Space();
      Life l = new Life(s);
      Time t = new Time(l, s);
      }
      }

      Comment


      • #4
        Okay:

        Assuming no one has any massive critical thoughts on this beginning, I'll move on a bit.

        The 'Space' class.

        This object will need a 'generateMap()' method, a 'getMap()' method, 'loadMap()', 'saveMap()', etc.

        So it should look something like:

        public class Space
        {
        public Space()
        {}

        public void generateMap()
        {
        }

        public Map getMap()
        {
        }

        public void saveMap()
        {
        }

        public void loadMap()
        {
        }
        }

        What else am I forgetting?

        Comment


        • #5
          I agree with the concept of your organization for the upper level. I think the names need to be redone, for instance I'd just call 'Space' 'Map' or something similar. Life would just be 'Civs' or some such. I am burnt out after working too hard on a crash project on the job this week, but I'll try to post some more stuff on the topic either sunday or next week. If we keep at it we can thrash something out bit by bit...
          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


          • #6
            Boy, we've had a long week here . . . over 200 people (mostly Cobol programmerz) laid off.

            Many were friends. Ah, well.

            I agree my names are poor. That's never been my strong point. I was operating conceptually, looking for the strongest object-oriented design to enable us to fully model 'reality'. Hence 'Space', 'Time', 'Life' -- just general concepts, large scale 'groups/objects' that will be needed to model reality.

            Do feel free to rename anything. I'm more worried about the general organization of the objects, so that we can achieve a game with more options than any that have come before. The code itself should have no built-in limitations (other than execution speed!).

            Comment


            • #7
              Hi F_Smith,

              Maybe not the best place, but we need to think about the programming of the game.

              My ideas:

              1. We need to develop a common interface for the macro language.
              2. All the possibile game "constants" must write to text files (similar like SMAC and CIV).
              3. Something like a minimal part of the C or Pascal language can be the macro language of the game.
              4. We need to think about to write the speed critical parts and AI parts in java, the rest is in the new macro laguage, so more people can help us to finished the game. (probably more people can write simple rutines in an easy to understand macro language, than in a full power OOP language like Java).
              5. Advantage: The programmer team can concentrate the programming effort to produce the most difficult parts of the game program, like graphics or AI.

              I already sent a sketch of a "new" language (a part of the C language). I'm not a professional language developper. Maybe somebody has better idea(s), or can improve my macro language.

              Blade

              [This message has been edited by Blade Runner (edited September 01, 1999).]
              Blade

              Comment


              • #8
                F_Smith:

                Sorry to hear about the layoffs, that's rough.

                On your overall code organization suggestions, you're clearly right. If we don't split it up like that the main class will be awfully cluttered. I will try and come up with some names, and tweaking of your suggested areas soon.

                Blade Runner:

                1. Is your issue I think... your initial shot at it looked good.
                2. Yes, this is fundamental, I agree completely.
                3. Again you... Do you have a time-frame in which you think it might be ready?
                4. Wow, that's pretty radical. I think, and this is based on no experience , that a system where the macro language "shadows" Java code will work better for most users. By shadows I mean that there is java to do everything, but you can replace any part of it with the macro language. Once you have the macro language developed. I think we should first try your idea with one particular area of the code, and see what we think about that approach. We should clearly discuss this further.
                5. IMO, anyone who can program well enough in a c-like macro language, can easily learn enough Java to do non-specialized programming (i.e. no graphics...) on the "guts" of any game model. So I think the potential gains in this area are not large.

                Having said that, when you get the language up-and-running we should try out your idea, and see how it works. What do others think on this subject?

                [This message has been edited by Mark_Everson (edited September 01, 1999).]
                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


                • #9
                  Um:

                  I kind of have a different take on this.

                  1) The code itself will need to be written in OO 'Component' style (or 'Bean' style, if you're familiar with EJBs). All variables will be 'paramaterized'. That means methods will be provided so that all the variables in the code can be set from outside the code. The game itself needs to be written in Java -- the 'game engine', the graphics, the AI, the IO, etc.

                  2) Man, I wish I could convince ya'll to use XML as the macro language. It's easy, it's cutting edge, and it's all-powerful -- we can add parameters at will, and users can even define their own. And far more accessible to Joe-average. More people can write HTML than have ever written C++.

                  Comment


                  • #10
                    Following F_Smith's descriptions (just altering the names) I propose the following sub-objects for the Game main class:

                    Game class
                    Contains following objects:
                    civs; map; turnHandler; gui; io; worlds; players; What Else?

                    I think everything is self-explanatory except for:
                    * worlds, which are essentially copies of the whole game information that May be used for AI and / or comparison purposes. For instance we could save the game state from Last turn (or 10 or n turns ago) as a world, allowing comparison between now and then of any information on rates of change the player or AI might want.

                    * players, which will start out just holding information on the solo player, but will eventually hold multiplayer support information.

                    Unless someone raises objections to this approach, I will begin migrating the existing clash code over to this model on Monday the 5th.

                    F_Smith:
                    We decided in the meeting today that we will write all the clash code to beans specs allowing trivial use of reflection for the macro language and off-line scenario editor as you suggested. Please check out the meeting thread when you get a chance.

                    BTW, do you know of an easy way to handle a 2d array (the map) with reflection. I may make this the one exception to using standard reflection stuff, since I really don't like making two calls of the normal Array type for every single map operation. It seems it could slow things down quite a bit. Any thoughts? Also, any ideas on the speed penalty for using reflection to access a value vs the old-fashioned way?
                    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


                    • #11
                      Mark,

                      You can define a component (Let say CivMap) with the map array (must be static) and all the map related components what we inherited from this component can DIRECTLY read or write the array.

                      Blade
                      Blade

                      Comment


                      • #12
                        Blade Runner:

                        Yes, I know That. Perhaps I don't understand your comment. The question is, how can you access the array through reflection using the macro language? I have come to the conclusion that this one could be done 'by hand' within the macro language parser. However I wanted to see if there's either a better than the usual way using reflection (as I mentioned above) or if someone had another clever thought.

                        ----------------------------------------

                        All:

                        I've also revised my idea about high-level program structure. Since the main game world and the ones in worlds are Really the same object it should instead look like this IMO:

                        Game (main) class
                        |
                        ...............\
                        mainWorld; turnHandler; gui; io; worlds; players; MacroInterpreter...
                        |
                        .....\
                        civs; map; turnNumber


                        Where mainWorld is an object of type World and worlds contains an array of World instances. Each World instance contains a civs, and map object and an integer turnNumber. This is a little cumbersome, but it means that a copy of mainWorld can just be stuffed into worlds to be saved or modified without further effort. It occurred to me that World objects can also be used for multiplayer support since the server can then merge copies that are sent from the various players gracefully, while keeping a world recieved under each player safe from conflicts with the mainWorld on the host computer.

                        Whatcha think?

                        I will probably hold of on modifying the code to the new model until I get some feedback on this.

                        [This message has been edited by Mark_Everson (edited September 06, 1999).]
                        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


                        • #13
                          Mark,

                          I'm not a Java expert. My idea came from my Delphi experience. If I want to use an array without speed penalty, I produce a common ancestor component, which have all the variables, arrays, lists, etc. what I want to read and write directly. I think (but I'm not realy sure) we can manage the Java Bean components the same way.

                          I.E.:

                          CommonAncestor{}
                          |
                          |
                          Game{}-- Turn{}--MacroInterpreter{}--Something{}

                          If we put the map array declaration in the CommonAncestor component all the inherited components can read and write the array directly. Even the macro language interpreter can inherit form the CommonAncestor, so there will be no speed penalty. On the other side we can use the reflection to reach the least important methodes, variables, etc.

                          In the Delphi system we have a similar possibilty like the reflection. Frequent use this possibilty can slow the system quite well, so I think to use the reflection will cause a big speed penalty too. (The experts books sad NEVER use this possibilty if you have a correct description of the component.)

                          Blade
                          [This message has been edited by Blade Runner (edited September 06, 1999).]
                          Blade

                          Comment


                          • #14
                            Hmmm...

                            I don't like everything having direct access to the map through a common ancestor. That strikes me as even worse OO than making it public. At least if its public you need to call it with Game.map.m[x][y] or so. This slows things a bit, but at least makes it clear it is the main game map you are messing with as opposed to some other world's map. Besides the Common Ancestor class idea gets Very complicated once you move beyond the map and into arrays that govern squares in each province, TFs in each civ etc.

                            We clearly need a timing test for using reflection vs more standard access methods for different things. The things we need to check would be speed for simple property getting and setting, 1-d arrays, and 2-d arrays. We will have to then use that information to figure which speed-critical parts of the macro language need to be 'done by hand' and which ones reflection can suffice for. Clearly any user-hacked classes will require use of reflection unless the user wants to change the interpreter also...

                            Anyone have Java experience with this kind of stuff?

                            --------------------------------------------

                            On another subject, I've done some experiments on the timing penalty for using serialization to automatically make deep clones of objects. Serial Cloning (sCloning) is attractive because you don't have to write a unique clone() method. Conventional clone() methods can get moderately involved for a class that contains many types of objects.

                            My tests used a recent version of Symantec's java JIT compiler. For very large objects (I cloned civs in the current Clash version) the speed penalty for the sClone was only about 20% above the deep clone() I'd made by hand. (in this type of clone java uses native methods to copy the object) For small objects the penalty was huge. This is the expected result considering the overhead of setting up for the sClone. Based on limited timing experiments it looks like setting up the streams for the sClone has an ~ constant penalty of 10ms on my P133 using the JIT. So as a rule of thumb, if your clone() is much faster than the setup time sClone is not the way to go. For Big objects the constant penalty isn't too bad and the convenience of not having to write the whole clone() routine is attractive.

                            [This message has been edited by Mark_Everson (edited September 06, 1999).]
                            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


                            • #15
                              Here are my ideas on the multiplayer part of the game, which will ofcourse need to have its own class like io;guic.

                              First of all, to concernve bandwith(a VERY big thing in this field) the only computer actually calculating the world and its turn will be the host machine. The only thing the client machine(s) will do is give the host the orders the player has made. Then after the host has calculated the world changes( all the things the player doesn't do ) the host machine will send a copy of the new world to the client machine(s), OR if you want to save even more bandwith the host can just send the changes in the world previous from the last one( this will take a bit more programming and memory/processor, so it is either more bandwith needed or more memory used ). But if we have already decided to save previous additions to the map then that will be there anyway, it will just take a lot lot more programming to change ALL the individual variables that have changed on the map from the previous turn. So please respond saying which one you want, the big loss in the changing the map scheme is that the multiplayer class has to have total access to the world class, which is probably a bad idea, so I am leaning towards just the simple method of just sending the whole copy of world over each time.

                              Comment

                              Working...
                              X