Wesnoth Bestiary

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary

Post by ancestral »

Well, I'm still working at it. Haven't devoted quite as much time as I'd like to.

(Un)fortunately my projects seem to be more and more related. Ascension has units up to level 5 and would be best displayed nicely in the Bestiary. Editing it has been a little of a pain so I've had need for a web-based unit editor.

So a Wesnoth unit editor has been my latest project. It's far from functional yet, but should be neat once I've put extra work into it. Meanwhile, I've set a deadline for Ascension on June 8. Then I'll be revisiting the Bestiary, working on a unit tree tab to place in the page.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary

Post by ancestral »

Bestiary is so close to finishing that I've had the urge to get it done.

However, I've hit a roadblock.

The problem I am faced with is the output from wmlparser.py isn't quite fully JSON-compatible, namely that multiple objects or keys aren't allowed to exist in JSON (you're supposed to use an array instead). For example, the Marksman has two attacks, but two attack objects with the same parent isn't allowed by .$getJSON() (a jQuery function for reading a JSON-formatted file). The other issue is I really need to break up the file into smaller files (like one per unit). It's possible to run wmlparser one file at a time (though macros wouldn't carry over, among other things).

Thus, I'm faced with a couple of possibilities here.
  1. Edit the Python wmlparser JSON output to make arrays instead, and also cut it into individual unit files
  2. Write a Perl/Python script to edit the large JSON file into individual unit files and hack the multiple objects/keys → arrays issue
  3. Create a custom JavaScript parser to read the Wesnoth JSON file (and somehow still break it into smaller pieces)
  4. Abandon the notion of it being dynamic and just hardcode things
The first two are preferred, in my mind; my Python skills are a little incomplete, but I've always said I need to learn it. However, just making a script to convert the current file might be the shortest way out of this mess, though it would require an additional step just to produce the Bestiary.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
King_Elendil
Posts: 250
Joined: February 26th, 2010, 4:54 am

Re: Wesnoth Bestiary

Post by King_Elendil »

Wow, I didn't think I'd hear any more about this project! It's good to see it is still going :D .
I'm finally admitting that this will be a very long (if not permanent) Wesbreak. Thank y'all for the great times, and may Wesnoth rise to become one of the most popular games on the planet.
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Wesnoth Bestiary

Post by Iris »

ancestral on IRC wrote:[plea] Seriously, if anyone has intimate knowledge of wmlparser.py, or at the very least knows a bit of Python to which I can lean on, please let me know. This is directly related to my Bestiary project. Thank you. [/plea]
Try dropping a forum PM to esr, or poking him on IRC — he's the author and maintainer of most of our Python stuff, so he most likely knows how wmlparser.py works. Since he's a Python fr- fan, he might also be able to help you with other problems.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary

Post by ancestral »

Quick Update:

The following loads dynamically:
  • Descriptions
  • All basic stats
  • All attacks now populate from JSON files!
  • Images (sort of)
Image

I'm working on displaying the advancements, which has proven to be a bit more difficult than anticipated; then I'll clean up images and get resistances and movement going. The last two rely on statistics which aren't found in the given unit's file, so this may prove interesting.

At this rate, I could realistically be done by the end of the month. (If not, certainly by the end of the year.) Of course, then I need to tackle the unit tree.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary Development Thread

Post by ancestral »

Quick Update:
Huge progress has been made in the past 48 hours!
  • Nearly all web page code has been ported to PHP for better handling.
  • Images now populate automatically.
  • A map of keys has been made to store a unit's resistances. Resistances now populate and check for any of a unit's [resistance] tags.
  • Page and <div> widths automatically enlarge to fit larger portraits (such as Gryphon).
  • Links to unit pages now accept case-insensitive URIs… mostly.
  • Switched from post/get page loading to dynamic hash location. (For example, index.php#Vampire_Bats .)
  • Major code cleaning, and it continues!
Sortable movement and defenses, as well as the advancement "tree" work is next on my list. Then, further work on AJAX-like updating and a consolidation of JSON files will be done. Then that should about do it. I'll be making a mobile version afterwards.

See the work in progress: http://mproud.com/wesnoth/bestiary/index.php

Update: I haven't uploaded my local files to the server yet, so you might not see all changes.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
em3
Posts: 342
Joined: April 1st, 2009, 8:59 pm
Location: Poland

Re: Wesnoth Bestiary Development Thread

Post by em3 »

One thing - I don't know if you fixed it yet.

When I click to choose one of the portraits (female/male variants), after the old portrait fades out and before a new one fades in, I can see all the contents of the column under the portrait jump up to fill the space where the portrait was. It's only for a fraction of a second, but still noticeable.
ride on shooting star
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary Development Thread

Post by ancestral »

Update!

It's really coming along now! :D

Unfortunately, it's not playing nice with non-webkit browsers. I will have to fix that glaring mistake.

Image
  • All JSON files now flow through one mystical, magical text file
  • Dynamic loading is almost there. In order to pass off the hash location (e.g. #Vampire_Bat) from JavaScript to PHP, a cookie is required. (The workaround, if cookies are not enabled, is to reload the page with the hash location present.)
  • Portrait height, as well as width, now dynamically resizes correctly
  • Portrait male/female switching now correctly doesn't let content jump around the page
  • Attack icons, if the icon key isn't present, now checks with the attack name for its picture (thanks shadowmaster!)
  • Some regex rules in code for the description fixed
Unfortunately, a couple of things are broken, but will get fixed soon:
  • General incompatibility with Firefox
  • Cookies/hashes requires multiple reloads
  • Text selection broken where even with portrait
  • Advancement (though should be easier)
  • Defenses and movement costs
  • Spacing with attacks
  • Though never working, support for additional portraits
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary Development Thread

Post by ancestral »

Well, I've pushed the boundaries of what I can do without doing one of two things.
  1. Forcing the user to download 3 MB of data in order to use Bestiary (horrible idea)
  2. Require multiple page reloads (blecch)
  3. Write a web app
I have never written any web apps using a web application framework, so this should be a good exercise in my ever-growing crave for learning the tools of today's web development.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary Development Thread

Post by ancestral »

Quick Update:
PHP code has been converted into JavaScript. At this point, I have it back to working again as it was before. (With this implementation I think I can avoid the pitfalls of the three scenarios I listed in the last post.)

Feel free to check it out, understanding there are some flaws.
http://www.mproud.com/wesnoth/bestiary/#unitname
  • To-do:
  • Split JavaScript file into multiple files (it's a 3.4 MB file right now)
  • Advancement tree
  • AJAX page reloading/refresh
  • Display portraits correctly
  • Custom, per-unit resistance and defense stat overrides
Stay tuned.

Update: I have a file splitter which has put out .js files for all units! :D Will work on refreshing.
Last edited by ancestral on January 14th, 2011, 10:32 pm, edited 2 times in total.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
HomerJ
Posts: 812
Joined: April 25th, 2008, 1:22 pm
Location: Hannover, Germany

Re: Wesnoth Bestiary Development Thread

Post by HomerJ »

Link doesn't lead anywhere for me. If the address should be the same as in your sig, you missed a /wesnoth.

Greetz
HomerJ
Six years without a signature!
User avatar
cookie
Posts: 171
Joined: December 21st, 2010, 6:57 am

Re: Wesnoth Bestiary Development Thread

Post by cookie »

The correct one I believe is
: http://mproud.com/wesnoth/bestiary/#unit_name

no need to thank me ancestral :D
Bye says the cookie.
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary Development Thread

Post by ancestral »

Update: Portraits are working, and adjust width correctly! :D
Along with the JSON files split up, much progress has been had.

For example:
http://mproud.com/wesnoth/bestiary/#lich

(When changing the page you may need to reload your browser… for now.) Oh yeah, fixed that too! I placed a pop-up box where you can choose other units. This is just a placeholder for now.

Minor things to the UI have been done and will continue to be done. Re-adding support for multiple portraits. Advancement still needs to be done. And creating some kind of unit browser… still not sure how best to do this…

Compatibility
So far, Bestiary has been checked and known to work well with:
  • Chrome 2+
  • Firefox 2+
  • Internet Explorer 7+
  • Opera 9+
  • Safari 3+
JavaScript must be enabled.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Wesnoth Bestiary Development Thread

Post by ancestral »

galeanthrope wrote:The attacks effects are missing, like poison, slow, drain ... I think the unit sprites should be here too. In place of a empty Advancement part you could write "No advancements" or "Level max". Things like cure, heal ... are missing too. And finally, there should be an image for unit that don't have portraits yet like the Yeti, the Wolf or the Tentacle of the deep.
The attack effects… were on my todo list but I completely forgot about them! I'll add those in, maybe tonight.

I'm interested in putting the unit sprites in, but not sure where.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
em3
Posts: 342
Joined: April 1st, 2009, 8:59 pm
Location: Poland

Re: Wesnoth Bestiary Development Thread

Post by em3 »

ancestral wrote:I'm interested in putting the unit sprites in, but not sure where.
You could replace the numbers used to choose a portrait variant with appropriate sprite variants.
ride on shooting star
Post Reply