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 > Clash Coding Standards Discussion
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   
Pages (4): [ 1   2   3   4   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:13
Post  Old Post 23-02-2001 18:32
Edit/Delete Message Reply w/Quote
#61 Report this post to a moderator
Remove this text

I don't think it is slow because the strings are often short. Furthermore, this allows for a lot of flexibility. You can change a string easily. If you use things like C enums (day you have a set of static ints), it requires your knowing all the possibilities up-front, which effectively constrains you a lot. Your code will be much harder to evolve.
If performance is an issue, you can usually tackle it later and you might change the strings into ints to make it faster at that time, but I doubt that string parsing will be a performance bottleneck.

quote:

Originally posted by Rüdiger on 02-22-2001 08:54 AM
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.


Blade Runner is offline Blade Runner
Prince
Belgium
Jan 1970
time: 06:13
Thumbs up  Old Post 05-03-2001 20:38
Edit/Delete Message Reply w/Quote
#62 Report this post to a moderator
Remove this text

Hi All,

I think in this stage you have to make decision which part of the code must be hard coded, which part can go to script, and finally which part is the best to put in easy to modify text files. I was looking for good quality script language for the Clash project, and I found a quite sophisticated JavaScript engine: http://www.home.worldcom.ch/~jmlugrin/fesi/ . It is freeware, but it can be a part of normally sold software too. The only restriction is, the developer must put the source files of the interpreter together with the software. I think this is the best script engine for Java. (Believe me, I did quite a research to find something useful.) To develop something on he same or similar level could be somewhere between 1/2 year to 1 year hard work. If I can give you more advice: don't hardcode anything like technology tree or unit statistics into the game engine. Put it instead into the script code or even better into text files. To maintain a kind of code quality level I suggest following a coding standard + use a source control system + elect one person (is it you Mark?) who is responsible to put the program parts together.


By,


Blade

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:13
Post  Old Post 06-03-2001 00:13
Edit/Delete Message Reply w/Quote
#63 Report this post to a moderator
Got spare money?

I agree that most things should go in text/script files.
I think I posted on some military thread some example of what I proposed. It was basically xml. I have downloaded Xerxes (apache.org's java xml parser) that I could tinker with, but F_Smith said he had or would have a parser himself so I wait for a while before trying to use the xml parser.
In the meantime, units are coded but it is quite easy to change that as soon as a format has been decided. xml is interesting because, although it forces you to write lots of <, > and such, you can also easily skip whatever can be left to default. For instance, you don't repeat patterns of 00000000 for every unit the way it sometimes looks like in some civ2 files.

Richard Bruns is offline Richard Bruns
King
NC, USA
Nov 1999
time: 06:13
Post  Old Post 06-03-2001 00:26 Visit Richard Bruns's homepage!
Edit/Delete Message Reply w/Quote
#64 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

Nothing about the tech trees will be hard-coded. The only things to be coded will be the mechanics, which are very flexible, and an editor for a non-coder to input everything about the tech tree. The basic game tech tree will be created with tools that any scenario designer has access to.

Since we have so few coders anyway, this is how most models probably will be done. The kernel is coded, and all of the details are added by non-coders.

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:13
Arrow  Old Post 23-03-2001 21:05
Edit/Delete Message Reply w/Quote
#65 Report this post to a moderator
Full PM-box? Change here!

Gary mentioned Xerces in some other thread. Do you use sax or DOM or what beyond the parser? Can we decide on a xml parser/technique common for all of us (kind of Gary has one, we should take it, unless F_Smith has another one to propose)? (I still have Xerces sleeping in my folders somewhere...)

Mark, what do you think?

If we decide on a parser technique, I may start to do it for military units (which will have me debug my wrong xml file insteda of wrong java for badly balanced TFs )

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 24-03-2001 10:02 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#66 Report this post to a moderator
Support Apolyton, buy Civilization 2

Laurent:

I have no knowledge to bring to bear on a parser discussion... I agree we should select one soon, and it sounds like Xerces is pretty good. Perhaps you should email Gary and ask him for the code that uses xerces, which you could use as a template. F_Smith's real life attack continues, so I think we just need to make the decision and move on... Demo 5, which I'm taking over getting out, will still use his old parser just so I don't need to change too much. But we could put both in if needed...

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:13
Post  Old Post 26-03-2001 06:53
Edit/Delete Message Reply w/Quote
#67 Report this post to a moderator
Increase Your PM Length

I have just re-read this thread. My XML parser is based on the Apache xerces 1.3.1 system which provides a lot of facilities (including DOM and SAX). The DOM system reads in the whole XML file into a tree system. I am not familiar with its inner workings. The SAX system is an interface to read specific XML elements. It is a set of listeners (I am old fashioned, I still think of them as callbacks) for such events as "start of a new element", "character data in an element", "end of an element", plus a dozen or so more exotic listeners. You have to provide an implementation of an interface called ContentHandler to deal with these listeners.

My class uses a simpler interface, consisting of two methods, isOfInterest, which inform SAX whether you are interested in an element, and endElement, which returns the most recent element of interest and all its subelements. There are methods to extract relevant data from these subelements.

It does not have provision for dealing with properties of elements (though SAX does have taht facility), but that could be added quite easily.

My immediate problem with the class is that it needs the whole XERCES.JAR file (about 1.5Mb - it will not fit on a floppy!) but only uses a small part of it. One of my work projects is to extract the relevant parts from the xerces source and make a mini jar which provides just the material requires for my SAX classes.

Cheers

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 26-03-2001 07:11 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#68 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

If we were to go with Xerces, does the license allow lopping off bits of it for distribution? If not, that would be a problem long-term although we could use it for now.

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:13
Post  Old Post 28-03-2001 03:00
Edit/Delete Message Reply w/Quote
#69 Report this post to a moderator
Inflate your Upload Space

This is the Xerces Licence:

quote:


/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ==================================================
==================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* .
*/


I do not think we will have any problems.

Cheers

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:13
Post  Old Post 28-03-2001 03:06
Edit/Delete Message Reply w/Quote
#70 Report this post to a moderator
Support Apolyton buy from Amazon

I posted the following in the tech thread. Mark suggested I repeat it here for everyone's amusement.

"I do not think that one should program for futures. That is, if something isn't actually in the model, it should be left out, and added later if necessary. There is an extensive literature (starting with Kent Beck et al in the XP web site) all of which says the programming for something that might be used is counter-productive. I refer you to website at www.xprogramming.org. However, here is a quote from that website:"

quote:


You’re NOT gonna need it!
Often you will be building some class and you’ll hear yourself saying "We’re going to need...".

Resist that impulse, every time. Always implement things when you actually need them, never when you just foresee that you need them. Here’s why:

Your thoughts have gone off track. You’re thinking about what the class might be, rather than what it must be. You were on a mission when you started building that class. Keep on that mission rather than let yourself be distracted for even a moment.

Your time is precious. Hone your sense of progress to focus on the real task, not just on banging out code.

You might not need it after all. If that happens, the time you spend implementing the method will be wasted; the time everyone else spends reading it will be wasted; the space it takes up will be wasted.
You find that you need a getter for some instance variable. Fine, write it. Don’t write the setter because "we’re going to need it". Don’t write getters for other instance variables because "we’re going to need them".

The best way to implement code quickly is to implement less of it. The best way to have fewer bugs is to implement less code.

You’re not gonna need it!



It is a website well worth checking.

Cheers


Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 28-03-2001 03:51 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#71 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

Hey Gary, the Xerces license looks great! Can't ask for much more than that! Thanks for reposting the quote.

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Question  Old Post 04-04-2001 06:52 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#72 Report this post to a moderator
Support Apolyton buy from Amazon

I am curious about what people think are the best way to handle keypresses. Right now I'm using a simple KeyListener for the map, since its easy to redirect some other GUI element to send its key presses to the map for processing. What do the Java Jocks Say?

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:13
Post  Old Post 05-04-2001 01:35
Edit/Delete Message Reply w/Quote
#73 Report this post to a moderator
Support Apolyton buy from Amazon

As a matter of habit I would probably use an Action listener (extending AbstractAction). The main effect is that any kind of input can then be directed to the same listener: keyboard, mouse or button click, insulating the application code from the GUI.

See "Core Java, Volume 1, Fundamentals", p352

Cheers

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Smile  Old Post 07-04-2001 04:48 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#74 Report this post to a moderator
Tired of ads?

Thanks Gary. For now I'm just gonna leave it as it is. But when I add something new (if I still have the misfortune to be doing gui stuff ) I'll try it your way.

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:13
Question  Old Post 11-04-2001 15:15
Edit/Delete Message Reply w/Quote
#75 Report this post to a moderator
Support Apolyton buy from Amazon

I am busy implementing the parser to read xml files and translate that into
1) military unit types
2) actual military units on the field.
I'm using xerces/sax. Here is how I plan to use the tags: For each tag I create a class that handles that tag, and put all those tag-handlers in a stack so I know "where" the current tag is.
I think this is less memory-demanding than using dom or a tree, but it seems so straightforward to me that I'm afraid there is a catch somewhere. The skeleton code (the interpreter) could even be generated from a DTD so I don't understand why the people of xerces didn't do it (or maybe I missed it).
Anyone sees a flaw with that design?

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 11-04-2001 15:58 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#76 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

Hi Laurent:

You and Gary should definitely talk this over to make sure you're using similar approaches, since the two of you are doing the XML stuff at the moment. You lost me on the vocabulary half way thru the post, so I don't think I have anything germane to say about the technical details.

"actual military units on the field" If you mean you want to save every single unit in the active game in XML I personally think this is a waste. They should just be saved as binary using serialization IMO. XML will be prohibitively large to save everything in the game, and should I think be only used for initialization files.

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:13
Post  Old Post 13-04-2001 14:01
Edit/Delete Message Reply w/Quote
#77 Report this post to a moderator
Support Apolyton buy from Amazon

Sorry, just saw this one.

I have been using a small part of the Xerces SAX implementation. As it happens DOM would work well for our system where you want to read in the whole file. Since I used code that I developed for work, I used SAX, which has the advantage that it can skip anything it isn't interested in.

My stuff is finished and tested (for the tech model). I would be happy to email you the source code for you to check for your purposes. For obvous reasons it would be better if we used a uniform pattern.

I intend to extract, from the Xerces source code, the part relevant to what we do and use only that (rather than the whole of Xerces - 1.49MB in jar format). Because this is relevant to my work, and because I get paid an obscene amount per hour for work, I prefer to do this at work. Unfortunately, I cannot always set the priorities in that area, so it is still on hold...

Send me (gthomas@takaro.co.nz) your email address and I will send you a zip file with the xml package.

Cheers

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Arrow  Old Post 19-04-2001 03:51 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#78 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

Code package proposal:

Gary made a good suggestion that we change the package game.data to game.model since its not just data, but whole models that are in there.

Unless someone objects, I'd like to make the change the next time I have everyone's work unified I'll make the changeover.

Anyone disagree with the change?

And also I would like to change the main dir name to ClashD5. Its a better name than the AlphaClash... I've been using, and it will leave each of us a set of direcories with milestones of the project as we move on to demos 6 and 7.

Again, does anyon object? If not, I'll make that change the same time as the other stuff.

-Mark

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Arrow  Old Post 22-04-2001 18:40 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#79 Report this post to a moderator
Support Apolyton buy from Amazon

Ok, I'm going to make the changes above today, or as soon as I get the most recent code from everyone. The (new) model package will go in ClashD5\game\model

I'll put the tiles semi-permanently in ClashD5\class\tiles\ (Maybe it should just be ClashD5\tiles\ ?

I'll put the class files in ClashD5\class\ so I don't have source and class files all jumbled together. I will also put the xerces.jar file in that dir since then it'll be on the classpath.

Other suggestions, criticisms?

[This message has been edited by Mark_Everson (edited April 22, 2001).]

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:13
Post  Old Post 23-04-2001 16:02
Edit/Delete Message Reply w/Quote
#80 Report this post to a moderator
Help yourself to an AD-FREE life

We need a place to store resource files (xml). I suggest they go in a directory at the same level as the tiles: class/resources for instance. I'll send Mark my xml file for military units as soon as I can and put some code in UnitBuilder to read the file. I believe a common service to locate the resources should be provided. Where is the class/tiles path stored? Can we reuse that to build the military units (which are model, not view)?

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 23-04-2001 16:49 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#81 Report this post to a moderator
Inflate your Upload Space

Yeah, that's right Laurent, we should figure out how to do that stuff now. I'll leave the discussion to the pros, who will actully know what they're talking about .

The tiles path is now stored in the file where its used. I agree we should look for a scalable and consistent way to handle this.

IIRC when we go to a jar file we may need to use getResource anyway. Is that right? If so, we should move to a system using that.

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:13
Post  Old Post 24-04-2001 00:31
Edit/Delete Message Reply w/Quote
#82 Report this post to a moderator
Support Apolyton or Terrorists Win

I deduce from various minor snippets of information that the system used for code is:

ClashD5\game
ClashD5\game\model with subdirectories
ClashD5\game\view with subdirectories
ClashD5\game\controller with subdirectories

with all the class files in a matching directory tree like:

ClashD5\class\game
ClashD5\class\game\model with subdirectories
ClashD5\class\game\view with subdirectories
ClashD5\class\game\controller with subdirectories

and with tiles in

ClashD5\class\tiles

with similar subdirectories for other resources.

Is this right?

Cheers

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 24-04-2001 01:11 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#83 Report this post to a moderator
Increase Your PM Length

Gary:

Yes

On another subject:

It occurred to me I haven't explained yet the point of Applet functionality for D5, and how I'd like to use it. I'll present a brief description here, and let the people more in the know tell me if it'll work right.

Applet functionality is generally not to play D5 over the web, there's likely to be too much data that needs to be passed for people to do it without being frustrated. But where I heard strong resistance on demo 4 was that people (generally passers-by) didn't want to download d4 and then another many-meg runtime environment for java. So the idea of the applet is to let people that are only moderately interested do the one download of D5, and then use their browser's java setup to run D5. Of course they won't be able to save files and such, but it would let them see what the demo does and comment on it in general. Does this sound like a good plan, or a boondoggle? If its too much work, or dumb for some other reason, we can always skip it, and just put up with occasional abuse . I'm experienced with that anyway .

Richard Bruns is offline Richard Bruns
King
NC, USA
Nov 1999
time: 06:13
Post  Old Post 24-04-2001 04:06 Visit Richard Bruns's homepage!
Edit/Delete Message Reply w/Quote
#84 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Applets are good. They can be loaded uo and played with absolutely zero effort. Having to download and do manual setup can be quite a turnoff. Many popular web game sites like www.javagamepark.com have applet-only games. Saved games are not such a big loss.

But I thought we were using xml for game data, which means that we should be able to save games. Some applet games will save progress. What is it about an applet that eliminated savegames anyway?

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 24-04-2001 04:29 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#85 Report this post to a moderator
Support Apolyton buy from Amazon

Richard:

This Applet would take about 5 min at an average internet connection's speed to open with the size of the existing code and graphics (I think). Soon it will be double that. That's the problem.

Applets have restrictions on what they can write to disk (basically nothing). So unless the server is set to save things, they can't be saved AFAIK.

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Question  Old Post 30-04-2001 05:16 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#86 Report this post to a moderator
Lose 30 kilos (of popups)

Another issue...

How to handle differing diagnostics and output desired by the player in demo 5 and going forward? I think we need something like a Diagnostic class, which just has a whole lot of flags saying what the programmer or player wants in terms of information from the game. As the code executes it would output information to whatever preferred GUI element as called for by the flags. For demo 5 we can use it for things like the detailed econ output I spoke of above, and detailed military output (perhaps the government stuff that shows up in at window in the Beast code also). I would like to hear everyone's thoughts about the best way of doing this. The way that I handled it in TestEcon is shown below. I think it is an okay way to handle things for small-scale efforts, but probably isn't scalable. What I think is the more conventional way is just to have our Diagnostic class with all the flags turn on and off various types of output as the models are run. This would also be useful in various debugging activities.

What I have currently for the Econ model bears discussion since I don't think I want to rework it for demo 5 into what ever new formalism we are using. Also, you might see something useful in the way I'm doing it, so I'll tell you about it. What I do is allow the turn handlers to run, but to be passed an excluded object that will be skipped when they get to it. (It could also be an array of excluded objects if we wanted to make it more versatile) The example code below shows how it works in EconomyTurnHandler.

code:
public void oneTurn(GameData d, Object excludedObject) { //excludedObject provides for passing turn handler a single object //where turn should not be executed, here civ... //primary reason is if that object is being used for testing, and //turn is being handled at a lower level for that one if (excludedObject != null){ if ( excludedObject.equals(civ) ) return; } //go thru provinces of civ for each phase -- Do all phases for each Province for now Iterator it = (Iterator) civ.getAllProvinces(""); while(it.hasNext()) { Province p = (Province)it.next(); new ProvinceEconomyTurnHandler(p).oneTurn(data, excludedObject); } ... }


And the province turn handler .oneTurn looks very similar to the one above...

So what TestEcon does is run the normal turn handler for most squares, but the one that is the focus of the test, it excludes as in the code above, and runs its own lower-level version of a turn handler with detailed diagnostic output. The defect in doing this on a larger scale is that you always need to be prepared in the midst of turn handling to switch over to some test method to execute the turn handler for some particular object. Anyway, its something I've got in now, and I'm not sure if it's useful long-term or not. Your thoughts would be welcome.

[This message has been edited by Mark_Everson (edited April 29, 2001).]

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:13
Post  Old Post 01-05-2001 11:46
Edit/Delete Message Reply w/Quote
#87 Report this post to a moderator
Increase the size of your Attachments

I don't like it.
There are two ways I think output can ve handled:
Either you pass a diagnostics object or figure to all interested code, and
they manage it:
For instance, you have a method

code:
nextTurn(int verbose) { ... if (verbose == 1) IO.println("Stuff"); ... }

or you can have a set of listeners that you put on the interesting objects, and the listeners make the "ifs". Probably less efficient, but IO/GUI needn't be known from the code so you can change it or, even better, use 2 different GUIs for one thing. This means you need some formatting of the data passed to the listeners.
For the moment, military code uses that pattern, with data being all Strings. In the long run, data should derive from a class with some more info like the concerned civs, the string and probably type/detail info.

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 03-05-2001 09:23 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#88 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

Thanks for your idea Laurent. It sounds workable in general to me, but I haven't had a lot of time to think about details. Hopefully Gary will pop by to give his perspective on how to do this too. I'd prefer not to make a decision with just one person's input!

tjawatts is offline tjawatts
Settler
London,UK
May 2001
time: 05:13
Post  Old Post 04-05-2001 20:08 Visit tjawatts's homepage!
Edit/Delete Message Reply w/Quote
#89 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

A comment about java runtime environments. Now firstly, a casual user obviously would not want to download the JRE just to run Clash. However, it is a useful thing to have installed in general, you can run other things with it!

I dont think it is necessary to go out of your way to solve this problem, especially for the demos. When it comes to a production release you need to provide downloads for those users who do/dont have JRE already, the installation of the JRE would be integrated with the installation of clash.

Maybe I could look into making installation easy?

Tony

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:13
Post  Old Post 08-05-2001 06:49 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#90 Report this post to a moderator
Support Apolyton, buy Call to Power 2

Hi Tony:

I think your looking into portability would be great. I just don't know Anything about other OSs, so the more you can give directions for, the better. But I still think we will get resistance from some to downloading the jre. We can get you a version of the d5 code soon... Although Gary may already have something in mind for deployment.

What do the other coders have to say about this? I'd hate to have Tony waste his time...

 
Pages (4): [ 1   2   3   4   ]
< 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.0655 seconds (92.83% PHP - 7.17% 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