Difference between revisions of "NotSoEasyCoding"
SkeletonCrew (talk | contribs) (→Integrate WesCamp-i18n into the Campaign Server: Removed section which has been done) |
(→Gold graph: replace GNA link with Wayback Machine backup) |
||
(107 intermediate revisions by 25 users not shown) | |||
Line 1: | Line 1: | ||
− | + | This page lists projects which are considered a good idea by the developers, but which have nobody working on them so far. The tasks here are significantly more difficult than the ones in the similar [[EasyCoding]] page. If you think you've got the required skill for one of the tasks listed here, go on, implement it, and you've got a high chance that it'll be accepted. The remaining barrier will only be that it's done well. :-) | |
− | This page | ||
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 | + | If you plan to work on a feature, write your name at the bottom of the feature, with the date. Note that if you spend 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...). We sometimes forget to update this page so it is recommended that, before you start to work on a task, that you ask in irc/Discord whether its still considered a good idea. |
− | + | If you are part of the Wesnoth dev team you can also add new entries to the list, a new entry must contain at least | |
− | + | 1) A description of the problem. | |
− | + | 2) A motivation why or in which situations this is important. | |
+ | 3) A link to a corresponding ticket on our bugtracker for discussion, if there is no ticket yet, then make one. | ||
− | + | __TOC__ | |
+ | == Game engine == | ||
+ | === [[OpenGL port]] === | ||
− | + | While software rendering is all good and nice, Wesnoth's approach does not scale well as display resolutions increase and the need for supporting high DPI configurations is factored in. One can easily see that our zoom functionality is clunky and inefficient. Having support for OpenGL and shaders would also enable us to implement fancier graphical gimmicks such as particle effects and atmospheric lighting. The downside of adding OpenGL to the mix is that we'd need people with a specific skillset to help us maintain the graphics engine in the long term, as hardware and driver-specific quirks are inevitable. Some users are also concerned about changing Wesnoth's hardware requirements so that they would be unable to play using old or unsupported hardware/OS configurations. | |
− | |||
− | + | For hardware rendering to be effective, in particular, Wesnoth would necessitate a complete rewrite of the graphics rendering code (the display and game_display classes), the image cache manager (used to abstract the process of loading images from disk and applying image path functions), and potentially GUI2's canvas code. All three would have to limit the amount of textures they allocate to the absolute minimum, using larger textures instead. For example, the image cache could be reimplemented to load images from an internal spritesheet generated during the game loading process. (WML/Lua support for spritesheets would be nice would defining an API for it would only distract from the actual task at hand.) | |
− | + | The greatest difficulty in handling this task probably lies in writing a new optimized rendering engine and updating all code that relies on the old display/game_display API and semantics accordingly. The GUI2 framework code is presently unmaintained and it would take some time for somebody to study and change the current implementation. Finally, as we don't have a graphics engine maintainer at this time, this task involves an implicit long-term commitment to the project that extends beyond whichever Wesnoth series that will see this project completed. | |
− | + | One of the many issues related to switching from software rendering to hardware rendering is Wesnoth's [[ImagePathFunctions]] mini-language. There is already a proof of concept [https://github.com/CelticMinstrel/wesnoth-ipf here] that converts most IPFs to OpenGL shader code, but quite a bit more work would need to be done to make something usable out of it. In particular, the ability to compile arbitrary [[Wesnoth Formula Language]] code into shaders would be needed, since some IPFs embed the language. | |
− | == | + | === Improve WML error reporting === |
− | |||
− | + | There are many programming bugs that give very unclear or cryptic error messages when using WML. Here are some examples: | |
− | + | * <strike>When calling a macro with the wrong number of arguments, Wesnoth tells the number it expected, and the number it got, and at which line number it was instantiated. However, it would be helpful if it would also tell the line number of the definition of the macro. This might be helpful if someone is redefining macros.</strike> | |
− | + | * For places where a standard unit filter is expected, if one is not found, the game should point out a problem. For places where such a filter is expected but [filter] child should not appear, if one does it should report an error and a line number. Many users have a hard time with this kind of thing. | |
− | As | + | * When doing scenario transitions in a campaign, if the side definitions don't match up exactly the game tends to give unintelligible error messages. For instance, if one is transitioning and there is an AI side which does not have a leader (but it has a starting location in the map) it must have "no_leader = yes" in its [side] tag, or else when the team_builder objects enter stage two, the game will try to create a unit with an empty type, and the constructor of class unit will fail giving the error message "game::game_error tried to create unit with empty type". This really needs to be much better. For instance, giving a line number of a problem, or suggesting that no_leader should be used. (Note that, it is often possible to debug problems like this by turning on --log-debug=team_construction at commandline but I doubt that there are any users that know about this, you would only learn from reading the C++... without such debug info, fixing things like this can literally take hours.) For that matter it's some question why the team_builder doesn't just stop trying to build a unit when it sees it doesn't have enough info... |
+ | |||
+ | * Recursive macros break the game, and not by stack overflow but by exhausting the heap (which usually takes forever on modern OSes and results in memory thrashing <i>before</i> resource starvation). It would be nice if we could catch this and report an error. | ||
+ | |||
+ | Many WML users are students or beginners to programming, so any improvements to WML error reporting are a big help for their learning process -- many veterans would appreciate the extra help as well. In part we need fixits here and there, but more broadly we need a smarter system that can figure out what's really wrong when things go wrong, and give helpful suggestions. | ||
+ | |||
+ | |||
+ | === Don't store all events in savefiles === | ||
+ | |||
+ | Currently all events in a scenario are stored twice in each savefile (in [snapshot] and it [replay_start]), specially on wml-heavy umc content this can make savefiles quite big, The proposed solution is that events are not stored in savefiles when they are the same as in the scenario/era/modification file (e.g. not dynamically added with actionwml). | ||
+ | In detail the savefile should for all events that have an id and are not generated dynamically ([event] actionwml), store dummy events like | ||
+ | [event] | ||
+ | id=event_id | ||
+ | is_unchanged=yes | ||
+ | [/event] | ||
+ | in the savefiles (instead of full events), where the event is then read from the scenario/era/modification tag when the scenario is loaded. This should only apply to campaigns/modifications/mp maps/eras that require download (which is usually the case for campaigns but not for mp maps) | ||
+ | |||
+ | |||
+ | See also https://github.com/wesnoth/wesnoth/issues/1512 | ||
+ | |||
+ | == Multiplayer/replay features == | ||
+ | |||
+ | === Gold graph === | ||
+ | |||
+ | Make a graph feature, presumably in a dialog, that helps depict the history of a Wesnoth match for the benefit of spectators of a live game or replay. For example it could display army value, army + bank value, number of villages tagged, luck swings... This would also be particularly helpful for AI tweaking development, by helping coders identify the AI's weaknesses and strengths in the context of a particular scenario. | ||
+ | |||
+ | A possible nice feature for this purpose would be to allow the user to click on the graph at key points which would trigger the "back to turn" mechanism to jump back in the replay, or automatically play the replay forwards from the beginning to that point... etc. | ||
+ | |||
+ | Related email on dev-talk: http://web.archive.org/web/20170505024430/https://mail.gna.org/public/wesnoth-dev/2014-02/msg00089.html | ||
+ | |||
+ | === Automatically link up to wesnothd server on a local network === | ||
+ | |||
+ | The feature request was to use ZeroConf technology, if available, to publish info of a running wesnothd instance to other machines on a local network. Then when they are searching to connect to an unofficial server, they won't have to learn the IP address. | ||
+ | |||
+ | The extra code should be guarded with preprocessor flags so that ZeroConf does not become a mandatory build dependency of Wesnoth. | ||
+ | |||
+ | https://github.com/wesnoth/wesnoth/issues/1162 | ||
+ | |||
+ | === Stock MP chat messages for language-independent communication === | ||
+ | |||
+ | Wesnoth has seen a large acceptance by international communities, and many players don't speak English. It would be nice we could have a set of messages that could be chatted, but which will be translated by our translators and displayed always in the current locale on each client, to make it easier to communicate in mp games / on the mp server. | ||
+ | |||
+ | The easy part is adding the messages. They would ideally be stored in a WML file in the core data dir so they can be easily modified and translated like all other mainline WML. The hard part is devising the interaction mechanism so that a player can easily make use of these stock messages in the MP lobby or in game. | ||
+ | |||
+ | |||
+ | == GUI2 framework == | ||
+ | |||
+ | As of 1.13.1+dev, GUI2's core and framework (including widgets and their APIs) are completely unmaintained. A prospective maintainer would have to be able to understand pretty advanced C++ making abundant use of template-based abstractions (most notably, the event handling code is almost completely implemented this way), multiple inheritance, and polymorphism. There is also some missing functionality (such as combo boxes and modeless dialogs) that the author did not get to implement, as well as work-in-progress functionality (new listbox and tooltip implementations, not enabled by default). | ||
+ | |||
+ | === GUI2 themable in-game UI === | ||
+ | |||
+ | The "themable" in-game UI refers to the gameplay UI including the sidebar, menu/status bar, and map view. Most of it is not implemented using proper GUI1 widgets at all, except for the various interactive buttons, menus (which are floating GUI1 listboxes), and the command and chat input boxes (floating GUI1 textboxes). | ||
+ | |||
+ | Moving the theme UI to GUI2 would probably require finishing up theme support in GUI2 (which is largely incomplete), and may benefit from a rendering engine redesign as is also required for porting the game to SDL 2; in particular so that the GUI aspects are more clearly separated from the game board rendering aspect. | ||
+ | |||
+ | '''Note:''' This task is here solely for the sake of completeness, and only somebody very well versed in the intricacies of Wesnoth's game rendering code and GUI2 should '''ever''' try to take it up. (And even then, I would not want to be anywhere near that person when they inevitably break down and fling one or more tables around upon realizing the sheer complexity of the task. -- Iris) | ||
+ | |||
+ | == Add-ons server and client == | ||
+ | |||
+ | === Passphrase hashing === | ||
+ | |||
+ | The add-ons server ([[campaignd]]) uses a very dumb authentication scheme for uploading add-ons where an author sets a passphrase (or gets a random passphrase assigned by the game) the first time they upload to the server, and subsequent uploads of the same add-on are only allowed if the passphrase matches. The passphrase is stored in clear text form both client and server-side, which has [http://forums.wesnoth.org/viewtopic.php?f=62&t=42663 various implications]. | ||
+ | |||
+ | Ideally, the server would store all passphrases in a hashed form. | ||
+ | |||
+ | === Port redirection === | ||
+ | |||
+ | Wesnoth's MP server (wesnothd) uses a single port (15000) for servicing most requests and redirects clients to different ports according to the game client's version number. This allows the server administrators to reassign ports freely without having to modify the game client. | ||
+ | |||
+ | The add-ons server (campaignd) and client instead have a hardcoded default port number for a Wesnoth version series. For example, 1.12.x is hardcoded to default to 15006. This becomes a maintainability issue as add-on servers get decommissioned and their port numbers can't be reused for fear of misdirecting obsolete client versions to the wrong instance with incompatible add-ons. | ||
+ | |||
+ | == Multiplayer server and client == | ||
+ | |||
+ | === Improve server WML processing === | ||
+ | |||
+ | The server uses its own custom WML implementation separate from the main engine's to store and process WML objects for games -- see [[WesnothdDesign#simple_wml]]. This is intended to improve performance and reduce wesnothd's memory footprint with large numbers of games and complex scenarios. However, the simple_wml code sometimes messes up WML attribute translatability, resulting in MP scenarios/campaigns being untranslated for non-hosts in networked MP (https://github.com/wesnoth/wesnoth/issues/1420). Fixing this is not easy due to the aforementioned performance requirements. | ||
+ | |||
+ | == WML-related features == | ||
+ | === Game Information === | ||
+ | |||
+ | * [query_location] - queries a location from the user | ||
+ | ** variable | ||
+ | ** [filter_location] | ||
+ | ''Regarding [query_location]: probably a better name would be choose_location. This is used when a wml event is running and needs to get a target location hex from the user. For example, you right click on a catapult unit and choose the menu item "fire Catapult." Now a [message] says to click on any target within 5 hexes. Now [choose_location] is encountered and the mouse cursor changes to a target sign (possibly customizable). If the user's mouse drifts outside of the allowed locations it changes to a cancel icon. If the operation is cancelled then the variable is cleared and no location stored. --Sapient'' | ||
+ | |||
+ | ''This can be implemented in lua by using wesnoth.game_events.on_mouse_action and wesnoth.syncronize_choice'' | ||
+ | |||
+ | https://github.com/wesnoth/wesnoth/issues/2325 |
Latest revision as of 20:08, 6 June 2024
This page lists projects which are considered a good idea by the developers, but which have nobody working on them so far. The tasks here are significantly more difficult than the ones in the similar EasyCoding page. If you think you've got the required skill for one of the tasks listed here, go on, implement it, and you've got a high chance that it'll be accepted. The remaining barrier will only be that it's done well. :-)
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 spend 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...). We sometimes forget to update this page so it is recommended that, before you start to work on a task, that you ask in irc/Discord whether its still considered a good idea.
If you are part of the Wesnoth dev team you can also add new entries to the list, a new entry must contain at least
1) A description of the problem. 2) A motivation why or in which situations this is important. 3) A link to a corresponding ticket on our bugtracker for discussion, if there is no ticket yet, then make one.
Contents
Game engine
OpenGL port
While software rendering is all good and nice, Wesnoth's approach does not scale well as display resolutions increase and the need for supporting high DPI configurations is factored in. One can easily see that our zoom functionality is clunky and inefficient. Having support for OpenGL and shaders would also enable us to implement fancier graphical gimmicks such as particle effects and atmospheric lighting. The downside of adding OpenGL to the mix is that we'd need people with a specific skillset to help us maintain the graphics engine in the long term, as hardware and driver-specific quirks are inevitable. Some users are also concerned about changing Wesnoth's hardware requirements so that they would be unable to play using old or unsupported hardware/OS configurations.
For hardware rendering to be effective, in particular, Wesnoth would necessitate a complete rewrite of the graphics rendering code (the display and game_display classes), the image cache manager (used to abstract the process of loading images from disk and applying image path functions), and potentially GUI2's canvas code. All three would have to limit the amount of textures they allocate to the absolute minimum, using larger textures instead. For example, the image cache could be reimplemented to load images from an internal spritesheet generated during the game loading process. (WML/Lua support for spritesheets would be nice would defining an API for it would only distract from the actual task at hand.)
The greatest difficulty in handling this task probably lies in writing a new optimized rendering engine and updating all code that relies on the old display/game_display API and semantics accordingly. The GUI2 framework code is presently unmaintained and it would take some time for somebody to study and change the current implementation. Finally, as we don't have a graphics engine maintainer at this time, this task involves an implicit long-term commitment to the project that extends beyond whichever Wesnoth series that will see this project completed.
One of the many issues related to switching from software rendering to hardware rendering is Wesnoth's ImagePathFunctions mini-language. There is already a proof of concept here that converts most IPFs to OpenGL shader code, but quite a bit more work would need to be done to make something usable out of it. In particular, the ability to compile arbitrary Wesnoth Formula Language code into shaders would be needed, since some IPFs embed the language.
Improve WML error reporting
There are many programming bugs that give very unclear or cryptic error messages when using WML. Here are some examples:
When calling a macro with the wrong number of arguments, Wesnoth tells the number it expected, and the number it got, and at which line number it was instantiated. However, it would be helpful if it would also tell the line number of the definition of the macro. This might be helpful if someone is redefining macros.
- For places where a standard unit filter is expected, if one is not found, the game should point out a problem. For places where such a filter is expected but [filter] child should not appear, if one does it should report an error and a line number. Many users have a hard time with this kind of thing.
- When doing scenario transitions in a campaign, if the side definitions don't match up exactly the game tends to give unintelligible error messages. For instance, if one is transitioning and there is an AI side which does not have a leader (but it has a starting location in the map) it must have "no_leader = yes" in its [side] tag, or else when the team_builder objects enter stage two, the game will try to create a unit with an empty type, and the constructor of class unit will fail giving the error message "game::game_error tried to create unit with empty type". This really needs to be much better. For instance, giving a line number of a problem, or suggesting that no_leader should be used. (Note that, it is often possible to debug problems like this by turning on --log-debug=team_construction at commandline but I doubt that there are any users that know about this, you would only learn from reading the C++... without such debug info, fixing things like this can literally take hours.) For that matter it's some question why the team_builder doesn't just stop trying to build a unit when it sees it doesn't have enough info...
- Recursive macros break the game, and not by stack overflow but by exhausting the heap (which usually takes forever on modern OSes and results in memory thrashing before resource starvation). It would be nice if we could catch this and report an error.
Many WML users are students or beginners to programming, so any improvements to WML error reporting are a big help for their learning process -- many veterans would appreciate the extra help as well. In part we need fixits here and there, but more broadly we need a smarter system that can figure out what's really wrong when things go wrong, and give helpful suggestions.
Don't store all events in savefiles
Currently all events in a scenario are stored twice in each savefile (in [snapshot] and it [replay_start]), specially on wml-heavy umc content this can make savefiles quite big, The proposed solution is that events are not stored in savefiles when they are the same as in the scenario/era/modification file (e.g. not dynamically added with actionwml). In detail the savefile should for all events that have an id and are not generated dynamically ([event] actionwml), store dummy events like
[event] id=event_id is_unchanged=yes [/event]
in the savefiles (instead of full events), where the event is then read from the scenario/era/modification tag when the scenario is loaded. This should only apply to campaigns/modifications/mp maps/eras that require download (which is usually the case for campaigns but not for mp maps)
See also https://github.com/wesnoth/wesnoth/issues/1512
Multiplayer/replay features
Gold graph
Make a graph feature, presumably in a dialog, that helps depict the history of a Wesnoth match for the benefit of spectators of a live game or replay. For example it could display army value, army + bank value, number of villages tagged, luck swings... This would also be particularly helpful for AI tweaking development, by helping coders identify the AI's weaknesses and strengths in the context of a particular scenario.
A possible nice feature for this purpose would be to allow the user to click on the graph at key points which would trigger the "back to turn" mechanism to jump back in the replay, or automatically play the replay forwards from the beginning to that point... etc.
Related email on dev-talk: http://web.archive.org/web/20170505024430/https://mail.gna.org/public/wesnoth-dev/2014-02/msg00089.html
Automatically link up to wesnothd server on a local network
The feature request was to use ZeroConf technology, if available, to publish info of a running wesnothd instance to other machines on a local network. Then when they are searching to connect to an unofficial server, they won't have to learn the IP address.
The extra code should be guarded with preprocessor flags so that ZeroConf does not become a mandatory build dependency of Wesnoth.
https://github.com/wesnoth/wesnoth/issues/1162
Stock MP chat messages for language-independent communication
Wesnoth has seen a large acceptance by international communities, and many players don't speak English. It would be nice we could have a set of messages that could be chatted, but which will be translated by our translators and displayed always in the current locale on each client, to make it easier to communicate in mp games / on the mp server.
The easy part is adding the messages. They would ideally be stored in a WML file in the core data dir so they can be easily modified and translated like all other mainline WML. The hard part is devising the interaction mechanism so that a player can easily make use of these stock messages in the MP lobby or in game.
GUI2 framework
As of 1.13.1+dev, GUI2's core and framework (including widgets and their APIs) are completely unmaintained. A prospective maintainer would have to be able to understand pretty advanced C++ making abundant use of template-based abstractions (most notably, the event handling code is almost completely implemented this way), multiple inheritance, and polymorphism. There is also some missing functionality (such as combo boxes and modeless dialogs) that the author did not get to implement, as well as work-in-progress functionality (new listbox and tooltip implementations, not enabled by default).
GUI2 themable in-game UI
The "themable" in-game UI refers to the gameplay UI including the sidebar, menu/status bar, and map view. Most of it is not implemented using proper GUI1 widgets at all, except for the various interactive buttons, menus (which are floating GUI1 listboxes), and the command and chat input boxes (floating GUI1 textboxes).
Moving the theme UI to GUI2 would probably require finishing up theme support in GUI2 (which is largely incomplete), and may benefit from a rendering engine redesign as is also required for porting the game to SDL 2; in particular so that the GUI aspects are more clearly separated from the game board rendering aspect.
Note: This task is here solely for the sake of completeness, and only somebody very well versed in the intricacies of Wesnoth's game rendering code and GUI2 should ever try to take it up. (And even then, I would not want to be anywhere near that person when they inevitably break down and fling one or more tables around upon realizing the sheer complexity of the task. -- Iris)
Add-ons server and client
Passphrase hashing
The add-ons server (campaignd) uses a very dumb authentication scheme for uploading add-ons where an author sets a passphrase (or gets a random passphrase assigned by the game) the first time they upload to the server, and subsequent uploads of the same add-on are only allowed if the passphrase matches. The passphrase is stored in clear text form both client and server-side, which has various implications.
Ideally, the server would store all passphrases in a hashed form.
Port redirection
Wesnoth's MP server (wesnothd) uses a single port (15000) for servicing most requests and redirects clients to different ports according to the game client's version number. This allows the server administrators to reassign ports freely without having to modify the game client.
The add-ons server (campaignd) and client instead have a hardcoded default port number for a Wesnoth version series. For example, 1.12.x is hardcoded to default to 15006. This becomes a maintainability issue as add-on servers get decommissioned and their port numbers can't be reused for fear of misdirecting obsolete client versions to the wrong instance with incompatible add-ons.
Multiplayer server and client
Improve server WML processing
The server uses its own custom WML implementation separate from the main engine's to store and process WML objects for games -- see WesnothdDesign#simple_wml. This is intended to improve performance and reduce wesnothd's memory footprint with large numbers of games and complex scenarios. However, the simple_wml code sometimes messes up WML attribute translatability, resulting in MP scenarios/campaigns being untranslated for non-hosts in networked MP (https://github.com/wesnoth/wesnoth/issues/1420). Fixing this is not easy due to the aforementioned performance requirements.
Game Information
- [query_location] - queries a location from the user
- variable
- [filter_location]
Regarding [query_location]: probably a better name would be choose_location. This is used when a wml event is running and needs to get a target location hex from the user. For example, you right click on a catapult unit and choose the menu item "fire Catapult." Now a [message] says to click on any target within 5 hexes. Now [choose_location] is encountered and the mouse cursor changes to a target sign (possibly customizable). If the user's mouse drifts outside of the allowed locations it changes to a cancel icon. If the operation is cancelled then the variable is cleared and no location stored. --Sapient
This can be implemented in lua by using wesnoth.game_events.on_mouse_action and wesnoth.syncronize_choice