PDA

View Full Version : XML thing for chars


Ertial
11-22-2007, 07:44 PM
I think a lot of people want to know something about each other chars. And I think this could be reached by creating a standard with XML Schema (http://en.wikipedia.org/wiki/XML_Schema_%28W3C%29) and a default XML (http://en.wikipedia.org/wiki/XML) and XSL (http://en.wikipedia.org/wiki/Extensible_Stylesheet_Language) file. I mean something like this: http://www.kiirani.com/stuff/regnum/

We could write plugins to import it in forums afterwards, and parsers for images.
I think it should contain this information:
-Name
-Class
-Race
-Realm
-Screenshot
-Level
[-Is main?]

Any other suggestions? Who wants to help, since I'm not that familiar with XML. Who can design a nice template?

EDIT: I've got the first schema ready, waht do you think?
http://files.qense.nl/schema.xml
(Does someone knows a solution for the nameSpace problem?)

ArcticWolf
11-22-2007, 09:06 PM
Also, that XML could be used on a Java app to share char datasheets ^^

NightTwix
11-22-2007, 09:26 PM
waht do you think?

i think you are really a Nerd :superpusso: :dance:

Kiirani
11-22-2007, 11:09 PM
I mean something like this: http://www.kiirani.com/stuff/regnum/

Holy CRAP! I'm popular!!! XD

I'm 100% not familiar with xml or the parsing of, what would be the advantages / disadvantages of using it for this? I like the idea of having a browseable database of characters.

Also, no java please Xephandor XD Setting up java apps gives me a headache, in browser java is slow and annoying, and I hear it's hell to code.

ArcticWolf
11-23-2007, 12:07 AM
Holy CRAP! I'm popular!!! XD

I'm 100% not familiar with xml or the parsing of, what would be the advantages / disadvantages of using it for this? I like the idea of having a browseable database of characters.

Also, no java please Xephandor XD Setting up java apps gives me a headache, in browser java is slow and annoying, and I hear it's hell to code.


Hey, hey, hey... Wait. I'm a java "programmer" (still studying), so I know the limitations of the platform, but still it would be cool to have a java database char browser. If you're talking about web apps, java is not the best solution, but for this community is a good option since we wouldn't have to re-compile the code for windows and linux.

Anyway, I think that using MySQL to have a database is far better.

Vaylos
11-23-2007, 12:24 AM
I am by no means a coder, but I'm trying to get back into teaching myself web design stuffs. You could always go with Ruby. I consistently hear good things about it. Java scripting's not -that- bad. it's just basically a flavor of C++, but yeah it's a bit slow for web stuffs imo. Not that I know all that much about which language is faster. XML sounds good to me. maybe CSS would be an option, I need to read up more on Ruby to see what its capable and whether or not I want to try to learn it. :P

ArcticWolf
11-23-2007, 12:42 AM
Vaylos, we're aiming to two different things xD
Well, you could do a webscript that parses the information and creates something like the vcards but in XML... While I'm aiming to create an app that handles XML datasheets...

Both of the options are complementary to each other! :D

And Java is slow because of the Virtual Machine.

Kiirani
11-23-2007, 01:14 AM
Hey, hey, hey... Wait. I'm a java "programmer" (still studying), so I know the limitations of the platform, but still it would be cool to have a java database char browser. If you're talking about web apps, java is not the best solution, but for this community is a good option since we wouldn't have to re-compile the code for windows and linux.

Anyway, I think that using MySQL to have a database is far better.


If the goal of this is to set up a database of users/characters to be browsed then I agree, MySQL is better for this. Of course if it's for people to be able to share a character info sheet and others to view it, then xml would probably be a good choice.

The reason I dislike java is because the few times I've been wanting to use something in java that isn't in portage, I've downloaded and it has somehow not worked, and I've had no idea if I was doing something wrong or not XD

ArcticWolf
11-23-2007, 01:43 AM
If the goal of this is to set up a database of users/characters to be browsed then I agree, MySQL is better for this. Of course if it's for people to be able to share a character info sheet and others to view it, then xml would probably be a good choice.

Hmm... This thread is about XML, so let's stick to it at least until somebody decides what to do with this idea. It's pretty cool, and I don't know how to handle XML files correctly, so it would be more of a learning app to me ;)

Kiirani
11-23-2007, 02:14 AM
Hmm... This thread is about XML, so let's stick to it at least until somebody decides what to do with this idea. It's pretty cool, and I don't know how to handle XML files correctly, so it would be more of a learning app to me ;)

We must be sitting at the same point of knowledge then. Meh, my original question still stands.

ArcticWolf
11-23-2007, 02:27 AM
We must be sitting at the same point of knowledge then. Meh, my original question still stands.

Maybe because it's like using vcards for cellphones or to share your information between any address book. Also it could be used with PHP and CSS to generate a dynamic website with updated information.

Kiirani
11-23-2007, 02:48 AM
Hmm, yes, I see this advantage in xml.. I uh, question why you'd need to move the info around in this manner though. (I'm willing to contribute a web interface of some sort if I can be bothered. I'm not a reliable coder XD)

Stefan1200
11-23-2007, 03:15 AM
Also, no java please Xephandor XD Setting up java apps gives me a headache, in browser java is slow and annoying, and I hear it's hell to code.

Maybe java is slow in a browser, but for this it is easy to do a java application. They are not slow (maybe only with a Pentium 1 ;)). I am also a java programmer. For the browser it is easy to do such thing with PHP, no need for java applets.

But this XML output should also contains informations like Clanname, XP, Questcount, RealmPoints and Gold Amount.

ArcticWolf
11-23-2007, 04:05 AM
Maybe java is slow in a browser, but for this it is easy to do a java application. They are not slow (maybe only with a Pentium 1 ;)). I am also a java programmer. For the browser it is easy to do such thing with PHP, no need for java applets.

But this XML output should also contains informations like Clanname, XP, Questcount, RealmPoints and Gold Amount.


I wouldn't put gold amount, because it's something that changes too fast to keep it up-to-date.

And yeah, Java has been optimized over the time and now it's fast enough for any of us to run an app like this one...

Stefan1200
11-23-2007, 06:40 AM
I wouldn't put gold amount, because it's something that changes too fast to keep it up-to-date.

Where is the problem? NGD need update this statistik informations only one time every day, like the ranking page. You also put the character level into the xml file. From level 1 to 30 the level can change more than one time the day too :). Why not getting the data from the same database/tables as the ranking page database/tables. I don't see big problems here.

Stefan1200
11-23-2007, 06:50 AM
I hear it's hell to code.

I just realized this part of the sentence.
Who said that? Java is much easier than C++ or ASM. And for my opinion easier than Delphi too (maybe not creating the GUI because it simple click and run...more or less).

The only languages that are easier are the web languages (some of them can be used as desktop apps too) and the "basic" variants. And maybe C DOT NET are equal, but not tested yet. But "basic" does not count here...programmed for windows it does not run with linux.

Just my opinion for this ;).

Znurre
11-23-2007, 11:05 AM
Use C++/ruby and the Qt-bindings.
That works on Linux, Windows and MacOS and blends in perfectly in every system.
also, I have quite a big experience coding with Qt and it's really easy and powerful.
For ruby, there is an easy to use xml parser that can be installed using rubygems.

Good luck :)

ArcticWolf
11-23-2007, 01:45 PM
Where is the problem? NGD need update this statistik informations only one time every day, like the ranking page. You also put the character level into the xml file. From level 1 to 30 the level can change more than one time the day too :). Why not getting the data from the same database/tables as the ranking page database/tables. I don't see big problems here.


NGD has just to query the database on the server to get that info... And you should update your XML file manually. I wonder if NGD will allow users to have some RSS service to get stats on the players online.

This idea is starting to look like an IM software more than a game. xD

Stefan1200
11-23-2007, 07:18 PM
This idea is starting to look like an IM software more than a game. xD

Why? Many games provide the info somehow. Mostly shooter games, but why not RPG games? There are also some RPG games provide character infos to use them on a webpage or for a signature banner.

Kiirani
11-23-2007, 11:37 PM
I just realized this part of the sentence.
Who said that? Java is much easier than C++ or ASM. And for my opinion easier than Delphi too (maybe not creating the GUI because it simple click and run...more or less).

The only languages that are easier are the web languages (some of them can be used as desktop apps too) and the "basic" variants. And maybe C DOT NET are equal, but not tested yet. But "basic" does not count here...programmed for windows it does not run with linux.

Just my opinion for this ;).
Hehe, I have never attempted java, or er.. Any of the other languages mentioned. I started on php and have moved into python (which is awesome). But I have anti-java friends, who tend to be more into python, ruby, perl.. One of them knows a few variants of lisp :/

I suppose that I do have a leaning towards web languages, but python certainly isn't, it's just around the same "level".

I agree that I'd like ngd to provide some kind of access to the user database. I'd like to be able to search a specific character's position on the ranking.. Similar to runescape?

ArcticWolf
11-24-2007, 12:15 AM
Does anyone have a paper about XML or doc that I could use to parse the file? I'd like to try something...

Ertial
11-24-2007, 09:55 AM
Wow, I haven't been on for a day and the topic has three pages :).
My idea was too make a standard for a page that users can fill in to show the stats of their chars. And maybe add the URL to a central database. But the suggestions are going for generating the files by NGD, or at least with data from NGD's database. For that we really need help from NGD.
The clan is a base thing that should definitely be there. But I don't know how to get the other information there(up to date, get the exact numbers(quests, RP).
Maybe rankings would be good, but we have to find a flexible way.
Maybe we should try to create a central database, where players can add their information and change it, and which gives all players a own page, with a link to a generated XML file. I could host it, unless it gets too popular.
It's a bit the opposite of what I suggested at first, instead of gathering information from independent XML files, we have information at one place.
Which option do you like the best? If we've decided we should set up a team, so who wants to help, which language should we use for the central information giving system thing?

@Xeph, I don't know a good page, but I learned the basics from a Dutch PHP book and I do the same as I did with PHP, if I don't know something I look it up on the internet. I learn the best that way.

EDIT: I just thought of something else. Shouldn't clans have a own XML file? I'll make a concept for it too.

Ertial
11-24-2007, 10:57 AM
I've found some tutorials.
http://www.w3schools.com/xml/default.asp
http://www.w3schools.com/schema/default.asp

This are some other examples:
http://files.qense.nl/schema.xsd
http://files.qense.nl/text.xml
http://files.qense.nl/clan.xml

is there a better way to 'include' the schema?

ArcticWolf
11-24-2007, 02:22 PM
Thanks Yest!!! I'll take a look now and see if I can parse the file and do something on Java... At least a program that handles a single file.

Look, there are pros and cons of having a centralized database, and they are:

Pros:
You have all the info in one place, so backing up data would be easier.
There's a standard file format or database schema, which makes things a lot easier for programmers.
Databases are easy to query from different languages such as Java or PHP.
Cons:
If you're the host and the service gets too popular (I mean, TOO popular), then you should transfer the database to a dedicated hosting (could be a free one).
If you're not used to back up your data... You know =/I don't see any really great flaw on having everything on a centralized database, and there's one key point that justifies the decision of using MySQL: databases are designed to manage data in this way, while XML seems to be more to config files and sort of things.

Anyway, what if the user wants to host his or her datasheet on a website? Well, there could be an XML generator made with PHP, or even with Java.

XML Seems to be easier than setting up a database, though.

Ertial
11-24-2007, 04:37 PM
Yes. But a central place to view them would be great. I think clans would really love to have a list of their members with their stats.
We should make a standard for the XML files, so they will all be the same and write something to bundle the information. But what to do with players who don't have a own website?
A central list would require an awful amount of searches on websites. I mean, if we create a list of all the English Regnum Players, we'll have loads of users.
Maybe we should do this:
-Single files, if you're clanless you can give the url of a single file.
-Clan file, all clans install a program which generates one single XML file with all the members in it, this requires less requests. Clans can import single XML files too.
-If you're clanless and have no host, you can put your information in the central database.

All players have at the software where they are known, indirectly or not, a own page with a link to a generated XML file with just their char.

I just realized that this can require a massive amount of MB/s , does anyone has experience with that? Is it doable without massive load times and angry webhosts?

Kiirani
11-24-2007, 07:20 PM
Yes. But a central place to view them would be great. I think clans would really love to have a list of their members with their stats.
We should make a standard for the XML files, so they will all be the same and write something to bundle the information. But what to do with players who don't have a own website?

On this note, straight xml is not good for displaying straight off on a website. You have far more browser problems than with html and it's certainly less known (for example, I don't know it). If they did decide to host the file on a website, the only good it would be for is downloading it to view in an external viewer, which is far less useful than querying a database to receive html pages. The database could also be set up to have a user that everybody could use just to query information for dynamic images, generating their own page etc.


A central list would require an awful amount of searches on websites. I mean, if we create a list of all the English Regnum Players, we'll have loads of users.
Maybe we should do this:
-Single files, if you're clanless you can give the url of a single file.
-Clan file, all clans install a program which generates one single XML file with all the members in it, this requires less requests. Clans can import single XML files too.
-If you're clanless and have no host, you can put your information in the central database.

All players have at the software where they are known, indirectly or not, a own page with a link to a generated XML file with just their char.

I just realized that this can require a massive amount of MB/s , does anyone has experience with that? Is it doable without massive load times and angry webhosts?

On the subject of webhosts -

Crappy free ones are out of the question

Decent free/cheap ones should NOT get a huge strain on bandwidth from a simple character database. It's all just text :p

If we set up a database, why should we do single xml files? We could offer a php script to query character information from another server. People could put that script on their sites and away they go. (I mentioned this a little above here in the post)

Ertial
11-25-2007, 02:48 PM
I was thinking about a webscript in PHP with a MySQL database that shows users in its database and from external ones.
You can add URLs to it and they will be imported once a day. The URLs will be links to an XML file, outputted by the webscript or a lone XML file from a single user.
You can see lists of users, members of clans and maybe even highscores :)

First thing to do now is create a team and find a place to develop it. We can make than UML things. Who wants to help? Should we use Launchpad(my favourite) or SourceForge. I think three or even two developers could do it, but of course more would speed up it a bit and there is also a template designer needed.
Knowledge of Object Oriented PHP is required, or at least a ability to learn it quick ;)

Kiirani
11-25-2007, 09:02 PM
I have this knowledge but I'm unlikely to be motivated enough to help, sorry :/

I'm on irc if you need someone to bounce ideas off or discuss program design with.

ArcticWolf
11-26-2007, 02:30 AM
I hate UML. Sorry, I had to say it... Well, I don't really hate it, it's just that it's not my thing. Anyway, I should practice, so I'll try to help with that.

I'm willing to help with the MySQL database, but I'm not so experienced on PHP.

Let me see if I can get any help from the spanish forums, I know two users who are good at programming and could be interested on this.

Ertial
11-26-2007, 05:26 PM
Nice! :) UML isn't required, but I think it will make developping easier.

ArcticWolf
11-26-2007, 05:52 PM
Nice! :) UML isn't required, but I think it will make developping easier.

This is a small, very small project, so I think UML isn't so vital... In fact, we developed the entire ROLGps project without a single diagram xD

ArcticWolf
01-14-2008, 08:06 AM
This is a small, very small project, so I think UML isn't so vital... In fact, we developed the entire ROLGps project without a single diagram xD
...And that's why ROLGps needs a complete rewrite now.

I'm being serious on that. The old program used plain text files which were hard as hell to update massively, and that's why I'm trying to implement XML.

As you may noticed, this sounds a little bit offtopic. Well, this introduction is just a mere excuse to post the code of a simple file parser I made to test the new engine (it's working pretty fast for a parser). THIS IS JUST A ROOKIE'S EXAMPLE:

Java:
public static Vector questData(String id){
Vector result = new Vector();
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder docbuild = factory.newDocumentBuilder();
Document doc = docbuild.parse("quests.xml");
Element root = doc.getDocumentElement();
NodeList quests = root.getElementsByTagName("quest");
for(int x=0; x < quests.getLength(); x++){
Element quest = (Element)quests.item(x);
if(id.equals(quest.getAttribute("id"))){
result.addElement("tag:name");
NodeList nombre = quest.getElementsByTagName("nombre");
result.addElement(nombre.item(0).getTextContent()) ;
result.addElement("tag:description");
NodeList descripcion = quest.getElementsByTagName("descripcion");
result.addElement(descripcion.item(0).getTextConte nt());
NodeList npcs = quest.getElementsByTagName("npc");
result.addElement("tag:npcs");
for (int z = 0 ; z < npcs.getLength(); z++){
result.addElement(npcs.item(z).getTextContent());
}
result.addElement("tag:rewards");
NodeList recompensas = quest.getElementsByTagName("recompensa");
for (int z = 0 ; z < recompensas.getLength(); z++){
result.addElement(recompensas.item(z).getTextConte nt());
}
break;
}
}


} catch (SAXException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} catch (ParserConfigurationException ex) {
ex.printStackTrace();
}
return result;
}
The XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<quests>
<quest id="1">
<nombre>Aguas envenenadas</nombre>
<npc>Tipo uno</npc>
<npc>Tipo dos</npc>
<npc>Tipo tres</npc>
<recompensa>Mil de oro</recompensa>
<recompensa>Espada vieja</recompensa>
<descripcion>breve descripción</descripcion>
</quest>
<quest id="2">
<nombre>Aguas envenenadas2</nombre>
<npc>Tipo uno2</npc>
<npc>Tipo dos2</npc>
<npc>Tipo tres2</npc>
<recompensa>Mil de oro2</recompensa>
<recompensa>Espada vieja2</recompensa>
<descripcion>breve descripción2</descripcion>
</quest>
<quest id="3">
<nombre>Aguas envenenadas3</nombre>
<npc>Tipo uno3</npc>
<npc>Tipo dos3</npc>
<npc>Tipo tres3</npc>
<recompensa>Mil de oro3</recompensa>
<recompensa>Espada vieja3</recompensa>
<descripcion>breve descripción3</descripcion>
</quest>
</quests>


The result for number one:

tag:name
Aguas envenenadas
tag:description
breve descripcion
tag:npcs
Tipo uno
Tipo dos
Tipo tres
tag:rewards
Mil de oro
Espada vieja


NOTE: The "tag:" thing is just an internal code thingie, used just for parsing the Vector inside the code. Mind the details.
Why did I used an element as the name and not as an attribute? AVOID attributes, they're ugly. I just used them for the index (again, an internal code thing).


So... Why am I posting this? Just because I couldn't find any other example on this forum about xml parsing, and you could find it interesting for any kind of app. I'm using the DOM standard, and it's quite similar to the php examples... Of course you would need to rewrite your app, but this may be helpful if you do so.

For the sake of completeness I'm going to say that the ID will be a hidden field to the user and it will be used like the primary key field on a MySQL database. I recommend you to keep this in mind if you think you may replace your xml files with a database on the future. It makes things easier.


Now back to the topic. Having this code as a "Proof of Concept" example, when do we begin coding? :D
I bought a PHP book. It's simple, but I think it will help me to understand what you're doing while I play with java :P

_dracus_
01-14-2008, 04:49 PM
Oh god no! Please stop showing Java code to me, it's so bad for my mental sanity. I think Java should be a banned language in schools.

arlick
01-14-2008, 05:10 PM
Oh god no! Please stop showing Java code to me, it's so bad for my mental sanity. I think Java should be a banned language in schools.

hahaha

why? java is really easy, i think...

_dracus_
01-14-2008, 05:24 PM
Java is not very functional :D

In fact I don't like the Objects paradigm. It's just my humble opinion on the subject, and I don't think it's the good place to discuss about that.

arlick
01-14-2008, 05:27 PM
Java is not very functional :D

In fact I don't like the Objects paradigm. It's just my humble opinion on the subject, and I don't think it's the good place to discuss about that.

well your are right, do u wanna open a thread to discuss about programing languages? :sifflote:

ArcticWolf
01-14-2008, 06:22 PM
Oh god no! Please stop showing Java code to me, it's so bad for my mental sanity. I think Java should be a banned language in schools.

Please, PLEASE don't make a flame out of this post... :ohill:

I'm starting a new topic so you can tell me why it should be banned.

_dracus_
01-15-2008, 08:09 PM
Please, PLEASE don't make a flame out of this post... :ohill:

I'm starting a new topic so you can tell me why it should be banned.

To get back on the topic, your idea is great. I hope NGD will have the time and ressource to answer to this request. After implementation language is just a tool (you can like it or not, it's up to you).

ArcticWolf
01-15-2008, 09:56 PM
To get back on the topic, your idea is great. I hope NGD will have the time and ressource to answer to this request. After implementation language is just a tool (you can like it or not, it's up to you).

Thanks!! The idea is to improve the current rolgps and to make it more universal, so if we have to update or add something to the file it would be matter of minutes to adapt the program. I'm starting to think that DOM isn't the best idea, I should use SAX to make it faster.

It takes 4 seconds to parse, search, fill the vectors and display the information. Totally unacceptable for me, because DOM iterates over the file several times.