v0.8.9 (Bugfixes + translations) released to Google Play!

Useful links
Source code of the game - Contribution guide - ATCS Editor - Translate the game on Weblate - Example walkthrough - Andor's Trail Directory - Join the Discord
Get the game (v0.8.9) from Google, F-Droid, our server, or itch.io

Editor Upgrades

Discussions of the development process of the game.
Post Reply
sdevaney
Site Admin
Posts: 1177
Joined: Fri Jan 28, 2011 10:17 pm
android_version: 14 - Android 14
Contact:

Editor Upgrades

Post by sdevaney »

Working on upgrading the editor. Wanted to get some code down somewhere besides my PC and backup server.

My PHP Parser

Code: Select all

<?php
//REQUIRED INPUTS:
// - xml: path to xml document
// - xsl: path to xsl style sheet
// - pCount: number of parameters to be passed to xslt (send zero '0' if none)
//OPTIONAL INPUTS (must have as many as specified in pCount, increment '1' in
//names below up a number for each iteration):
// - p1n: name of first parameter
// - p1v: value of first parameter

//SET Paths 
$xmlPath = $_GET['xml'];
$xslPath = $_GET['xsl'];

// Load the XML source
$xml = new DOMDocument;
$xml->load($xmlPath);

$xsl = new DOMDocument;
$xsl->load($xslPath);

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

//Set Parameter(s), if present
$xslParamCount = $_GET['pCount']; //Check number of xsl parameters specified in GET
for ($i=1; $i<=$xslParamCount; $i++){
   $xslParamName = $_GET['p'.$i.'n'];
   $xslParamValue = $_GET['p'.$i.'v'];
   $proc->setParameter( '', $xslParamName, $xslParamValue);    //Set parameters for XSLTProcessor
}

// TRANSFORM
echo $proc->transformToXML($xml);

// SET Mime Type
$mime = "application/xhtml+xml";
$charset = "iso-8859-1";
header("Content-Type: $mime;charset=$charset");
?>
XSLT and more to come soon...
Kim
Posts: 69
Joined: Wed Feb 02, 2011 10:36 pm

Re: Editor Upgrades

Post by Kim »

If you want endless optional parameters and use $_GET, then the third parameter should be an array. Possible JSON encoded.
With an array of possible key-value pairs, there will be no need to guess if a pair exists.

Also, I do hope you add error checking to the parameters as all possible user inputs are never to be trusted to be valid by default.

What kind of XML templates are you planning to have ?

Since there is a desire to have a single (big?) editor do I see 2 options, a) Generic GUI with all editor modules loaded as needed, and b) JS-Tabbed editor with a more specialized GUI for each module.
In either case, its going to be JS heavy so I suggest using a framework. ExtJS, jQuery and MooTools comes to mind.
LVL 58|XP 3607866|GOLD 119249|HP 159|AP 6|AC 199|AD 35-45|CC 10|CM 0|BC 100|DR 12|
HTC Wildfire - Android 2.2.1 |Rocks 3526|RoLS 0|Update 2013/10/19|
sdevaney
Site Admin
Posts: 1177
Joined: Fri Jan 28, 2011 10:17 pm
android_version: 14 - Android 14
Contact:

Re: Editor Upgrades

Post by sdevaney »

All good points, not sure exactly how I want to tackle everything. I had a few extra minutes last night so I whipped that up. Looks like I will not have the time this weekend to work on it either but the plan was to create some jscript functions and have ajax post them to the server and that is about as far as I have got. I would really really like to do the editor in C or Qt but I am simply not skilled enough to do either and have it turn out well. :D
lord midnight
Posts: 104
Joined: Sat Feb 05, 2011 9:23 am
Location: Oz

Re: Editor Upgrades

Post by lord midnight »

why make it so it has to be server based?
that forces people to need a webserver just to use scripts, they should be as 'stand-alone' as possible. using these libraries and apis is bloat and superfluous. maybe just use java or plain html with very basic javascript so they can be run by a user in the web browser from the desktop.
AND/OR's ...
Image
sdevaney
Site Admin
Posts: 1177
Joined: Fri Jan 28, 2011 10:17 pm
android_version: 14 - Android 14
Contact:

Re: Editor Upgrades

Post by sdevaney »

lord midnight wrote:why make it so it has to be server based?
that forces people to need a webserver just to use scripts, they should be as 'stand-alone' as possible. using these libraries and apis is bloat and superfluous. maybe just use java or plain html with very basic javascript so they can be run by a user in the web browser from the desktop.
The simplest answer is that to my knowledge its impossible to write to an xml file without some sort of server side part in php or otherwise. You can do some things on the fly like they are done now but it is not very effective and limits what can be done in the editor.

Installing wamp or lamp is hardly an involved process when you think about the fact that we could overhaul and combine all the editor parts into one which would of course streamline development. It would also allow us to have an easier time developing all the different features people are requesting like effects, skills, mini map, etc.

Plain html can not accomplish the editor functions, maybe once the html5 standards are better established it can be used.

Jscript is what is mainly used now and might be able to be used but not without additional libraries and some serious research.

Java could be used but I don't know it well enough to write an effective editor.
oskarwiksten
Captain Awesome
Posts: 368
Joined: Sat Jan 29, 2011 8:51 am
android_version: 2.3 - Gingerbread
Location: Stockholm, Sweden

Re: Editor Upgrades

Post by oskarwiksten »

Looks interesting!

On the question of server-side or client-side, I think it is still a valid option to make an editor that requires a server-side, and not necessarily an editor that is pure client-side. We could host the editor somewhere, thus making it available to anyone that wants to do their own content. Combined with a free license that allows people to examine and play with the source would make for a good option in my opinion.

/Oskar
/Oskar
lord midnight
Posts: 104
Joined: Sat Feb 05, 2011 9:23 am
Location: Oz

Re: Editor Upgrades

Post by lord midnight »

i mentioned this before, but perhaps the problem could be approached from a different direction. there is a great spreadsheet available on googledocs, it can output several formats, is there no way to modify the parser to read csv or text from the output of google's spreadsheet?

i dont think any editor we are going to code is going to be much better than what is already available online. a set of templates and a change in the parser or an intermediary script to convert csv to xml would do the trick.

anyway, i think that would be a very fast way to get a great editor that does everything i can see it needs to do. is there some other functionality in the current editors im missing, i was under the impression you could write the data by hand if you wanted.

woot! 100th post. 1st 100th post on board!!
AND/OR's ...
Image
Post Reply