Difference between revisions of "EasyCoding"

From The Battle for Wesnoth Wiki
(Savegame related stuff)
(WML-related features: "Good first issue" tag was removed from the [query_location] one, so I'm moving it to NotSoEasyCoding)
 
(212 intermediate revisions by 40 users not shown)
Line 1: Line 1:
== Foreword ==
+
'''This page is outdated. For an up to date list of good starting issues, see [https://github.com/wesnoth/wesnoth/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%22 here].
 +
 
 
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.  
 
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 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.
+
If you're not, you should post a feature request and discuss your idea on the forum or IRC or Discord. 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.
 
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....)
+
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 we'll "free" it back (that is if you're not working on it. If you have problems implementing it, just tell us....)
  
 +
If none of these are to your liking, feel free to check our [http://bugs.wesnoth.org/?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%22 bug tracker] with a broad spectrum of tasks.
  
--[[User:Boucman|Boucman]] 20:48, 3 October 2006 (CEST)
+
== Engine related features ==
  
 +
=== Make a "map diff" tool to visualizes changes between two version of a map ===
  
Since bugs are sometimes a good opportunity to get a first idea of the code, i will add some here that are easy to fix as soon as i stumble upon them (the one i had in mind is fixed already ;-).
+
Maintainers of maps often make small tweaks for balance purposes. For someone who doesn't know the map like the back of their hand it may be very difficult to spot exactly what changed. There isn't any really good way to do this right now -- using the 'diff' tool at command line doesn't give good results for .map files.
  
--Yogi Bear, 28 February 2008
+
Such a tool would be helpful for someone who maintains a map pool containing maps made by others, also for someone who wants to browse a repository and examine balance changes on several maps, which could be instructive for someone who wants to make and balance their own maps.
  
== MP related features ==
+
There's any number of ways to actually do this, one might be to have a feature in the map editor that takes the name of another map and adds map labels to indicate what hexes changed. It could also be a command accessible in debug mode when playing the game, or it could be an additional command-line argument (--diff [map1] [map2] ?) for the game. (It could be a standalone application but that's probably going to end up with much more work for you.)
  
=== Use different font for in-game chat ===
+
https://github.com/wesnoth/wesnoth/issues/2323
Since commas and dots are apparently hard to tell apart. As per FR #7470 [https://gna.org/bugs/?7470]
 
  
== WML related features ==
+
Note that the current status here is that a "map diff" tool now actually exists as a GitHub action that runs on pull requests with changed maps, although there are some bugs with it that could be fixed, and having a native "map diff" tool that runs as part of Wesnoth itself would fit the original request better.
  
=== WML configurable village income / upkeep ===
+
=== Add an option to not store replays ===
Preferably as a [scenario], [side] or [campaign] keys. As per FR #6301 [https://gna.org/bugs/?6301]
 
  
=== Add support of [if] for [scenario] ===
+
As noted in https://wiki.wesnoth.org/SavefileWML all normal savefiles usually contain [replay] and [replay_start] tags that usually take over 50% of the total savefile size and are only used for providing the possibility to replay scenarios. It's be nice to have an option to skip these information to reduce the savefile size. Alternatively one could create a tool integrated in a load/savegame dialog to remove the replay information from a given savegame file.
As per FR #4539 [https://gna.org/bugs/?4539]
 
  
=== Make [have_unit] optionaly use full SUF ===
+
See the feature request https://github.com/wesnoth/wesnoth/issues/1457
[have_unit] by default uses SUF but does not apply it to recall list. Introduce an optional key that will allow to lift that limitation.
 
  
=== Side-specific results ===
+
== MP related features ==
Giving result=defeat or result=victory for specific sides. ([http://gna.org/bugs/index.php?4960 FR #4960]) -- [[User:dlr365|dlr365]] -- patch submitted [https://gna.org/bugs/index.php?4960]
 
 
 
=== Support for leaderless multiplayergames ===
 
Add support for the WML key victory_when_enemies_defeated= in the scenario tag during multiplayergames. ([https://gna.org/bugs/index.php?8106 FR #8106])
 
 
 
=== Support for standalone multiplayer scenarios ===
 
There used to be support for standalone scenarios in the userdata tree, in reorganising the trees this feature got lost and an add-on is now required to add a scenario.
 
Re-add this feature. It is probably a good idea to mirror the mainline multiplayer tree.
 
 
 
=== Other Ideas ===
 
See [[FutureWML]]; some ideas there are easier than others.
 
 
 
== Improvements to FormulaAI ==
 
  
Add new formula functions, or minor improvements to the formula language. Make it easier to debug the formula language.
+
=== Add possibility to switch off mod dependency checking ===
 +
MP modifications can define dependencies. Currently there's no way to force a "broken" configuration, although overzealous use of the system by UMC authors could make this feature useful. Add an option to the MP game creation screen to switch on/off dependency checking. Ask lipk (forum)/lipkab (IRC).
  
Please discuss these with Dragonking, Sirp or Boucman
+
https://github.com/wesnoth/wesnoth/issues/2324
  
=== Poisoning Improvement ===
+
=== Make a header for the add-on when we organize scenarios by add-on in the MP create dialog ===
  
Writing a formula that will make units with poison attacks prioritize their targets to spead poison as much as possible, avoiding already poisoned units and other useless targets
+
Using an established GUI technique to signal when one block of scenarios for an add-on ends and the next begins would make it much easier to use this dialog, if the user has several add-ons.
  
=== About to level formula ===
+
See one proposal here:
 +
https://github.com/wesnoth/wesnoth/issues/1365
  
Writing a formula that would handle units with only a few XP left to level and have them fight accordingly (most likely to kill or hit depending on XP needed, taking into account target's level)
+
=== Timer pause button ===
  
=== Healer improvements ===
+
Longstanding feature request here:
 +
https://github.com/wesnoth/wesnoth/issues/1237
  
Handle units with healing power, moving them at places where they can provide the most healing
+
Request is for either a button, or a simple chat command like :pause, :unpause, to allow players to put the timer on hold if they are interrupted.
  
 +
Ideally would be accompanied with a multiplayer-only scenario attribute "number_of_pauses" which decreases each time a client pauses the game. Pause should use a blindfold object to black out the screen, and send a chat message automatically when it occurs / resume occurs. For an example of how it might look, start a local hotseat mp game and enable the Preferences->General->Turn Dialog option. (This behavior was introduced in this commit: https://github.com/wesnoth/wesnoth/commit/bab03d554bea92f1ce6f585ef1123202173a3491)
  
=== Leader improvements ===
+
Wintermute/happygrue also has other ideas about how the timer should/could work. For example, instead of their client ending their turn, the networked opponents could be required to "confirm" the time out. (This is probably a networked MP-only idea.)
  
A bit more complicated : special handling of units with leadership to have them support units. Only do it if it actually is usefull (less hits needed to kill the unit) and ability to help multiple units in a single turn (assuming enough MP)
+
A very fancy implementation might instead of a counter, allow the other players to vote on whether a pause request is granted.
  
 +
Make sure that the paused client still responds to network commands, so that it is possible to kick a person who pauses and then doesn't ever unpause.
  
=== Berserker improvements ===
+
=== Add a "concede" button ===
  
The default AI's strategy of attacking as much as possible is very bad with berserker... A simple AI that would prevent the berserker from attacking (and keeping him close to fight without being exposed) and attack when the chance to kill is high enough would be an interesting addition
+
Often times in mp, players concede the game before their leader is actually killed. When the game ends 'officially' the map is revealed, which can sometimes be instructive for the losing player. Additionally, it makes it easier to analyze the results of many games, for purposes of balancing, or for maintaining a ladder. So while it may seem small, this would actually be a pretty useful feature.
  
=== Debugging help ===
+
There was a PR to fix this, but it never got merged due to being broken: https://github.com/wesnoth/wesnoth/pull/535
  
<s>* provide a way for a formula to have a text float over hex (for debugging purpose).</s> done by [[SummerOfCodeProposal_AI_Improvement_Crab|Crab]], patch submitted [https://gna.org/bugs/?13230]
+
This could be implemented in lua.
* in debug mode, have all AI move print their name in the log
 
  
=== New type of candidate moves : Global ===
+
=== Show [options] values in the mp lobby gameslist ===
 
to be called only once with no implicit variable
 
  
== GUI related features ==
+
It'd be useful for a newly-joining player to see the chosen [options] of a mp game, since most likely there isn't enough space we could for example wigher show the options via an extra dropdown button in the lobby or show them in the mp waiting dialog instead.
-------------------
 
  
Note at the moment Mordante is working on a new GUI system, these
+
See the featurerequest https://github.com/wesnoth/wesnoth/issues/1514
changes will probably affect the way these items need to be implemented.
 
Contact Mordante on IRC before starting to work on these.
 
 
 
--[[User:SkeletonCrew|SkeletonCrew]] 14:04, 9 March 2008 (EDT)
 
  
 +
== WML-related features ==
  
=== Theme Changes ===
+
=== Support variable poison properties ===
  
* allow custom themes to display values of WML variables ([http://gna.org/bugs/index.php?6209 FR #6209])
+
See a feature request here:
* hide the hourglass item from the statusbar when there is no timer
 
  
=== Widget Changes ===
+
https://github.com/wesnoth/wesnoth/issues/1339
* 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, ..) - note: rujasu is working on this feature
 
  
== GUI2 related features ==
+
=== Events Manipulation ===
GUI2 is the new gui engine Mordante/SkeletonCrew is working on.
 
* Information on the wiki can be found here http://www.wesnoth.org/wiki/GUIToolkit
 
* The source code is under src/gui/
 
* The configuration config files are under data/gui/default
 
  
Some tasks need the --new-widgets since the code is only shown in the experimental mode. Tasks which need this switch have the * in the title.
+
* [event] persistent="yes" - creates an event that lasts for the rest of the campaign
 +
* [disable_event][/disable_event] disables the event within which it appears (useful with conditionals). A more complex take on first_time_only=yes/no.
 +
''This is largely possible with event IDs, but could be useful when multiple copies of an event should be floating around''
  
=== Generic yes/no ok/cancel dialog ===
+
https://github.com/wesnoth/wesnoth/issues/2326
There's already a generic OK dialog
 
* src/gui/dialogs/message.[h|c]pp
 
* data/gui/default/window/message.cfg
 
  
This dialog should have the option to show a cancel button as well and also let the caller of the dialog determine the text of the button. Maybe more buttons (4 in total) can be added to make the dialog more flexible.
+
== Improvements to AI ==
  
=== * Minimap ===
+
=== Existing bugs or undesirable features ===
The minimap widget has already been made but is broken.
 
* src/gui/widgets/minimap.[c|h]pp
 
  
The drawing code has been rewritten, but this widget hasn't been updated it's used in the MP connection dialog (which needs more work).
+
Most of these are probably relatively easy to fix, although we can, of course, not guarantee that.
  
=== * Savegame dialog ===
+
* Bug: Adding a candidate action mid-turn does not include it where it belongs in terms of its evaluation score. Instead, it gets added at the end of the candidate action list and might not be executed on the current turn, because other CAs with lower scores get evaluated first.
This is a new dialog to write and requires the minimap code to be fixed first. The dialog should mimic the current dialog. Sorting of a listbox and the proper alignment of the columns is not important (the engine doesn't support this yet). The code should only be used when --new-widgets is used as start switch since we're in a feature freeze at the moment.
 
  
=== * Title screen ===
+
https://github.com/wesnoth/wesnoth/issues/2345
A start has been made for the new titlescreen
 
* src/gui/dialogs/title_screen.[c|h]pp
 
* data/gui/default/window/title_screen.cfg
 
This should be improved to include the buttons and alignment of the current title screen. The 'roll-over' image is not part of this task.
 
  
=== Arrow keys for the slider ===
+
* Bug: ai.get_new_enemy_dst_src and related functions have several problems:
There's a new slider widget, but it doesn't support the keyboard yet.
+
** They use the current moves of the enemy units, which generally are all zero.
gui/widgets/slider.[c|h]pp
+
** Hexes occupied by other enemy units count as not reachable.
 +
** Working around this with a Lua wrapper makes this actually slower than ai_helper.get_enemy_dst_src, which makes the functions pretty much useless, as speed is the only thing speaking for them.
  
Clicking on the widget should capture the keyboard and then arrow left/right should move one step even if not all steps are visible.
+
https://github.com/wesnoth/wesnoth/issues/2346
  
=== Slider sizing ===
+
== GUI2 features ==
There are some issues with the sizing of a slider.
 
gui/widgets/slider.[c|h]pp
 
  
In a layout step it needs to try to shrink itself, not entirely sure where or how yet, best ask mordante on irc.
+
Although mordante developed a new GUI system, GUI2, some dialogs still use the older GUI1 and could be improved or transferred. mordante has since disappeared, leaving GUI2's core code unmaintained; shadowm and vultraz should be able to answer most GUI2 (and even GUI1) related questions in his absence.
  
== Savegame related stuff ==
+
* Information on the wiki can be found under [[GUIToolkit]] on the wiki.
 +
* The source code is under [https://github.com/wesnoth/wesnoth/tree/master/src/gui src/gui/]
 +
* All mainline GUI2 WML resides in [https://github.com/wesnoth/wesnoth/tree/master/data/gui data/gui/]
  
=== consistent player information ===
+
* Make games sortable in the lobby (open slots, total number of players, era, XP modifier, gold per village, fog/shroud)
At the moment, the [player]-section for a campaign savegame will appear in two places: The root level of the savegame and the [replay_start]-section. This was due to a last-minute fix for 1.6 that was designed to be the least intrusive. The [player]-section should only be written to [replay_start] (and of course read from there as well).
+
* The biggest feature yet to be converted to GUI2 is the in-game Help documentation (first available from the main screen).
 
+
** There was an [https://github.com/wesnoth/wesnoth/pull/3653 initial effort to convert Help to GUI2], but appears to be pending on the implementation of a [https://github.com/wesnoth/wesnoth/issues/2687 rich-text label widget].
=== fix bug #13268 (save corruption through undo/redo of recalls [https://gna.org/bugs/?13268] ===
 
  
 
== Miscellaneous ==
 
== Miscellaneous ==
  
=== More powerful village naming ===
+
=== Debug mode ===
'''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
+
* New debug command functionality (setting additional status.variables, possibly terrain)
more powerfull names to be generated.
+
* Allowing teleportation via debug mode contextual menu: https://github.com/wesnoth/wesnoth/issues/5649
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
 
  
Euschn 24/03/2009
+
=== woptipng / wesnoth-optipng ===
 
 
=== Debug Mode ===
 
* New debug command functionality (setting additional status.variables, possibly terrain)
 
  
 +
For lossless png compression we use woptipng, a script using an external toolchain (ImageMagick, OptiPNG, Advdef, oxipng). Perhaps the performance could be improved by using oxipng or PNGOut instead of advdef. This task includes:
 +
* a quick profiling of compression ratio and decompression speed for all relevant tools
 +
* if it provides a higher compression while not significantly slowing down decompression, adapt woptipng to use PNGOut or oxipng (whichever makes more sense)
 +
* note that there is a separate repository for woptipng: [https://github.com/matthiaskrgr/woptipng https://github.com/matthiaskrgr/woptipng] (with its own issue tracker, etc.)
  
 
== Bugs ==
 
== Bugs ==

Latest revision as of 08:52, 23 December 2022

This page is outdated. For an up to date list of good starting issues, see here.

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 or Discord. 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 we'll "free" it back (that is if you're not working on it. If you have problems implementing it, just tell us....)

If none of these are to your liking, feel free to check our bug tracker with a broad spectrum of tasks.

Engine related features

Make a "map diff" tool to visualizes changes between two version of a map

Maintainers of maps often make small tweaks for balance purposes. For someone who doesn't know the map like the back of their hand it may be very difficult to spot exactly what changed. There isn't any really good way to do this right now -- using the 'diff' tool at command line doesn't give good results for .map files.

Such a tool would be helpful for someone who maintains a map pool containing maps made by others, also for someone who wants to browse a repository and examine balance changes on several maps, which could be instructive for someone who wants to make and balance their own maps.

There's any number of ways to actually do this, one might be to have a feature in the map editor that takes the name of another map and adds map labels to indicate what hexes changed. It could also be a command accessible in debug mode when playing the game, or it could be an additional command-line argument (--diff [map1] [map2] ?) for the game. (It could be a standalone application but that's probably going to end up with much more work for you.)

https://github.com/wesnoth/wesnoth/issues/2323

Note that the current status here is that a "map diff" tool now actually exists as a GitHub action that runs on pull requests with changed maps, although there are some bugs with it that could be fixed, and having a native "map diff" tool that runs as part of Wesnoth itself would fit the original request better.

Add an option to not store replays

As noted in https://wiki.wesnoth.org/SavefileWML all normal savefiles usually contain [replay] and [replay_start] tags that usually take over 50% of the total savefile size and are only used for providing the possibility to replay scenarios. It's be nice to have an option to skip these information to reduce the savefile size. Alternatively one could create a tool integrated in a load/savegame dialog to remove the replay information from a given savegame file.

See the feature request https://github.com/wesnoth/wesnoth/issues/1457

MP related features

Add possibility to switch off mod dependency checking

MP modifications can define dependencies. Currently there's no way to force a "broken" configuration, although overzealous use of the system by UMC authors could make this feature useful. Add an option to the MP game creation screen to switch on/off dependency checking. Ask lipk (forum)/lipkab (IRC).

https://github.com/wesnoth/wesnoth/issues/2324

Make a header for the add-on when we organize scenarios by add-on in the MP create dialog

Using an established GUI technique to signal when one block of scenarios for an add-on ends and the next begins would make it much easier to use this dialog, if the user has several add-ons.

See one proposal here: https://github.com/wesnoth/wesnoth/issues/1365

Timer pause button

Longstanding feature request here: https://github.com/wesnoth/wesnoth/issues/1237

Request is for either a button, or a simple chat command like :pause, :unpause, to allow players to put the timer on hold if they are interrupted.

Ideally would be accompanied with a multiplayer-only scenario attribute "number_of_pauses" which decreases each time a client pauses the game. Pause should use a blindfold object to black out the screen, and send a chat message automatically when it occurs / resume occurs. For an example of how it might look, start a local hotseat mp game and enable the Preferences->General->Turn Dialog option. (This behavior was introduced in this commit: https://github.com/wesnoth/wesnoth/commit/bab03d554bea92f1ce6f585ef1123202173a3491)

Wintermute/happygrue also has other ideas about how the timer should/could work. For example, instead of their client ending their turn, the networked opponents could be required to "confirm" the time out. (This is probably a networked MP-only idea.)

A very fancy implementation might instead of a counter, allow the other players to vote on whether a pause request is granted.

Make sure that the paused client still responds to network commands, so that it is possible to kick a person who pauses and then doesn't ever unpause.

Add a "concede" button

Often times in mp, players concede the game before their leader is actually killed. When the game ends 'officially' the map is revealed, which can sometimes be instructive for the losing player. Additionally, it makes it easier to analyze the results of many games, for purposes of balancing, or for maintaining a ladder. So while it may seem small, this would actually be a pretty useful feature.

There was a PR to fix this, but it never got merged due to being broken: https://github.com/wesnoth/wesnoth/pull/535

This could be implemented in lua.

Show [options] values in the mp lobby gameslist

It'd be useful for a newly-joining player to see the chosen [options] of a mp game, since most likely there isn't enough space we could for example wigher show the options via an extra dropdown button in the lobby or show them in the mp waiting dialog instead.

See the featurerequest https://github.com/wesnoth/wesnoth/issues/1514

WML-related features

Support variable poison properties

See a feature request here:

https://github.com/wesnoth/wesnoth/issues/1339

Events Manipulation

  • [event] persistent="yes" - creates an event that lasts for the rest of the campaign
  • [disable_event][/disable_event] disables the event within which it appears (useful with conditionals). A more complex take on first_time_only=yes/no.

This is largely possible with event IDs, but could be useful when multiple copies of an event should be floating around

https://github.com/wesnoth/wesnoth/issues/2326

Improvements to AI

Existing bugs or undesirable features

Most of these are probably relatively easy to fix, although we can, of course, not guarantee that.

  • Bug: Adding a candidate action mid-turn does not include it where it belongs in terms of its evaluation score. Instead, it gets added at the end of the candidate action list and might not be executed on the current turn, because other CAs with lower scores get evaluated first.

https://github.com/wesnoth/wesnoth/issues/2345

  • Bug: ai.get_new_enemy_dst_src and related functions have several problems:
    • They use the current moves of the enemy units, which generally are all zero.
    • Hexes occupied by other enemy units count as not reachable.
    • Working around this with a Lua wrapper makes this actually slower than ai_helper.get_enemy_dst_src, which makes the functions pretty much useless, as speed is the only thing speaking for them.

https://github.com/wesnoth/wesnoth/issues/2346

GUI2 features

Although mordante developed a new GUI system, GUI2, some dialogs still use the older GUI1 and could be improved or transferred. mordante has since disappeared, leaving GUI2's core code unmaintained; shadowm and vultraz should be able to answer most GUI2 (and even GUI1) related questions in his absence.

  • Information on the wiki can be found under GUIToolkit on the wiki.
  • The source code is under src/gui/
  • All mainline GUI2 WML resides in data/gui/
  • Make games sortable in the lobby (open slots, total number of players, era, XP modifier, gold per village, fog/shroud)
  • The biggest feature yet to be converted to GUI2 is the in-game Help documentation (first available from the main screen).

Miscellaneous

Debug mode

woptipng / wesnoth-optipng

For lossless png compression we use woptipng, a script using an external toolchain (ImageMagick, OptiPNG, Advdef, oxipng). Perhaps the performance could be improved by using oxipng or PNGOut instead of advdef. This task includes:

  • a quick profiling of compression ratio and decompression speed for all relevant tools
  • if it provides a higher compression while not significantly slowing down decompression, adapt woptipng to use PNGOut or oxipng (whichever makes more sense)
  • note that there is a separate repository for woptipng: https://github.com/matthiaskrgr/woptipng (with its own issue tracker, etc.)

Bugs

See Also

NotSoEasyCoding

This page was last edited on 23 December 2022, at 08:52.