Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » File Formats
File Formats Tue, 17 June 2003 14:20 Go to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
Does anyone have thoughts on file formats for .x, .m, rules files, and other files needed.

I'm leaning toward XML, but I don't know the details of XML, help would be appreciated.

Encryption will be needed, but I'm going to skip that for now.



- LEit

Report message to a moderator

Re: File Formats Wed, 18 June 2003 13:07 Go to previous messageGo to next message
John Marasco is currently offline John Marasco

 
Crewman 3rd Class

Messages: 5
Registered: June 2003
In an open format application I don't know why you would need encryption? People with either be honest or not and it is easier to debug an application when you can get a hierarchical data view in a browser.

XML is simple and pervasive. I started working with SGML in 95 so I've had time to adapt. If you choose XML, I'll answer question or help as I can.

I'll answer questions here when I get to it or you can send me email at:

jemarasco at bellsouth dot net

for better response.

John Marasco

Report message to a moderator

Re: File Formats Wed, 18 June 2003 13:18 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
I've decided to use XML even though I don't yet know it very well. I would appreciate help however, so I'll send you questions as they arise.

First one is what parser should I use?
Some one pointed me at TinyXML, and that seems very good, small, yet covers all I think I'll need.

For now, nothing will be encrypted, as you say, it's easier to debug that way. At some point it would be nice to encrypt the files. So you can play on some sort of AutoHost like server. Protecting against host abuse is probably impossible.



- LEit

Report message to a moderator

Re: File Formats Wed, 18 June 2003 18:25 Go to previous messageGo to next message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

If hosts are willing to go to the effort of altering code then yes, it is impossible...protecting against non-editors is relatively simple with public+private key pair encryption.

Report message to a moderator

Re: File Formats Wed, 18 June 2003 20:56 Go to previous messageGo to next message
John Marasco is currently offline John Marasco

 
Crewman 3rd Class

Messages: 5
Registered: June 2003
TinyXML is more than just a parser it's a DOM (Document Object Model). I've never used it but I read the documentation and it might be nice depending on where you want to go. TinyXML will read XML and verify that it is legitimate (parse) then put it into a hierarchical element/attribute/text object structure for code access (DOM). The limitation of tinyXML is that it only verifies that you have valid XML, not that the XML is in the right structure for your code. For that you need a parser that will validate the XML against a DTD (the DTD is being replaced by the Schema) for your application. TinyXML would be helpful but in a limited way.

For example

<ship_design type="destroyer" name="flee" armor="200">
  <capability type="armor" value="100"/>
  <capability type="shield" value="100"/>
  <ship_design type="frigate" name="bite" armor="45">
    <capability type="shield" value="100"/>
  </ship_design >
</ship_design >

tinyXML would tell you this XML is fine and stick it into a DOM for your code to read. Your code would probably choke when trying to transfer the data from the DOM to your class structure because a ship_design class wouldn't be contained within another ship_design class.

If you are working in Windows (for some reason this isn't in the FAQ) then you can use the Microsoft DOM classes stored in msxml3.dll (msxml.dll is ver 2.0 and IIRC there are at least 2.6 and 2.7 versions out there as well). This will parse the code against a DTD/Schema and the dll loads with Explorer. I doubt there is a Windows box out there without some version of the Microsoft DOM.

If you are going to use a DOM then it is likely you will output the XML from a DOM and then read it back into a DOM. As such then XML parsing issues will not be as prevalent as DTD/Schema parsing issues. Of course, if you were going to build a lot of XML by hand (as you might given the need to test just the host portion of the system) then having just the XML parser (tinyXML) would be helpful.

Personally, I've worked with several commercial parsers (Omnimark and FastTag) and the MS DOM. None of these offer a nice GUI interface for just checking the validity of an XML file. This is a functionality that I never saw in a product but would have been helpful. With the products we are talking about you have to run code to check if the XML parses. I didn't find any major flaws in the MS DOM. I used it to parse XML within VB COM components and ASP pages on the server and within javascript on the client.

Another way to use XML is to skip the parser and insert XML parsing functionality into your classes. Using the tinyXML source you could hack their document and element class and then subclass your classes from the hack. This might be above and beyond what you are trying to do but it would allow for a nice sort of encapsulated read/write functionality.

--John


[Updated on: Wed, 18 June 2003 21:02]

Report message to a moderator

Re: File Formats Thu, 19 June 2003 11:15 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
We are working in Windows, but don't want to limit ourselves to just Windows. This has been added to the FAQ.

Just having the data taken out of the file into some structure is probably enough, there is a lot of validation of the file that needs to be done in any case (server cannot trust the files it gets from the players, for example, just because they say they want to build a certain ship, doesn't me they have the ability to do so).




- LEit

Report message to a moderator

Re: File Formats Fri, 20 June 2003 00:29 Go to previous message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

Like the interface it might be worthwhile making the file IO modular and allow for other formats besides XML. All it takes is a buffer class. (eg)It could then be made to facilitate direct P2P play.(maybe)

Report message to a moderator

Next Topic: Forum opened to everyone
Goto Forum:
  


Current Time: Sat Apr 27 18:46:04 EDT 2024