Announcement

Collapse
No announcement yet.

Program structure for an easy to modify game

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

  • Program structure for an easy to modify game

    I have a game structure outline in my head:

    Program language, macro language and the possibilities to modify the game.

    Program layers:

    I. Interface, graphics, AI layer. They are time critical, so we need to use the possible speediest solution: Java codes with JIT or Hotjava or anything in that time, which can produce the quickest code.
    II. Control files, decision trees, event generators, unit, tile and event related codes. We can use Jpython, which is free to use in non-commercial AND COMMERCIAL Java applications. We can ask our non-programmer members to write or change the code inside these parts of the program because the Python is easier to use and understand language than the Java. (see my thread-> Programmers: macro possibility)
    III. Unit, tile, resources, etc... descriptions, use the python syntax. Python is very good to produce easy to read and understand lists, because:
    a) You needn't declare the variables (like in Basic).
    b) Not case sensitive.
    c) The Python interpreter can directly use the Java variables.

    So basically we can use Java and the Jpython interpreter to produce the complete game system, and we can provide for our gamers an easy to use but powerful macro language to modify the game.

    Graphix:

    We can use 2D and not animated graphics. This has 2 advantage:
    1. We needn't produce special tools for us and for our gamers to modify the graphics of the game.
    2. Speed, speed, speed!

    Anyway, for me is evident to use minimum the CTP or SMAC like possibilities to modify the behaviors, looks, rules. The only thing, which is important from the beginning, is to avoid the hard coded variables, constants, lists and arrays (except graphics and AI). Later we can easily change something to hard code, the another way is not so easy.

    The most important variables and constants which needs to go to text files.
    Civs: civ name, ruler name.
    Interface text (like button, menu and messages)
    Units: unit names, graph. path, unit rules behaviors.
    Tile: tile graph. path., tile econ. and moving rules.
    Province: rules, graph path.
    Economy: rules.
    Tech tree: tech names, graph path, advantages, short description. (A parser can check if the tech tree is valid in the beginning of the game)
    Help files (game, interface, units etc...)
    Governments: name, graph path, rules.

    There is a lot more but I think is enough for the start. Please comment and send your ideas, lists.

    Thanks,

    Blade Runner

    [This message has been edited by Blade Runner (edited June 03, 1999).]
    Blade

  • #2
    Just curious -

    Re: Python

    Don't forget that we're all part-timers; are we programmers expected to learn another programming language syntax as part of this project? Or are we going to have to recruit Python programmers?

    I don't really care, since I'm a student (always keen to learn) and the summer holidays are looming, so I'll have free time in abundance.

    I'm thinking more about those who have 9-5 jobs etc....

    Jim

    Comment


    • #3
      Jim,

      We need something (a macro language) to provide a tool for our gamers to change/modify the game.

      I.
      OK, let see the possibilities:
      1. We can use a ready made embedded language.
      2. We can develop an own language.
      3. We can "free" a few of our code.
      4. We can use just text files without "real" programmability.

      I really think about all the possibilities but I find out the possible biggest advantage with the less effort came from the 1. Maybe we can think about the 3. one, but I'm afraid there will be not to many gay, who can successfully wrestling with a full power OO program language like Java.

      I can estimate a few days learning cycle to learn Python, which was written to use an embedded macro language for users to write code for C, C++ or Java applications. You can think about like a Visual Basic for Application but more powerful AND easier to use. Fortunately Python lack the stupidity of the BASIC.

      II.
      Not every programmer needs to use Python. Which is the nice thing we (the programmers) can pass the control tasks, unit descriptions etc. to the game designers. Even they can understand and use this tool (of course with our help and control) to develop a big part of the game. Shortly: when the designer think about some new thing he needn't pass the task to a programmer and wait when he'll be ready, but he can himself try the idea immediately.
      In the other hand we can experiment what we need to provide for the gamers to help they to produce good scenarios.

      Thanks for the replay,

      Blade Runner
      Blade

      Comment


      • #4
        BR:

        Well, I looked at the Python snip that you put in the other thread



        mport org.python.util.PythonInterpreter;
        import org.python.core.*;
        public class SimpleEmbedded {
        public static void main(String []args)
        throws PyException
        {
        PythonInterpreter interp = new PythonInterpreter();
        System.out.println("Hello, brave new world");
        interp.exec("import sys");
        interp.exec("print sys");
        interp.set("a", new PyInteger(42));
        interp.exec("print a");
        interp.exec("x = 2+2");
        PyObject x = interp.get("x");
        System.out.println("x: "+x);
        System.out.println("Goodbye, cruel world");
        }
        }



        and I doubt that anyone except a C or Java programmer would have a chance of writing a script like that.

        The way I think of these scripts, is a user-defined set of logic that the AI [for a particular function] will do. We want, I think, to let the basic steps be clear, and in plain text. The closest I can think of at the moment is VBA--the Microsoft appl.lang. for all their suite of office apps. It has syntax that a non-programmer would have a chance to understand:

        DO until (condition)
        IF (condition) then ...... else ......

        I hate to say it, but we might have to define our own script protocol for the user-written scripts.

        The power and flexibility of Python or another technical script language is of little use if only WE can use it.

        Comment


        • #5
          Druid2, Jimc,
          I download the Python description and read it. The Python language is easy to use and understand. IMHO easyer to use than VBA and not only for me or for the programmers but for the users too. The language contain a lot of very powerful expressions. I.e. it has the next structure (from the Python description):
          The for statement in Python differs a bit from what you may be used to in C or Pascal. Rather than always iterating over an
          arithmetic progression of numbers (like in Pascal), or giving the user the ability to define both the iteration step and halting
          condition (as C), Python's for statement iterates over the items of any sequence (e.g., a list or a string), in the order that they appear in the sequence. For example:

          >>> # Measure some strings:
          ... a = ['cat', 'window', 'defenestrate']
          >>> for x in a:
          ........print x, len(x)
          cat 3
          window 6
          defenestrate 12
          This was only one. Please just look once the next site: www.jpython.org

          So this is very user friendly. And my other example was for us to show how easy include this language to the game code. That example use JAVA code and not Python code. Of course the users NEVER need to change the JAVA code.

          Blade Runner

          [This message has been edited by Blade Runner (edited June 04, 1999).]

          [This message has been edited by Blade Runner (edited June 04, 1999).]
          Blade

          Comment


          • #6
            BR:

            I looked at some of the sample JPython scripts. Maybe I'm wrong, but I still cannot see how a mostly non-programmer, but somewhat PC literate user can produce that kind of code.

            I think we want scripts to look something like:



            CityGovernorScript:
            For each City

            If (CityUnderAttack) then

            (SetMilSpending) to maximum
            (Produce: DefenderUnit)

            else

            (SetMilSpending) to 50% of max
            (AllocateFreeResources) to Research

            end if

            end for
            exit script




            I think that sort of logic *might* be doable by a user, certainly would be by a semi-programmer. But would he have a chance of producing [btw: I'm sure there are syntax errors, etc. in the following attempt at Python script.]


            for city in cities

            if CityUnderAttack == 1 :

            try:

            SetMilSpending (maximumMilitary)
            Produce (DefenderUnit)

            except:

            SetMilSpending ((0.5 * maximumMilitary))
            AllocateFreeResources (Research)

            finally:

            exitScript()





            PLEASE, dont get me wrong. I'm completely open to any script language that can be read, created and easily interpreted by an average PC-literate user. If Python can do that, fine... if not, we have to find something else or create our own.


            [This message has been edited by Druid2 (edited June 05, 1999).]

            Comment


            • #7
              Druid2,

              Good point. I think in the US or anywhere else the first computer language in the school usually some BASIC version. (And the VBA is also very popular.) I search and find a BASIC version, writen in JAVA.
              Sure Python has advantage, but you are right, we need to find the common knowledge of our gamers, and that is probably BASIC.

              Kull,
              What I offer is a three layer system. For that stuff of the game which need special event handling (i.e. The American emperium discover the Nuclear Fission.) I plan to produce some kind of easy to understand "program language". All the other information which is static (Unit, map, tile, civilization, game rules, game options) we will provide ready made programs for the users to modify the data. If you want to modify your game to produce scenario you need only change the game through the scenario editor. If you want to do something sophisticated you must write or modify or middle layer code. Don't worried, you can change the game system like with the CIV2 scenario editor without touch the BASIC coded part of the game.

              Thanks for the replay,

              Blade Runner
              Blade

              Comment


              • #8
                Blade Runner:

                Your system looks good to me. Good work, and good luck on gettin' the right scripting language...

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

                Comment


                • #9
                  This sounds like it's on the right track...

                  Level 1 - internal AI: some AI built into the Java code.

                  Level 2 - public AI code modules: some AI in some 'programmer-modifiable' code that we make public.. could be Python, VBA or even Java.. If a programmer's going to modify it, why make it hard on ourselves? I'll bet more people know Java than Python.

                  Level 3 - Non-Programmer AI controls: and some .. err.. make it LOTS of options on a "Province Governor AI Screen" and so on...

                  then we just interpret the options selected.

                  Parameter driven AI that the user can easily select the parameters, and priorities. The screen gives him many choices, but they are not UNlimited choices, as it might be in a script.


                  [This message has been edited by Druid2 (edited June 05, 1999).]

                  Comment


                  • #10
                    Druid2,

                    Level1 and 3. OK.

                    Level2 -> I agree. The best choice to include a few Java coded modul. If somebody can write a good AI, 100% sure He/she can write Java or C++ code.

                    Blade Runner

                    [This message has been edited by Blade Runner (edited June 05, 1999).]
                    Blade

                    Comment


                    • #11
                      Hey, maybe my general programming cluelessness will have some use after all!

                      At work, I fit into what you'd call the "power user" category. That means I can automate a lot of tasks using Business software such as Excel and Access, even turning out some fairly complex "systems". That means my programming skills max out at limited VB utilization. So if I can't figure out how to use the Macro language, my guess is that most others will be stymied as well.

                      Now, my next comments are based on this assumption:

                      We are talking about a method by which the game users can change it's parameters (scenario building), not the one coders will use to build it.

                      That said, I've looked at both Druid's script and Blade Runner's. Druid's is somewhat more intuitive, but both will send a novice racing back to the comfort of the standard interface. Powerful IS good, but can't we hide the "writing process" inside a friendly editor? Something more on the line of "City Governor AI","Review AI Options". Then a box appears showing all the AI selections. Perhaps the first is an either/or choice, "Defer to Civ-level AI" or "Local Autonomy". You pick local, then move to the spending column and type 100 in the military cell.

                      Maybe not the best example, but hopefully you see where I'm going.
                      To La Fayette, as fine a gentleman as ever trod the Halls of Apolyton

                      From what I understand of that Civ game of yours, it's all about launching one's own spaceship before the others do. So this is no big news after all: my father just beat you all to the stars once more. - Philippe Baise

                      Comment


                      • #12
                        "A Point. Have one!"

                        That said, the "takeaway" from my last post should have been this. If you decide to use an interface between the user and the code, then simply focus on which code is "best". If not, and the user has to burrow into the language in order to enact changes, then clarity and simplicity should be your guidelines.



                        [This message has been edited by Kull (edited June 05, 1999).]
                        To La Fayette, as fine a gentleman as ever trod the Halls of Apolyton

                        From what I understand of that Civ game of yours, it's all about launching one's own spaceship before the others do. So this is no big news after all: my father just beat you all to the stars once more. - Philippe Baise

                        Comment

                        Working...
                        X