Wesnoth Collaborative Editor

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Wesnoth Collaborative Editor

Post by tsr »

The map-making contest has generated a few play-testing games on the servers.

During one of those grrr came up with the idea to create an online map-editor. We started talking and I said something like "Well, I'll give it a try and let zookeeper finish it". And here we are.

Attached is an 1.7.7 add-on that functions as an online map-editor.

Features:
- changing terrain (by menu-options or by entering a terrain string)
- changing ownership of villages (works but is ugly)
- storing up to 5 game-states (including: all units with position, gold, ownership of villages and ToD)
- restoring the above game-states
- moving units around

Bugs, ugly code, limitations, etc:
- put everything in one event instead of three
- get the side_id information in one place instead of both in terrain_menu and game_menu (I intend to use this in the change-ownership-of-village-code)
- clean up the village owner menu_item
- when loading gamestates terrain added efter the snapshot is still changed, bug or feature (I vote for bug, but for now it is a feature ;))?
- Only the first "canrecruit=yes"-side can store and restore gamestates (this is to ensure integrity of gamestates
- To save and load your maps you have to use the wesnoth main menu and save the new map over the old one (if you don't want to edit the config file before creating a new game with the map)
- You have to edit starting positions manually
- To preserve the correct ToD when restoring gamestates I manipulate the current turn so I would not try to use this on a scenario with fixed turn limit.
- Please note that changing objectives, changed variable-values, unset variables, etc, wont be handled with (re)storing gamestates so you should probably only use this in straight "victory_when_enemies_defeated=yes"-scenarios
- I haven't been able to test for if all parties need to have the add-on installed (and maybe even activated on the specific scenario) or not


How to use:
1. Download the attached .tar.gz
2. untar it in your local add-ons directory
3. Open your favorite wesnoth-text-editor
4. Open the scenario-file of the map you want to edit
5. Somewhere near the top paste (under [multiplayer]):

Code: Select all

    {~add-ons/WCE/}
    {WCE_LOAD_EDITOR}
6. Load up a new multiplayer game and start editing ;)

Ok, that's it, test away and let me know of any bugs.

I am especially interested in finding out:
- if I missed to include any game-altering terrain in the terrain-menus
- a cleaner way of changing ownership of villages
- if there is any way to save new starting positions in a loaded map.

/tsr

[Edit] Added information about not tested with clients without the add-on
[Edit2] Removed the files and posted new ones below
Last edited by tsr on November 10th, 2009, 9:17 am, edited 1 time in total.
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: Wesnoth Collaborative Editor

Post by tsr »

Oops. two fairly small bugs where just squeezed...

/tsr

[Edit]Removed the files, see below for a new, better version that even gives you shiny hair ;)
Last edited by tsr on November 15th, 2009, 11:36 pm, edited 1 time in total.
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Re: Wesnoth Collaborative Editor

Post by Boucman »

that is both an interesting and impressive idea...

this would be particularly cool if you were able to playtest at the same time you edit...

being able to "restart" the game from within the game would probably help with that...
Fight key loggers: write some perl using vim
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: Wesnoth Collaborative Editor

Post by tsr »

Boucman wrote:that is both an interesting and impressive idea...

this would be particularly cool if you were able to playtest at the same time you edit...

being able to "restart" the game from within the game would probably help with that...
I'm not sure that I follow you, but it is my understanding of the add-on that you can do exactly that.

You can:
- store a "gamestate" (that is: what units are on the map and where, what ToD it is, gold of each side, village ownership of each side)
- you can edit the terrain instantaneously
- you can move units to new locations (to compensate for the terrain edits, try new approaches, change the starting locations of leaders, etc)
- you can restore "gamestates"
- at the moment "gamestates" don't take terrain into account so edits after storing a specific "gamestate" are kept - I have not decided yet if this is a feature or bug. (although the current and last terrain of edited hexes are shown as labels on the map)

So if you store a "gamestate" at the beginning of the game you are able to "restart" it.

Could you please elaborate on what you would want more?

(I am going to include a feature to spawn specific units with specific traits at specific locations too, this is for being to easily test for the dreaded quick bat, etc)

/tsr
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Wesnoth Collaborative Editor

Post by Gambit »

Dang. Had an MP map editor in the works. One less thing for the summer to-do list though.

Congrats tsr. This is awesome! I don't see any 1.7 specific features. Do you plan to backport it or no because 1.8 will be out soon?
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: Wesnoth Collaborative Editor

Post by tsr »

Hehe, well good for you ;)

No, no intentions of backporting it. 1.8 will be out before this has been tested and reworked for an upload anyway.

/tsr
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: Wesnoth Collaborative Editor

Post by tsr »

[Note to self]
Hm, the move unit thingy is buggy!

Apparently units can disappear, kill other units accidentally, etc. I need to find a way to cancel that menu-item and also to check for units already on the field. Maybe it would be nice to move units with my original idea: first select unit then right click on empty hex to move unit there.
[/Note to self]


Ok, WML-gurus: how do I implement a back-functionality in option-messages? So that I get back to the previous message and not just cancel out the whole message-menu and force the players to start all over?

/tsr
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Wesnoth Collaborative Editor

Post by Sapient »

tsr wrote: Ok, WML-gurus: how do I implement a back-functionality in option-messages? So that I get back to the previous message and not just cancel out the whole message-menu and force the players to start all over?

/tsr
Probably the cleanest way to organize it is to have a separate event for each option menu and then fire the events as needed (using [fire_event]).

Otherwise, you can use nested [while] loops.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Re: Wesnoth Collaborative Editor

Post by Boucman »

tsr wrote: I'm not sure that I follow you, but it is my understanding of the add-on that you can do exactly that.
yup, seems so...

the only thing is that it would be nice if the edito auto-saved at the start, but thats a minor detail...
Fight key loggers: write some perl using vim
grrr
Posts: 252
Joined: May 25th, 2007, 9:49 pm

Re: Wesnoth Collaborative Editor

Post by grrr »

nice
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: Wesnoth Collaborative Editor

Post by tsr »

Ok, here comes a reworked version... It is still not completely cleaned up, so it stays on the forums for now...

Below, are copy-pasted parts of my first post so that I can note the changes:

Attached is an 1.7.78 add-on that functions as an online map-editor.

Features:
- changing terrain (by menu-options or by entering a terrain string)
- changing ownership of villages (works but is ugly)
- storing up to 5 game-states (including: terrain, all units with position, gold, ownership of villages and ToD)
- restoring the above game-states
- moving units around (and now you can't kill other units by doing so, although you can scout unit positions under fog ;)

Bugs, ugly code, limitations, etc:
- put everything in one event instead of three
- get the side_id information in one place instead of both in terrain_menu and game_menu (I intend to use this in the change-ownership-of-village-code)
- clean up the village owner menu_item
- when loading gamestates terrain added efter the snapshot is still changed, bug or feature (I vote for bug, but for now it is a feature ;))?
- Only the first "canrecruit=yes"-side can store and restore gamestates (this is to ensure integrity of gamestates
- To save and load your maps you have to use the wesnoth main menu and save the new map over the old one (if you don't want to edit the config file before creating a new game with the map)
- You have to edit starting positions manually
- To preserve the correct ToD when restoring gamestates I manipulate the current turn so I would not try to use this on a scenario with fixed turn limit.
- Please note that changing objectives, changed variable-values, unset variables, etc, wont be handled with (re)storing gamestates so you should probably only use this in straight "victory_when_enemies_defeated=yes"-scenarios
- I haven't been able to test for if all parties need to have the add-on installed (and maybe even activated on the specific scenario) or not


How to use:
1. Download the attached .tar.gz
2. untar it in your local add-ons directory
3. Open your favorite wesnoth-text-editor
4. Open the scenario-file of the map you want to edit
5. Somewhere near the top paste (under [multiplayer]):

Code: Select all

    {~add-ons/WCE/}
6. Load up a new multiplayer game and start editing ;)

Ok, that's it, test away and let me know of any bugs.

I am especially interested in finding out:
- if I missed to include any game-altering terrain in the terrain-menus
- a cleaner way of changing ownership of villages
- if there is any way to save new starting positions in a loaded map.

/tsr

[Edit]Deleted the files since there is now a version on the add-on server
Last edited by tsr on November 21st, 2009, 6:35 pm, edited 1 time in total.
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: Wesnoth Collaborative Editor

Post by tsr »

Hehe, coming to see how many downloads I had I noticed that I am not a "Forum Regular" anymore but a "WML-pioneer" :D

That's nice (I think), but it would be even more nice if someone could give feedback :P

/tsr
tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Re: Wesnoth Collaborative Editor

Post by tsr »

Ok, so the complete lack of feedback made me finish the project enough for publishing on the add-on server in hopes that it will get some testing...

Now it is there ;)

New features include:
- automatic snapshot at start of game
- option the restore snapshots with or without terrain-modifications (in relation to the original map)

There are still some things lacking:
- the creation of a special snapshot: undo-restore to allow users to forget to make a new snapshot before they restore an old one.
- the possibility to spawn specific units (with specific traits) at certain locations.
- creating a introductory/tutorial-scenario that will show up in the mp-create screen.
- documentation
- testing
- a bit of macrofying and beautifying of the code
(if you are a master WML-er you are encouraged to check the code out and give feedback on how I could improve it - both in matters of functionality but more importantly in readability and conformity to some kind of WML-coding standards)

The past archives in this thread will be deleted and you should use the version on the add-on server instead.

Happy editing,
tsr
mich
Translator
Posts: 134
Joined: November 11th, 2008, 8:54 am
Location: Italy

Re: Wesnoth Collaborative Editor

Post by mich »

Hi tsr, I find this a really interesting idea. At the moment I have only tried it in local games, just to understand how it works, but i plan to use it in real multiplayer to try to balance my maps with someone else help.

Trying it a little, I have seen that there is a bug in the move unit option. When no unit is selected, or if the unit moved from the position where it was selected, there is a game crash.
Also, the need to add the line {~add-ons/WCE/} to the .cfg file is easy, but probably this prevent the use of the add on from the less experienced users.

So I have made it some littles changes to fix this two problems, if you have time try it and if you like some of them, fell free to include them in the "official" release.

changelog:
* fixed crash when no unit is selected (or there is no unit at move_x,move_y) (this can be made better, but works).
* now the add-on is an era, so it works with all the maps out of the box (you need only to choose to use this era), the problem of this is that (at least at the moment) it includes only the default era. I prefer this way, and maybe compatibility with most know eras can be added.

I have also noted that some terrains are missing, and that the terrain menu can be improved a little. If you want I can try to make something.

Let me know what you think, and as usual, sorry for my bad english.
Attachments
_main.cfg
(30.31 KiB) Downloaded 403 times
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: Wesnoth Collaborative Editor

Post by melinath »

tsr: the add-on currently corrupts my global environment, since the _main.cfg gets included in every single thing I do and there's no #ifdef filtering any of it out... perhaps use a deeper-nested file, since one just has to include it anyway?
Post Reply