Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Alternative Civs > Clash of Civilizations > Program structure for an easy to modify game
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
04.Sep: `FC` 2.0.5 COMPLETED AND RELEASED
27.Jul: `FC` 2.0.4 COMPLETED AND RELEASED
16.Jul: `FC` 2.0.3 COMPLETED AND RELEASED

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Blade Runner is offline Blade Runner
Prince
Belgium
Jan 1970
time: 06:13
  Old Post 03-06-1999 22:19
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Program structure for an easy to modify game Support Apolyton buy from Amazon

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).]

JimC is offline JimC
Chieftain
Birmingham, England
May 1999
time: 05:13
  Old Post 04-06-1999 01:48 Visit JimC's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Got spare money?

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

Blade Runner is offline Blade Runner
Prince
Belgium
Jan 1970
time: 06:13
  Old Post 04-06-1999 13:57
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

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

Druid2 is offline Druid2
Warlord
Dallas,TX
May 1999
time: 05:13
  Old Post 04-06-1999 20:22
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton buy from Amazon

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.

Blade Runner is offline Blade Runner
Prince
Belgium
Jan 1970
time: 06:13
  Old Post 04-06-1999 23:32
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Full PM-box? Change here!

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):
quote:

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).]

Druid2 is offline Druid2
Warlord
Dallas,TX
May 1999
time: 05:13
  Old Post 05-06-1999 09:33
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Call to Power 2

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).]

Kull is offline Kull

King
El Paso, TX USA
Mar 1999
time: 22:13
  Old Post 06-06-1999 09:31 Visit Kull<br><a href=/members><img src=/forums/images/lifer-icon.gif border=0></a><BR>'s homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Help yourself to an AD-FREE life

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.

Kull is offline Kull

King
El Paso, TX USA
Mar 1999
time: 22:13
  Old Post 06-06-1999 09:50 Visit Kull<br><a href=/members><img src=/forums/images/lifer-icon.gif border=0></a><BR>'s homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Lose 30 kilos (of popups)

"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).]

Blade Runner is offline Blade Runner
Prince
Belgium
Jan 1970
time: 06:13
  Old Post 05-06-1999 23:58
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Call to Power 2

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

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
  Old Post 06-06-1999 00:11 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Increase the size of your Attachments

Blade Runner:

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

-Mark

Druid2 is offline Druid2
Warlord
Dallas,TX
May 1999
time: 05:13
  Old Post 06-06-1999 01:06
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton buy from Amazon

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).]

Blade Runner is offline Blade Runner
Prince
Belgium
Jan 1970
time: 06:13
  Old Post 06-06-1999 01:58
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy Civilization 2

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).]

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:13.
Apolyton Time is 00:13.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0461 seconds (91.44% PHP - 8.56% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net