New win condition: artifacts

Bug #1508553 reported by wl-zocker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Wishlist
Unassigned

Bug Description

Recently, a new win condition has been proposed in one of our forums (https://wl.widelands.org/forum/topic/1818/).

I attach a Lua script for this win condition. It behaves as follows:
- Artifacts (immovables) have to be set on the map by the map maker in the editor.
- The player on whose territory the artifact stands owns it.
- Once all artifacts are found, the game is over. The team who owns the most artifacts wins (this can be changed to players, if desired).
- There is no information how much artifacts are on the map (like on a real treasure hunt).

Things that need to be done:
- See NOCOMS in the script.
- We need a nice image (or several ones) added to the editor. Currently, a placeholder (ruin of sentry) is used. Due to my limited artistic skill, I cannot do that myself.
- Add new maps/change existing maps to contain the new immovable.
- Optional: Add a tag to maps that can be used witih this win condition for easy filtering.

Testing:
- Place this file in scripting/win_conditions. Add its name to the init.lua there.
- I've tested it in r7562 and no crash, but I give no guarantee that I tried all edge cases.

Tags: lua

Related branches

Revision history for this message
wl-zocker (wl-zocker) wrote :
wl-zocker (wl-zocker)
description: updated
Revision history for this message
kaputtnik (franku) wrote :

> - We need a nice image (or several ones) added to the editor.

I think about a obelisk (little, broken) or plate(s) with engravings like a meander? Maybe a few different stone tablets is the best. I think from November on i find some time to make such things :-)

Revision history for this message
wl-zocker (wl-zocker) wrote :

That would be great. You are absolutely free to make the graphics you want (to be honest, I had no clear picture in mind when I wrote the code). Stone tablets (standing, lying, broken) sounds good to me.

Just keep the following in mind:
- The objects are immovable (so big that they cannot be carried away).
- They must be of small or medium size. (This can be changed, but would make the code more complicated)
- They must be recognizable as artifact instantly, and be different enough from non-artifacts. When you have a first draft, we should check this.

Revision history for this message
SirVer (sirver) wrote :

My 2c here: since this requires the map to be supportive of this win condition, it should be much rather be a multiplayer scenario (IMHO).

Otherwise it will be very confusing: most maps will not be designed with this win condition in mind and most players will not understand how it works for this very reason. Also, maps that are fun with this win condition will probably need to be specifically designed for it anyways - just slapping random artifacts on existing maps will probably not be as much fun.

I really like the idea of this, but I think it should be a multiplayer scenario, not a win condition.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Regarding your translation question, just make ", " translatable and add a comment. We have some ready-made code in C++ for translating lists, but not in Lua.

Revision history for this message
kaputtnik (franku) wrote :

I've made a first attempt on an artefact. See attached zip. It contains also the corresponding init.lua. Just extract the contained folder to /world/immovables/manmade/

I tested the image against different terrains to verify that it is visible to all terrains.

Revision history for this message
wl-zocker (wl-zocker) wrote :

#6: I think that is a good starting point. I like that the plate is inclined. What disturbs me is that the circle does not fit - the left and right borders are too vertical. I do not know if that is because you're limited by the pixels. A less symmetric symbol (a rune) could solve this.
I cannot test it in contrast to a real world because my editor is broken. Does yours still work (with the artifact)?

And we should agree on whether we call it "artefact" or "artifact". The version with i seems to be the American one, which we should use in Widelands (because other terms are also American).

#4: This problem came to my mind rather late, that's why I've added the idea with the tag to the to-do list (I do not know whether that is worth the work).
I can imagine three ways to place the immovables on existing maps: In locations that players normally do not reach (e.g. islands) (to enforce exploration), in areas where two or more players fight (two enforce defending this position as a team), only one artifact in the centre of the map (so we get a race). I could not have a look at the maps (my editor complains about having the wrong version, no idea why).
Having a win condition rather than a scenario has the advantage that the players can choose their tribe and the starting conditions. Converting the win condition script to a scenario script should be fairly easy, though.

But we do need maps with this scenario mode, otherwise, it will be forgotten. But I have not the time to create a MP scenario map from scratch.

Revision history for this message
SirVer (sirver) wrote :

> Having a win condition rather than a scenario has the advantage that the players can choose their tribe and the starting conditions.

that is a good argument, but really just a bug in the multiplayer scenario logic - it should be possible to allow it there too. I opened bug 1509188 for that.

> But we do need maps with this scenario mode, otherwise, it will be forgotten.

right, that is the crux here I think. We seem to agree that this is better suited for one or more multiplayer scenarios. Can we not find somebody on the forum that makes a cool map for this?

Revision history for this message
kaputtnik (franku) wrote :
Revision history for this message
kaputtnik (franku) wrote :

> I cannot test it in contrast to a real world because my editor is broken. Does yours still work (with the artifact)?

Yes, the editor works fine for me. Attached is a screenshot which shows the sign against different terrains. While playing a test yesterday i noticed a bug (see second attachment):

The message says there is no artifact on this map, although there are two artifacts placed: One in the forest and one near the stones. May this is because the artifacts are already mine?

artefact vs artifact: I changed all to artifact. In result i could not play my map from yesterday to make some more tests and will create a new map (may this become a cool map ;) )

Has the ai to be modified to play against the ai with this win condition?

Revision history for this message
wl-zocker (wl-zocker) wrote :

> The message says there is no artifact on this map, although there are two artifacts placed: One in the forest and one near the stones. May this is because the artifacts are already mine?

Stupid question: Did you change the line in artifacts.lua to check for your artifact's name ("artifact00" or something) instead of the bar-ruin00? I tested it in different situation and it worked, the script is quite simple.

I still hadn't time to fix my editor, hopefully soon.

> Has the ai to be modified to play against the ai with this win condition?

As far as I know, the AI has no idea of the win condition (it fells all trees in wood gnome). It would be cool, however, if the AI adapts (at least a bit) to the win conditions.

Revision history for this message
kaputtnik (franku) wrote :

> Stupid question: Did you change the line in artifacts.lua to check for your artifact's name ("artifact00" or something) instead of the bar-ruin00?

Yes i changed this too. Today i couldn't trigger this message, so may yesterday i've made a mistake :-)

Revision history for this message
kaputtnik (franku) wrote :

I linked a branch which contains four images for the artifacts (see also attached image). The branch contains also a modified /scripting/win_conditions/artifacts.lua which is enhanced to take care of more than one artifact. Please take a look at this changes :-)

A test game was a success.

I want to cleanup /world/init.lua and put all "includes" from this file to a new file in each subfolder. F.e. all beneath line 192 (critter related stuff) would then be placed in world/critters/init.lua. All includes for immovable would be placed in there appropriate folders. Could i make this clean up in the linked branch "artifacts" or should i make a new branch?

Revision history for this message
GunChleoc (gunchleoc) wrote :

I would leave the includes where they are - I have kept the same model for the tribes, that all the init.lua files are loaded in the main init.lua. IMO it's more convenient to have them all in the same place.

If you wish to split something off there to make the file smaller, I think the editor categories are a better candidate.

Revision history for this message
wl-zocker (wl-zocker) wrote :

I have modified artifacts.lua a bit. It needs no changing if new artifacts are added.
I have also moved Artifacts in the win condition list. Since it is rather peaceful, I think it should go before the other win conditions.

Before we merge this branch, we need either many maps supported (we could use the hint section of the maps) or we make it as a scenario. I'm going to check the maps, but not now.

GunChleoc: Can you have a quick look at the nocom in world/init.lua. I don't like the period because it is inconsistent.

Revision history for this message
GunChleoc (gunchleoc) wrote :

The problem here is that the tooltips get some rt/p/font wrapped around them in C++. Try. <br> for the line break.

BTW I don't think that we need the translators comment here - artifacts/artefacts is a specific English language problem. If we make this a glossary entry after it is merged, Transifex will mark it up as well.

Revision history for this message
kaputtnik (franku) wrote :

OK i leave the file as it is :-)
In general i would like to have a kind of filter for the immovable menu: Depending on the map some of the contents shouldn't be visible. Such a filter could bring the possibility to have some surprising immovable while playing (namely such immovable which aren't visible while creating a normal map with the editor). But this is maybe a task if we split the editor from the game.

> I have modified artifacts.lua a bit. It needs no changing if new artifacts are added.

Cool, thanks. Maybe it would be a good idea to have a message if the player has uncovered (found) an artifact. Otherwise on big maps where the player enlarge his territory in different directions he may oversee some of the artifacts. Having such a message would give some response.
Also: Should a player know how many (at all, or/and uncovered) artifacts are in this map? If not he would not know if he should conquer an enemy to gather artifacts which the enemy has found to have a chance to win the game.

Revision history for this message
wl-zocker (wl-zocker) wrote :

#16: Thanks, a simple <br> did the trick. I forgot about the glossary - I've removed the translators comment.

#17:
Immovables not visible in the editor: You could either try to use a non-existing editor category for the immovable (I do not know whether reloading a map where the immovable has changed its category works) or try to call new_immovable_type from inside a script for a map, thus defining and placing it at runtime.

Messages: I could inform the player when he/his team found a new artifact. I do not know whether the player should know about other artifacts. I like the idea of not knowing everything.
Imagine the following situation: The player has two, the enemy four artifacts. The player sees the last artifact that noone belongs. He will not conquer it before he has not stolen one artifact from the enemy. In the meantime, the enemy (who had actually won if the player wasn't omniscient) searches the whole map like a maniac.

Revision history for this message
kaputtnik (franku) wrote :

> Messages: I could inform the player when he/his team found a new artifact.
That would be great :-)

> I do not know whether the player should know about other artifacts. I like the idea of not knowing everything.
I don't know also ... it was just a thought.

Having a message "You found an artifact!!" seems a bit less information to me :-D We will see if we have played some test maps.

Revision history for this message
kaputtnik (franku) wrote :

Just a testmap...

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have added some changes; see my commit to the branch.

Since we can now filter the win conditions for map tags, we can now keep this as a win condition rather than turning it into a scenario. Maybe adding some artifacts to a few official maps will do the trick to make this fully available.

Revision history for this message
wl-zocker (wl-zocker) wrote :

Thanks for your help, GunChleoc.

I added some code. The player is now informed when his team finds/loses artifacts. There is no message if the artifacts stays in the team of if the player's team is not involved. The message itself isn't really pretty yet, feel free to change it.

Revision history for this message
kaputtnik (franku) wrote :

If i have conquered an artifact which the enemy has before the message says "New Artifact". What about "Artifact conquered" or so?

See: http://bazaar.launchpad.net/~widelands-dev/widelands/artifacts/view/head:/scripting/win_conditions/artifacts.lua#L69

The changes from GunChleoc works quite good. Is the check for artifacts on the map still needed in the conf for the win condition?
See around: http://bazaar.launchpad.net/~widelands-dev/widelands/artifacts/view/head:/scripting/win_conditions/artifacts.lua#L54

Nice workflow. Thanks to all :-)

Revision history for this message
wl-zocker (wl-zocker) wrote :

I can change the text, no problem. (Or you can. To cite #22: "feel free to change it.")

I would leave the check for artifacts in the script - just to be safe. I have no idea what happens if the tagging system does not work and the player loads an incompatible map (I think all will have won immediately). It doesn't cost much either.

Revision history for this message
GunChleoc (gunchleoc) wrote :

What #24 said. The check isn't really needed now, but we should keep it there as a safeguard - if the player sees it, it is a bug. Maybe add "Please report this as a bug" to the message?

Revision history for this message
kaputtnik (franku) wrote :

While working on artifacts which look a bit different (always the same plate with different signs is boring) i got an idea of making this win condition as a part of a campaign or so. The idea is to have an artifact which is broken into several pieces and the pieces are scattered all over the map. The task is to find the pieces and join them to see the whole artifact.

This broken artifact could be a kind of map or something mysterious. I attached an example animation for such a broken plate :-)

Revision history for this message
wl-zocker (wl-zocker) wrote :

I think it would be nice to have artifacts that look different.

But two things I do not like about your idea:
- Having such pieces of an artifact would mean that we need to have the same number of artifacts on every map (six with your current sketch). This would take away much freedom from the map makers.
- Making a single sceanrio with a good story takes a lot of time (we're still waiting for atl02 for years now). So I think such a campaign will not come out before 2020 ;) If someone wants to make a campaign, he is free to use the existing artifacts (whatever they are going to look like). He can still claim that they join together to a map or whatever.

I still hope to find some time where I can place artifacts on existing maps, but I'm very busy.

Revision history for this message
kaputtnik (franku) wrote :

I assumed making a campaign is much work.

> - Having such pieces of an artifact would mean that we need to have the same number of artifacts on every map (six with your current sketch). This would take away much freedom from the map makers.

I meant to have this broken artifact only in part (one map) of a campaign. I assume every part of a campaign uses his own special map. I imagined that all pieces of the artifact, joined together, gives a hint for the next part of the campaign. F.e. if all pieces where found one protagonist would say:

"We have found all pieces of the artifact and joined them together. Now we could decipher the signs on it! The artifact says we have to go for 5 Moons along the river and we will find productive land and mountains full of ore."

Or something like that ... ( i am not a great storyteller :-D )

Another idea for this win condition would be to have a popup when a broken off piece of the artifact is found , like in campaigns when a protagonist says something. The popup should then be capable to display the already found pieces. Is this possible? IMHO it would give a bit depth/thrill to the win condition because the player may wants to know how the whole artifact would look like. Accordingly i have to modify the artifact images. But yes, if the artifact is found and the player knows how it looks like the depth/thrill is gone. So this is a bad idea ...

About atlantean scenario: Is there a general storyboard? Or is it more like "creating one part and for the next part we will see"?

Revision history for this message
wl-zocker (wl-zocker) wrote :

I think I misunderstood you, I thought you wanted to replace the artifacts with new images.
If you want to add other ones, you may do this, of course.
My priority (when I find some time to work on Widelands) is to add artifact to maps, and get the branch with the win condition merged.

Having pop-up windows when an artifact is found can easily be made. Lua scripting is a powerful tool which lets you do a lot of things. However, this only makes sense in a scenario and not in a win condition because we would have the same text for all maps.

Atlantean campaign: I think SirVer has a general idea what it shall look like. See bug 673736 and https://code.launchpad.net/~widelands-dev/widelands/scenarios. He would be very glad if someone took the task, I think.

Revision history for this message
wl-zocker (wl-zocker) wrote :

I finally had some time to add artifacts to 30 of 47 maps (I did not find good spots on the remaining maps). I have not tested the maps to see whether they are fair (nor if they all still load), but I hope that is the case.

Three maps (Desert Tournament, Swamp Monks, Together We're strong) didn't load, I had to remove the player directory. The editor has added more files, so I hope everything is fine.
I have renamed some map directories (now the directory name matches the map name) with bzr mv.

I wrote a print statement in artifact.lua which shows the artifacts' positions when starting a new game - so it's easier when you test.
I also changed the message shown when there are no artifacts.

From my side, the branch is ready. One question: Can we rename the "Artifact 1" etc. to a simple "Artifact"? The translators would have less work and the number does not serve a real purpose.

Revision history for this message
kaputtnik (franku) wrote :

Great :-)

Renaming the "descname" is possible as i know. The value for "name" must be unique because its the name which is internally used by the game.

I want to change some of the images to make them look more different before we merge this. Today i will hopefully find some time to do so.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes, name needs to be unique, descname can be anything. We have numbers with the stones/rocks, because they come in different sizes. We won't need numbers for the artifacts.

#30: Resaving the map should fix any removed packages, so no worries - should be fine :)

Revision history for this message
kaputtnik (franku) wrote :

The artifact images are changed and the names also.

On thing: critters could walk on this immovables (see attached image) Is there something to prevent this?

Revision history for this message
GunChleoc (gunchleoc) wrote :

#33 Without looking at the code again, I think that depends on size, so you would have to make the artifact a medium size immovable.

Revision history for this message
kaputtnik (franku) wrote :

In comparison with some other immovables with size from big to small the critter do walk on both small and medium size immovables (f.e on the burned down medium ruin). So its a common behavior.

Not related to this bug but there is a little image to correct which doesn't need an own bugreport. Its related to the "set origin" bug. See https://bugs.launchpad.net/widelands/+bug/1402786/comments/7 Shall i change the image in the artifacts branch?

Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes, just drop it in there and link the other bug report to the branch.

I guess we will just have to love with the critters walking across the artifacts for now.

Revision history for this message
wl-zocker (wl-zocker) wrote :

Has it always been like that or is that a regression? Animals walking over ruins seems strange - I cannot remember having seen that.

Revision history for this message
kaputtnik (franku) wrote :

In build 18 critters do walk also on ruins.

GunChleoc (gunchleoc)
Changed in widelands:
status: New → Fix Committed
milestone: none → build19-rc1
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.