Resources are now json formatted

Discussions of the development process of the game.
Post Reply
oskarwiksten
Captain Awesome
Posts: 368
Joined: Sat Jan 29, 2011 8:51 am
android_version: 2.3 - Gingerbread
Location: Stockholm, Sweden

Resources are now json formatted

Post by oskarwiksten » Sat Feb 09, 2013 6:32 pm

Hi,

I just committed a major change to the master branch of our git repository, which affects the development aspect of Andor's Trail profoundly.

You know that old resource format we used to use - with the excessive use of | signs everywhere, and the funky use of "{}" and "[]" everywhere. It's gone.
We now encode all our resources as json objects. I rewrote the parsers for the resourceloaders to parse json objects instead, and also updated the editor to import/export as json. (The editor can still import stuff from the old resource format though).

The reasoning behind this change is twofold:
  1. We can now use standardized tools to read and manipulate the resource files. Json is a versatile format, which most languages have native support for.
  2. By keeping the field names close to each object definition, we won't have to change all of the existing objects when introducing new fields.
I'm so satisfied with this change, I'm almost jumping with joy. We seem to have discussed introducing new properties on items and monsters for as long as this project has been around, and now another hurdle on the way of making flexible resources has been overcome. For example, if we want to introduce "items that give actor condition resistances", it would be a minor change to only add such a property to the new items that would have that property, instead of updating all of the existing items (including all translations). Other properties on monsters, items, actor conditions, conversations, or quests would be equally easy to implement now.

So, what are your thoughts? What other clever things can we do, now that the resources can be loaded as json objects?
As a nudge to all developers, imagine what you could do by loading an url like this with jquery on a webpage:
http://andors-trail.googlecode.com/git/ ... _v068.json
(all game resources are available in similar files)

Oh, another thing. While updating the editor to support the new json format, the code was refactored it to use angular.js insted of jqueryui. Additionally, the content editor now has a lot of new nifty features:
  • Editor can now import content from the git repository (available from the top right "import" button)
  • Table-based editors for items and monsters (for power-users)
  • Mouseover-hints for most labels in the editor.
  • Exp calculation for monsters now take conditions into effect (thanks to Ian for reporting it!)
As before, the editor can be found at:
http://andors-trail.googlecode.com/git/ ... ditor.html

RIP home-grown resource format. Long live the json resource format!

Would love to hear the input from other developers!
/Oskar

oskarwiksten
Captain Awesome
Posts: 368
Joined: Sat Jan 29, 2011 8:51 am
android_version: 2.3 - Gingerbread
Location: Stockholm, Sweden

Re: Resources are now json formatted

Post by oskarwiksten » Sat Feb 09, 2013 6:39 pm

Also, please let us know if the updated content editor doesn't work on your browser!
/Oskar

Tomcat
VIP
Posts: 933
Joined: Tue Feb 08, 2011 7:05 am
android_version: 7.0

Re: Resources are now json formatted

Post by Tomcat » Sat Feb 09, 2013 6:56 pm

I have a quick question ...

I see people often posting new proposed quests, mobs, etc. directly in the old resource format. Is the new one also a text format, or does it need to be exported in order to post it?
Norbert
Lvl:52 XP:2597576 AP:12 HP:124 AC:282 AD:30-42 CHS:27 CM:2.0 ECC:18% BC:132 DR:2
Skills: CS:2 IF:2 Ev:3 Rg:1 DgPro:1 1HPro:2 LtAPro:2 FS-DW:2 Sp-DW:1
Equip: FP BSS JoF RoP PRoB SrpHbk GoLF EnhCH EnhCB
Other: DotSP VD GoW FB TG RoD+6 Oegyth:6

oskarwiksten
Captain Awesome
Posts: 368
Joined: Sat Jan 29, 2011 8:51 am
android_version: 2.3 - Gingerbread
Location: Stockholm, Sweden

Re: Resources are now json formatted

Post by oskarwiksten » Sat Feb 09, 2013 7:00 pm

Tomcat wrote:Is the new one also a text format, or does it need to be exported in order to post it?
Relevant question, Tomcat! Json is also text, so it should be similar. In fact, json is even more readable than the old format.
The content editor can even import the old format, so older posts that use the old format can still be used.
/Oskar

sdevaney
Site Admin
Posts: 1076
Joined: Fri Jan 28, 2011 10:17 pm
android_version: 9.0 - Pie
Contact:

Re: Resources are now json formatted

Post by sdevaney » Sun Feb 10, 2013 3:48 am

oskarwiksten wrote:
Tomcat wrote:Is the new one also a text format, or does it need to be exported in order to post it?
Relevant question, Tomcat! Json is also text, so it should be similar. In fact, json is even more readable than the old format.
The content editor can even import the old format, so older posts that use the old format can still be used.
This x1000. As an example of how much easier this way is to read and understand....Same item different format.

Old format:
{shield6|items_armours:3|Wooden tower shield|shld_twr|||952|1|||||-6|||||12||||||||||||||||||||||};
New format:
{
"id": "shield6",
"iconID": "items_armours:3",
"name": "Wooden tower shield",
"category": "shld_twr",
"baseMarketCost": 952,
"equipEffect": {
"increaseAttackChance": -6,
"increaseBlockChance": 12
}
},
Excellent work as always!

Tomcat
VIP
Posts: 933
Joined: Tue Feb 08, 2011 7:05 am
android_version: 7.0

Re: Resources are now json formatted

Post by Tomcat » Sun Feb 10, 2013 3:54 am

sdevaney wrote:
oskarwiksten wrote:
Tomcat wrote:Is the new one also a text format, or does it need to be exported in order to post it?
Relevant question, Tomcat! Json is also text, so it should be similar. In fact, json is even more readable than the old format.
The content editor can even import the old format, so older posts that use the old format can still be used.
This x1000. As an example of how much easier this way is to read and understand....Same item different format.

Old format:
{shield6|items_armours:3|Wooden tower shield|shld_twr|||952|1|||||-6|||||12||||||||||||||||||||||};
New format:
{
"id": "shield6",
"iconID": "items_armours:3",
"name": "Wooden tower shield",
"category": "shld_twr",
"baseMarketCost": 952,
"equipEffect": {
"increaseAttackChance": -6,
"increaseBlockChance": 12
}
},
Excellent work as always!
Yes that looks much easier! Simple pairs of attribute name and attribute value. No counting empty fields for attributes that the object doesn't use. Nice.
Norbert
Lvl:52 XP:2597576 AP:12 HP:124 AC:282 AD:30-42 CHS:27 CM:2.0 ECC:18% BC:132 DR:2
Skills: CS:2 IF:2 Ev:3 Rg:1 DgPro:1 1HPro:2 LtAPro:2 FS-DW:2 Sp-DW:1
Equip: FP BSS JoF RoP PRoB SrpHbk GoLF EnhCH EnhCB
Other: DotSP VD GoW FB TG RoD+6 Oegyth:6

Pyrizzle
VIP
Posts: 6436
Joined: Sat Jun 25, 2011 1:00 am
android_version: 6.0 - Marshmallow
Location: Fire Nation HQ

Re: Resources are now json formatted

Post by Pyrizzle » Sun Feb 10, 2013 6:03 am

Waaaaaaaay easier to understand now. I am glad we have switched!
---------------------------------------------------------------------------------------

Player Name:Pyro
Lvl:24XP:244KAP:2/10HP:80AC: 189%AD:13-21CHS:-6CM: 0BC: 20%DR:2
IF:2Reg:2FSDW:1

May Elythara bless you and light your path!

---------------------------------------------------------------------------------------

Post Reply