|
Author
|
|
Topic: Clash Coding Standards Discussion |  |
|
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 23, 2001 07:49
  |
 |
 |  |
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 Chieftain New Zealand Mar 2001
|
 |
posted April 23, 2001 15:31
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 23, 2001 16:11
  |
 |
 |  |
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 King NC, USA Nov 1999
|
 |
posted April 23, 2001 19:06
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 23, 2001 19:29
  |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 29, 2001 20:16
  |
 |
 |  |
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 Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted May 01, 2001 02:46
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted May 02, 2001 12:23
  |
 |
 |  |
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 Settler London,UK May 2001
|
 |
posted May 04, 2001 11:08
|
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted May 07, 2001 21:49
  |
 |
 |  |
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... |
tjawatts Settler London,UK May 2001
|
 |
posted May 08, 2001 03:36
|
 |
 |  |
HiIt would be great if I could get a look at the code. Should be able to iron out any problems with protability and find any OS specific code. Then I could look at the method of deployment if noone else has done that. Finally, I can do some actual coding, I dont know what to do, I dont want to encroach on anyone elses territory! If you are coding a specific section and would like me to do some sort of subsection for you let me know. Otherwise I can just look at the code and find something which hasnt been implemented yet! Cant wait to get started! Tony  |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted May 08, 2001 13:01
  |
 |
 |  |
Hi Tony.Sent the code this AM, tho it isn't completely current as I explained in the email. There shouldn't be any OS-specific code in there. I think the MP coding that you mentioned in the other thread is a great thing for you to start in on! It will make the demos much more interesting since there's no AI implemented so far. |