|
Author
|
|
Topic: Clash Coding Standards Discussion |  |
|
F_Smith Prince Austin, Tx 78728 May 99
|
 |
posted December 28, 2000 15:27
|
 |
 |  |
Now, regarding the tech architecture:First, Mark's approach will work. That is the basic 'wargame' type approach that is used in most other games -- and it's fine. But we can go deeper, providing more realism, if we want. We can break these objects up by their functional differences. One excellent example is in 'Sid Meirs Alpha Centauri', if any of you play that. You can mix and match chassis, bodies, weapons, armor and special abilities to custom-make units. That is the approach I am after here. I would like a class 'RangeWeapon', then a class 'Rifle' extends 'RangeWeapon' and implements a 'HandHeldWeapon' interface. Off the top of my head, I can think of at least a few subclasses of 'RangeWeapon' that should have very different capabilities -- 'Bow', 'Crossbow', 'Rifle', 'Laser', 'Plasma', 'Mortar', etc. There are probably others. This allows different types of behavior for each weapon type -- the 'train' method could vary. The 'breakdown' method has to vary, I think (bows don't explode accidentally, for example). The 'maintainance' methods have to vary (when you repair bows, the method should require wood, when you repair a modern rifle, you need spare parts). All ranged weapons would require a subclass of an 'Ammunition' object to be effective, so different types of ammo are available (arrow, ball, bullet, explosive, laser battery, etc). Better ammo can be invented/created, and given to existing weapons (selectively, if it's expensive). Bayonets can be fitted onto rifles, but not bows. Iron arrow heads can be used where you have access to iron. And this is just for rifles. Every tech type can gain added capability and realism with an object hierarchy. Again -- Mark's idea is still a good one. It works fine. This added realism is likely going to bore 80% of our players, who will never use the depth. I've been playing Alpha Centauri for about 6 months, and I just started building custom units! Comments? |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted December 28, 2000 21:38
  |
 |
 |  |
I expect a compromise would work best for the project overall. For short term stuff this is pretty much irrelevant since we will just throw things together. I think in the middle term, when things are being actively tweaked in the military model, the way I proposed will allow faster progress. (Because a non-coder can put in whole new weapons by hand, etc.) We can implement most everything you (F_Smith) said above using my approach IMO. BTW I guess I should have called my example RangedHandWeapon since it wasn't meant to cover artillery etc. In the long run I wouldn't object to some selected 'specialty' classes for things that really can't be handled well at the RangedHandWeapon level. We could have special tweaks based on inheriting from RangedHandWeapon and maybe an interface as you suggest. I do think that the detailed classes going down an extra level in inheritance should be the exception rather than the rule. The AI will Never be able to handle all those little nuances anyway, so the more detail tweaks, the more imbalanced will be the game IMO. Also, I think having literally a hundred or so classes just for weapons, and another several hundred for techs is Waaaaay overboard. And most of the things that were suggested for the detailed class proposal frankly strike me as something only a few percent of the players would even care about. Who wants their empire to fall because the right ammunition wasn't available??? We would Lose, not attract, players over that one! Remember, this is a Strategic game, not Squad Leader . So, do we have a deal? My approach in general, but the freedom to push the envelope in important cases. And for your personal version of the game you can do whatever you want! |
F_Smith Prince Austin, Tx 78728 May 99
|
 |
posted December 29, 2000 10:36
|
 |
 |  |
Absolutely, we can work from the general to the specific (if I understand correctly). We can begin with generic 'weapons' classes, and then add in specific subclasses if and when we have time. I agree that by far most players will never want to go to that level of detail, at least at first. Altho what I find happens with my favorite games is that the complexity adds to the length of time it holds my interest. After I learn all about the basic game, and have played it a few dozen times, I lose interest unless there are new things for me to find. Please forgive me for thinking that once you see the flexibility and power that the subclasses can give us, and how much easier it will be to code using the object hierarchy, you might end up on this side of the fence. Especially when it comes to coding up techs. Because I'd like to point out that weapons are not the best example of a specific tech application for this discussion. The differences between a bow and a rifle, while significant, are minor compared to the differences in many other techs. I don't see a 'TransportationUnit' class being able to cover planes, trains and autos, for example. But, as you said, we can make those determinations later. One question, tho -- we do still need an 'Ammunition' class, don't we? So arrows aren't used to resupply M-16's? |
F_Smith Prince Austin, Tx 78728 May 99
|
 |
posted December 29, 2000 10:38
|
 |
 |  |
P.S. -- Actually, I think what we're building is a game engine that is going to be both a grand strategy game *and* Squad Leader!I hope when we're done with it, it can be used to play any level of detail. |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted December 29, 2000 14:19
  |
 |
 |  |
We will work it out, and if you convince me, more power to you! Ammunition: I don't think individual ammo types is a good idea at all. At least my take was if a unit is in supply and enough manufactured goods get to it, then its assumed it is supplied with ammo of whatever type it needs. Otherwise you get into a micromanagement nightmare IMO. So it is assumed that the medieval society produces arrows, and the modern one produces cartridges and whatever else is necessary. Only if a unit is cut off do we dock its effectiveness due to lack of ammo. For slingers the penalty would be slight, for modern units it could get quite severe if the out-of-supply lasts too long. I am going to cross-post this in the mil thread since the discussion is pertinent there too. |
Twinge Chieftain
Dec 2000
|
 |
posted December 30, 2000 21:04
  |
 |
 |  |
I must agree with Mark; while realism and complexity are important, we don't need a quote:
 micromanagement nightmare
 | =) Basically, how I see it, we don't want to make an Action, Rolepaying, Shooter, Strategy Game; that's overkill. quote:
 You can mix and match chassis, bodies, weapons, armor and special abilities to custom-make units. That is the approach I am after here.
 |
Like Master of Orion Too (Another Great Microprose Stategy)... This is a good idea, and should be implemented sometime in the later stages. As always, this would be by user choice, and there would be plenty of default "units". quote:
 I hope when we're done with it, it can be used to play any level of detail.
 |
Don't think this should be much of a problem =) Looks like thats the basic idea of the game, and that's one of the tings I like most about it, or any other game. |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted January 04, 2001 20:14
  |
 |
 |  |
Coding Gurus:A book I've been reading "Thinking in Java" maintains that it is evil to use inheritance unless you intend to use it functinally thru upcasting to a base class. So use of a Vehicles class is ok if you will have a container of Vehicles that each have their own version of move(), stop(), pickupPassengers(), pickupCargo() etc. But the author (Bruce Eckel) says that if your inheriting classes add more methods or variables, then its the sign of bad design. Is this becoming-accepted-truth about good OO practice, or is this guy on the lunatic fringe? I'm trying to improve my coding style, and keep getting different messages from the 'experts' . |
LDiCesare Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted January 05, 2001 09:17
 |
 |
 |  |
I agree that you should use subclassing only if you upcast somewhere. Otherwise, you (ab)use inheritance by tying classes which may share a method but this method is never used per se, thus there is no common semantics to that method. This may mean you avoid copy-paste of code, but if one of your class should evolve, then the second implentation may follow the code change inadvertently, or you may change both codes and end up with an inheritance you don't remember the purpose of. Better to use a third object to which you delegate the common code in that case. quote:
 Originally posted by Mark_Everson on 01-04-2001 08:14 PMBut the author (Bruce Eckel) says that if your inheriting classes add more methods or variables, then its the sign of bad design.

|
In java, everything derives from Object, and the author cannot write a book on java and say you should derive from Object without adding methods to your subclasses. You couldn't even write main() with such a philosophy! What can make sense is that you shouldn't test for subclasses in upcast (through the instanceof construct FE) and then use the additional methods in the upcast.
|
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted January 05, 2001 12:05
  |
 |
 |  |
Thanks for your interpretation Laurent. It makes sense to me. I think I was trying to take the author's words a bit too literally  |
Twinge Chieftain
Dec 2000
|
 |
posted January 05, 2001 17:44
  |
 |
 |  |
In all programming languages theres many ways to do the same thing... Do what feels best to you in most cases, even if it is a little less "proffesional" (except If the easier code takes a lot longer to run or has other problems, of course.) Basically: Don't do what authors tell you to do. They likely tell you a) how its supposed to be done in the most ideal situations which isn't always good, or b) what works best for them. Find what works best for you and do it, you dont need to do what some expert says you should. |
puree Settler yorkshire , england Oct 2000
|
 |
posted January 06, 2001 06:08
 |
 |
 |  |
In heritance is there to be used , and fairly central to OO. However it can be badly used. If you have a large inheritance hierarchy then there probably a problem , but there's probably nothing wrong with a few levels, it depends largely on what your modelling.To say subclasses addding methods is bad design is in my opinion twoddle. it's probable that he java creators thought so , take at look at some of the docs and you'll find examples of classes 2,3, or 4 levels down a heirarchy adding methods to their superclases - most Swing or AWT classes spring to mind. The most important rule in my opinion is does it make sense in the context of what you are developing. e.g an app used in aircraft design may well subclass passenger and cargo planes from parent AirPlane class , but an arcade game probably has one class with a flag for the type to determine score for shooting it. don't forget interfaces , in a lot of cases these are probably far more appropiate than a class, the obvious example alluded to above is where the subclass would not really have common code with the parent or siblings. e.g petrol/ deisel / electric cars are probably good examples to subclass from Car Class - they probably share lots of common code , with just a few differences like how they are started. Car and AirPlane though are probably not best SubClassed from Vehicle Class as although they have the same methods ( start , drive , stop or whatever ) the methods would probably be implemented differently for each subclass with no real common code, a Vehicle Interface would be better. But as was said earlier do what you feel best with , there are lots of correct ways of doing things lee |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted January 06, 2001 17:04
  |
 |
 |  |
Thanks guys, I'm proceeding ahead, and trying to do things that make sense! I'm trying to make things more encapsulated than I used to, and use casting and inheritance wisely. I think I partly misinterpreted what the author was saying in my bit above also.I'll have the demo 5 econ model out by the end of the month. Perhaps it won't be the most refined code, but it'll get the job done! |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted January 08, 2001 20:05
  |
 |
 |  |
One more thing that came up elsewhere and has relevance here.IMO most of the variables in Clash should be floats not ints. This allows the game dynamics to always proceed smoothly rather than jumping around because things are always in discrete chunks. I think this can help us avoid much micromanagement.
|
Richard Bruns King NC, USA Nov 1999
|
 |
posted January 09, 2001 19:25
 |
 |
 |  |
I can't comment now because I seem to have forgotten everything I ever learned about Java classes. I'll try to see if I can refresh my memory. |
LDiCesare Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted January 12, 2001 05:46
 |
 |
 |  |
Is there any standard for tests? What I read about Extreme Programming went as "do a lot of tests". I also know people whose policy is 1) define the API 2) code the tests 3) fill the API with actual code. I suggest we should have packages like game.data.military and each such package would have unit tests like game.data.military.test. That way tests are easy to find and can be removed fast from the real game. Any comments? |
Twinge Chieftain
Dec 2000
|
 |
posted January 12, 2001 14:07
  |
 |
 |  |
Well, I personally think Integers are fine, as long as you leave a wide variation open for them (maybe 1-200 instead of 1-20 as it is in civ2 pretty much) Basically you can still get the same level of detail while it is easier to understand, edit and customize. |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted January 16, 2001 21:47
  |
 |
 |  |
Laurent:Your suggestion sounds reasonable to me. I was hoping some of the other coding pros would discuss... but for now we can do it your way. Lord knows I have generated enough tests already in coding the econ part! Twinge: I just don't agree. If you have 200 integers, there aren't big jumps anymore, but you still need to keep track of a reservoir to say when the integer goes up! So it just seems counterproductive to me. Now, the Player need not see the floats, and probably Should Not see most of them. Can you explain to me why integers are easier to understand, edit and customize? The player will only see "Metallurgy tech level = 37" in either case... |
Rüdiger Settler Erlangen, Bavaria, Germany Jan 2001
|
 |
posted January 28, 2001 12:41
 |
 |
 |  |
Hi!I am new to Clash, and I hope I will be of help in the programming department. I would like to know what development environment you use for coding java, if any at all. I am asking, because it`s been some time since I last used java, and I have seen there are several IDEs available for free. Besides, what version of Java are you using? |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted January 28, 2001 13:02
  |
 |
 |  |
Hey Rüdiger:We are using Java 2 for the forseeable future. I don't have any experience with the free IDEs, but I'm sure you can get some good info on the newsgroups if not from someone in the project itself. Gamedev.net also has a decent java programming forum with a focus on game development of course. Its here: http://www.gamedev.net/community/forums/forum.asp?forum_id=24&forum_title=Java+Development . |
Rüdiger Settler Erlangen, Bavaria, Germany Jan 2001
|
 |
posted February 22, 2001 08:54
 |
 |
 |  |
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. |
LDiCesare Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted February 23, 2001 08:32
 |
 |
 |  |
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 Warlord Belgium b.02-15-99
|
 |
posted March 05, 2001 10:38
 |
 |
 |  |
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 Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted March 05, 2001 14:13
 |
 |
 |  |
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 King NC, USA Nov 1999
|
 |
posted March 05, 2001 14:26
 |
 |
 |  |
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 Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted March 23, 2001 11:05
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted March 23, 2001 12:02
  |
 |
 |  |
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 Chieftain New Zealand Mar 2001
|
 |
posted March 25, 2001 20:53
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted March 25, 2001 21:11
  |
 |
 |  |
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 Chieftain New Zealand Mar 2001
|
 |
posted March 27, 2001 17:00
 |
 |
 |  |
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 Chieftain New Zealand Mar 2001
|
 |
posted March 27, 2001 17:06
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted March 27, 2001 17:51
  |
 |
 |  |
Hey Gary, the Xerces license looks great! Can't ask for much more than that! Thanks for reposting the quote. |
Mark_Everson Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 03, 2001 21:52
  |
 |
 |  |
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 Chieftain New Zealand Mar 2001
|
 |
posted April 04, 2001 16:35
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 06, 2001 19:48
  |
 |
 |  |
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 Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted April 11, 2001 06:15
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 11, 2001 06:58
  |
 |
 |  |
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 Chieftain New Zealand Mar 2001
|
 |
posted April 13, 2001 05:01
 |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 18, 2001 18:51
  |
 |
 |  |
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 Clash of Civilizations Project Lead Canton, MI, USA b.02-15-99
|
 |
posted April 22, 2001 09:40
  |
 |
 |  |
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\modelI'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 Chieftain La Ferté sous Jouarre France Jan 2001
|
 |
posted April 23, 2001 07:02
 |
 |
 |  |
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)? | |