EasyCoding

From The Battle for Wesnoth Wiki
Revision as of 23:16, 10 January 2008 by Mythological (talk | contribs) (WML related features)

Foreword

This page is here to document easy to do coding tasks. It is not here to double the feature request database, and should only be filled by people that know the code well enough to judge the difficulty of a given task.

If you are such a person, you should feel free to edit this page.

If you're not, you should post a feature request and discuss your idea on the forum or IRC. A coder with better knowledge of the code might give you the green light to add your feature here.

Anybody should feel free to add "clues" to any tasks, that is entry points, traps to avoid, person to contact to discuss and so on.

If you plan to work on a feature, write your name at the bottom of the feature, with the date. Note that if you are too long at working on a feature I'll "free" it back (that is if you're not working on it. If you have problems implementing it, just tell us....)


--Boucman 20:48, 3 October 2006 (CEST)

Animation related features

Victory animation

an animation to be played by the surviving unit during the death animation of the other unit

this should be fairly easy to do, just duplicate all death animation code, and modify the unit_die function to change the state of both units.

ask Boucman for extra help

  • unit_display.cpp
  • unit_type.cpp
  • unit.cpp
  • unit_animation.cpp;

Done! Submitting patch as soon as it can be tested. TheAT 01:53, 17 October 2006 (CEST)

En Guard animation

An animation to replace the standing animation when the unit is next to an enemy

Slightly more tricky than the previous one, you should copy most of the standing code, but beware that this should be invisible to external callers. The call to get_stats should be looked at

Ask Boucman for extra help

  • unit.cpp
  • unit_type.cpp
  • unit_animation.cpp

Special tags for Extra_anim

Special tags in the animate_unit event to call standard unit animations

One of the big limitation of the extra_animation tags is that you need to modify the unit itself to have the extra anim. Most anims can't be easily called that way. It would be interesting to have special tags that would be recognised to call the standard animations (attack, defense, etc...)

The tricky part is to handle correctly the "offset" parameter, and add all the WML handling to "fill in" the information we won't have available (non-existant filtering criterias)

This is more tricky than the two above, and I would advise doing one of the other two first to understand how it works

Ask Boucman for extra help

  • unit.cpp
  • actions.cpp

Animate flags during a [delay] event

currently, the [event] tag calls SDL_delay() and blocks the game completely. It would be trivial to change it to a loop that would call event::pump() every 10ms to have all animations updated

the tricky part is to make sure the screen is somehow "locked" and that player can't play during that time (should be the case, simple checking is needed)

grep should give you the file to change


Note: this possibly shouldn't be implemented anymore, due to the blurred dialogs which would need to be reblurred on every redraw. Unless, of course, you can implement this so that the contents of dialogs aren't reblurred and redrawn but only the rest of the screen. -zookeeper


I am on this.Boucman please email me with more details when you have time Spx2 12:31, 23 December 2006 (CEST)

Boucman please email me with an event that i can test this on


WML related features

Side/team-specific [item]s

Allow the team_name= key also in [item], as it is in [label].

Side-specific results

Giving result=defeat or result=victory for specific sides. (FR #4960)

Recall Event

WML event trigger for recalling (the current one triggers on both recalls and recruits) (FR #3622) (please read the comments of the report for a proper description of how this should work)

Enabling checking of damage dealt in WML

A WML variable should be set when triggering some combat-related events, allowing WML to know the amount of damage being dealt. (FR #7673)

Support for leaderless multiplayergames

Add support for the WML key victory_when_enemies_defeated= in the scenario tag during multiplayergames. (FR #8106)

Textboxes in options menu

Allow wml [query] tag allowing players to enter text into textboxes, similar to [option] but getting a string variable from the user.

GUI related features

Theme Changes

  • show number of owned villages/total villages (FR: #3135) (--alink done but must update help, doc, tooltip...)
  • allow custom themes to display values of WML variables (FR #6209)
  • hide the hourglass item from the statusbar when there is no timer

Widget Changes

  • show side number, name and team association information in the status table
  • make games sortable in the lobby (open slots, total number of players, era, XP modifier, gold per village, fog/shroud)
  • input history (chat, commands, ..), seek Sapient for more info and tips

Miscellaneous

More powerful village naming

Adding mountain names and other features to village names, having a second random name in village names

Currently the village naming engine has a very good structure that could allow more powerfull names to be generated. Understanding how it works should be quite easy, and a few usefull improvements could be added.

  • Currently villages can use lake names and river names, this should be extended to other features like bridges, swamps, mountains etc...
  • It would be nice to have a separate list of "first sylabus" and "last sylabus" for naming. That's not really needed in english, but some translations could use it
  • Again, it is common to have villages with more than one "random" word in them. having a $name2 variable would be nice

Debug Mode

  • New debug command functionality (setting status.variables, possibly terrain, WML value display)
  • Make it possible to toggle shroud and fog (but take care that this is only possible in campaigns)