Public API

Home Board Index » X3: Albion Prelude » Public API

CuAnnan

CuAnnan avatar
Level badge Tropguey (5)
Posted 11 years ago.

The XML isn't too bad once you widdle it down to only the things that you need. For example drop the sun attributes, nebula attribute, as they do not have any place in the game. CuAnnan what language do you write in?
- Kozain

..

Actually, I'm using xquery to pull out the sectors one at a time and paring those into usable XML
The suns are now just a property of the root node as an integer, because nothing else is really useful, likewise planets.
The next phase, which I'll start later in the week, is to get the factories while building the Sectors and transform those into a usable format.

The XML sanitisation is being written in Java, because the XML RPC for exist is good, and all, but the ability to bind variables to queries is too useful in Java.

I am just as competent in PHP as Java, but I find that the more I use Java, the less I like PHP's untyped nature.

Kozain

Kozain avatar
Level badge Skillguey (7)
Posted 11 years ago.

I am not too familiar with php or java (other then jquery library) but I am proficient in ASP.net (razor) along with VB and in the process of learning C#. Maybe with the three of us we can put something together that will compliment what Roguey has already accomplished here!

CuAnnan

CuAnnan avatar
Level badge Tropguey (5)
Posted 11 years ago.

I am not too familiar with php or java (other then jquery library) but I am proficient in ASP.net (razor) along with VB and in the process of learning C#. Maybe with the three of us we can put something together that will compliment what Roguey has already accomplished here!
- Kozain

..

You'd have to add learning Java or PHP to the list for that to work.

The .NET architecture doesn't fit well with eXist (which is the XML database layer I'm using to store the pared down xml).

PHP's XML RPC library would probably be powerful enough, but I'm not 100% sure yet.

Also, I can't host .NET stuff, but hosting PHP is already implemented on my server, and Java's a doddle to get up and running.

Though, Java doesn't use jQuery, JavaScript does. The two are not related, Java was originally created by Sun, now maintained by Oracle. JavaScript was created by Netscape and is now an implementation of ECMAScript for web browsers.

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 11 years ago.

I never learned ASP either, I guess its has powerful as PHP? PHP is a bit like C to be honest, so if you got programming experience, it shouldnt be too bad to learn.

One thing I suggest if your parsing XML into HTML, is to cache it afterwards. This would save server resources and make things load instantly. Especially if your doing large XML look-ups with the game files.

My flash maps do use the universe XML. However I made a small VB program to reduce the XML to just the basic information, the second XMl is a list of sector names. One advantage with flash is that you got use of the persons cpu to do complex task. I used FlashDevelop for it, which is a free download (if that helps).

I would of done more with the in-game files if I was developing the site now. Somewhat, what you you're doing now Smile

CuAnnan

CuAnnan avatar
Level badge Tropguey (5)
Posted 11 years ago.

One thing I suggest if your parsing XML into HTML, is to cache it afterwards. This would save server resources and make things load instantly. Especially if your doing large XML look-ups with the game files.
- Roguey

I'm not actually parsing the XML into HTML, I'm parsing it into semantic XML.
That semantic XML will be stored in a Collection[1] in an XML database[2], which my API will query directly in a similar way to how you'd query a mySQL database.
The HTML files will be generated, on the fly, by querying this XML database and presenting the resulting nodes in a usable format.

I used FlashDevelop for it, which is a free download (if that helps).
- Roguey

Flash is dying a slow death, to the point that they now no longer support it for mobile development for any Android device. HTML 5 has rendered it obsolete. Anything Flash can do HTML 5 can do without the vulnerabilities.
Also, the iPhone has never supported it.

Edit: Forgot the footnotes.

[1] A Collection is a series of XML files that xquery can treat as though they were in one file.
[2] eXist-db being the one that I am most familiar with. I've tried using zorba for this before but have never gotten the apis to compile

Kozain

Kozain avatar
Level badge Skillguey (7)
Posted 11 years ago.

ASP.net is a powerful one to use, I use it for all of my websites and apps. I use VB code in them like I would any other desktop app.

I will take a look at php for sure although my choice of ASP.net has never failed me, pretty robust language. I will also look at this exist-db as it looks like it might be more friendly to XML operations?

I should have something available later today to try out. Will just be the basic universe xml mined down to only what we need. Then you guys can give the api a try and see if it's what we want.

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 11 years ago.

Im not actually parsing the XML into HTML, Im parsing it into semantic XML.
- CuAnnan

Oh, I just meant when display the HTML to the end-user you could cache it to save lookups.

Flash is dying a slow death, to the point that they now no longer support it for mobile development for any Android device. HTML 5 has rendered it obsolete. Anything Flash can do HTML 5 can do without the vulnerabilities.
- CuAnnan

I know what you mean. I guess HTML5 canvas tags is getting quite powerful. I didnt like the price of the official version flash either. Way too costly! Some of the sites are using HTML5 bits, like canvas graphs I created in the arcade.

[1] A Collection is a series of XML files that xquery can treat as though they were in one file.
- CuAnnan

Ive been a little late to the party (so called to speak) with XML files, so ive favoured more mysql than XML. However ive used simplexml in PHP rather than xquery (which dont really know much about to be honest). How are xqueries ran?

ASP.net is a powerful one to use, I use it for all of my websites and apps. I use VB code in them like I would any other desktop app.
- Kozain

Which sites? as be interesting to see any. I was pretty sure ASP was just as powerful as PHP. Although both are good languages, just feels like ur picking a side; somewhat like ATI or Nvidia, or intel and AMD. However what matters is how you use them. I used to do a lot of VB6, after-which I switched over to PHP. I never used to code much in C, however you get used to it.

Kozain

Kozain avatar
Level badge Skillguey (7)
Posted 11 years ago.

Which sites? as be interesting to see any. I was pretty sure ASP was just as powerful as PHP. Although both are good languages, just feels like ur picking a side; somewhat like ATI or Nvidia, or intel and AMD. However what matters is how you use them. I used to do a lot of VB6, after-which I switched over to PHP. I never used to code much in C, however you get used to it.
- Roguey


PHP is used all over the place and I think it is great and it is very powerful. Like you said a language is a language, they can all accomplish what we use them for.

Can you post a link to the xml that you use to engine your X3 stuff? (the game data) I would hate to have to do it myself if it has already been done, keep reinventing the wheel so to speak. Or send the sql script to create the database that you use?

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 11 years ago.

Can you post a link to the xml that you use to engine your X3 stuff?
- Kozain

erm.. the only section which uses xml is the flash map. The rest has been converted into mysql.

Kozain

Kozain avatar
Level badge Skillguey (7)
Posted 11 years ago.

erm.. the only section which uses xml is the flash map. The rest has been converted into mysql.
- Roguey


Can you not export it in xml format or export a table script that i can import?

Kozain

Kozain avatar
Level badge Skillguey (7)
Posted 11 years ago.

Oh also visit http://142.165.192.177/X3%20Reserve for my site dev updates, will change as i publish changes. It is hosted on my computer atm so dont expect amazing performance, ill get it onto main server when I am not feeling so lazy :P

CuAnnan

CuAnnan avatar
Level badge Tropguey (5)
Posted 11 years ago.

Oh, I just meant when display the HTML to the end-user you could cache it to save lookups.
- Roguey

Ah, gotcha. I haven't thought that far ahead yet.

Some of the sites are using HTML5 bits, like canvas graphs I created in the arcade.
- Roguey

Yeah, and through using something like kineticJS, you can bind events the canvas in the same way as you would a HTML element.

Ive been a little late to the party (so called to speak) with XML files, so ive favoured more mysql than XML. However ive used simplexml in PHP rather than xquery (which dont really know much about to be honest). How are xqueries ran?
- Roguey

That depends. XQueries are kind of like SQL. You can run them inside a database engine (like exist), or use an XQuery engine (like Zorba) to run them externally.
An example would be

"for $object in /universe/o
return $object"

FLWOR is the basis of all xqueries. (For, Let, Where, Order, Return)

I was pretty sure ASP was just as powerful as PHP.
- Roguey

Not in and of itself, no. ASP is used in conjunction with something else, normally C#, which gets compiled down into a binary of some sort. ASP with C# is actually vastly superior to PHP, but it comes with an overhead of IIS as a server, which is less secure, less robust and less stable than Apache.
The other problem is with licencing. C# is not free. Even if you get Microsoft Visual Studio Express, their freeware version, you're not exactly getting the whole hog. I have not read the EULA for MVSE.
PHP and Apache are free.
Java and Tomcat are free.
eXist, which will work with either, is free.

While eXist will work with any language over XML-RPC, I have come to rely on the free open source nature of Java/PHP/etc and they allow me to not have to re-invent the wheel.

Kozain

Kozain avatar
Level badge Skillguey (7)
Posted 11 years ago.

The other problem is with licencing. C# is not free. Even if you get Microsoft Visual Studio Express, their freeware version, youre not exactly getting the whole hog. I have not read the EULA for MVSE.
- CuAnnan


The freeware version is more then enough though. It lacks unit testing and team foundation I think but I have completed entire projects in the freeware. I don't use C# I use Visual Basic so that is why converting to php or C# isn't something I want to do at this time :P

If you go to my site and use the sector api, it should return a list of the sectors I put in today as an array most likely. Probably will depend on the browser used.

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 11 years ago.

Can you not export it in xml format or export a table script that i can import?
- Kozain

hmm.. im not sure. However if exported the tables, then basically ive done all the hard work of converting the gamefiles into a database for you (it took a lot of hours to do). I thought the project was to use the game-files themselves, and code it a better way?

That depends. XQueries are kind of like SQL. You can run them inside a database engine (like exist), or use an XQuery engine (like Zorba) to run them externally.
- CuAnnan

Ah I see. although why cant you just use simplexml in PHP, without another language?

ASP with C# is actually vastly superior to PHP, but it comes with an overhead of IIS as a server, which is less secure, less robust and less stable than Apache.
- CuAnnan

Ah I see, sounds a good idea if you own the sever yourself. Although like you said, although I can understand why Apache/php do so well. I never really looked into ASP - I just thought it be free like PHP and that.

The freeware version is more then enough though.
- Kozain

Im never a fan of freeware versions (especially with MS). You could spend ages coding something in a MS product, only to hit a wall because your not allowed to do it (since its freeware version). Usually MS are pretty cleaver with what they include into a freeware version, giving you enough to do the basics but making you want the full version to do any extra's. Its not like MS products are cheap either. Sounds a bit like Flash story again: Flash (costly), HTML5 (free); ASP full (costly), PHP (free). Dont get me wrong, ASP sounds good although sometimes creativity can be harmed by limiting features.

CuAnnan

CuAnnan avatar
Level badge Tropguey (5)
Posted 11 years ago.

Ah I see. although why cant you just use simplexml in PHP, without another language?
- Roguey

eXist is to XML as mySQL is to flat files. Everything you are doing with mySQL could be done with CSV files. You could even build CSV crosser files.
But then you lose the nice Indexes which result in mySQL code being executed in microseconds, where the flat files would take seconds or minutes to return. Add to that the simplicity of just being able to cross query, rather than writing a system to cross query and implementing that (which is very much reinventing the wheel) and one ends up using mySQL where flat files would performance wise work, but are more effort to implement.

With eXist, it would be possible to say "get me all sectors for which there are stations which sell Ion Pulse Cannons", PHP/Java would just be used to provide a framework for the application serving the data. It would ask the database for the relevant nodes and display them appropriately. Because I'll be indexing the XML appropriately, the process should take no more than a few microseconds.

Ah I see, sounds a good idea if you own the sever yourself. Although like you said, although I can understand why Apache/php do so well. I never really looked into ASP - I just thought it be free like PHP and that.
- Roguey

Well, we do own our own server (myself and the better half) but it's a linux flavour of some sort, so we can't get IIS running on it, so we can't server ASP.NET software.

Im never a fan of freeware versions (especially with MS).
- Roguey

I'm in pretty much the same boat. From having read what is and is not offered with the freeware version, it's a lot more than just the unit testing (which is phenomenally important, particularly with API software) and the Team stuff (less important, especially as I use subversion as a default for any new project).
The list of what isn't available is on the wikipedia page and almost all of them are must-haves.

« 1 2 3 4 5 »


You need to log-in to post here.