[engine] ruined village suggestion

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

[engine] ruined village suggestion

Post by Spannerbag »

Hi,
just a thought; would it be easy to amend game_config to differentiate between regular and ruined villages?

Regular villages, as now, provide defense, healing, support and income.
Ruined villages offer only shelter (defense and healing) without the economic benefits.

I'm impementing this in my UMC using

Code: Select all

[side]
...
    village_income=0		# No income from ruined villages
    village_support=0		# No support from ruined villages
...
However it would be even better if I could mix and match regular and ruined villages without having to resort to custom terrain/village overlays and/or code.
That way parts of the map could provide owners with an income and other areas do not (or less so) which adds (hopefully) to player enjoyment.

I understand that many will be saying "That's what income is for" but this change impacts gameplay as a response to player actions, not predetermined amounts of gold injected into the scenario each turn.

Maybe the existing code could apply just to regular villages and then extra keys added for ruined villages?

Just a thought.
Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: [engine] ruined village suggestion

Post by octalot »

The existing Oasis terrain gives the healing without economic benefit.

Making it look like a ruined village would need a custom terrain type, but the code to make a terrain heal is just to add heals=8 to the [terrain_type] tag.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2359
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [engine] ruined village suggestion

Post by Lord-Knightmare »

just a thought; would it be easy to amend game_config to differentiate between regular and ruined villages?
Given several mainline campaigns and countless UMC treat ruined and regular villages as the same thing, such a suggestion is rather questionable. As in, most would say now, given the massive amount of adjustment work needed.

For your own works, you can just do what octalot suggested: making a custom village overlay terrain type and setting gives_income=false/no. Also, it's rather appropriate to add some note to clarify to the player that ruined villages function differently than normal conditions in this scenario/campaign.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [engine] ruined village suggestion

Post by Spannerbag »

Thanks for the feedback.
I kinda thought there'd be too much legacy stuff to deal with - but I thought it worth asking.
If I need to mix and match standard and "no income" I'll use custom terrain.
Cheers,
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
shevegen
Posts: 497
Joined: June 3rd, 2004, 4:35 pm

Re: [engine] ruined village suggestion

Post by shevegen »

There are some campaigns with ruined villages or something. But usually the villages
are just destroyed completely in these campaigns.

Would be interesting if we could have some general mechanic where villages can be
damaged, then perhaps not supply food, but can be repaired if a unit occupies it for,
say, 3 turns or something.
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [engine] ruined village suggestion

Post by Spannerbag »

shevegen wrote: February 21st, 2023, 6:02 pm There are some campaigns with ruined villages or something. But usually the villages
are just destroyed completely in these campaigns.

Would be interesting if we could have some general mechanic where villages can be
damaged, then perhaps not supply food, but can be repaired if a unit occupies it for,
say, 3 turns or something.
Well, creating custom terrain was easy enough; in my case I just re-purposed the existing ruined human city terrain.

description= _ "Ruined villages provide shelter (defense and healing) but no economic benefits (no income or support)."

Tbh it's not an absolute must-have in this particular scenario (but then this campaign grew out of various experiments and muckabouts, producing a very silly but, imho, quite entertaining and slightly unusual mix of stuff).

Given the legacy issues mentioned above I think this will have to be done as additional UMC logic rather than being integrated into the game proper.
That said, I agree with your sentiments; I feel that ruined villages should not confer the same benefits as "healthy" ones.
I also think that for consistency and easier map logic in some cases, the burned villages in scenery should also be terrain and not items.
However I can do everything I want to do with the current setup, it's just a bit fiddly at times (like when extending the map when some villages have been burned down in-game as happens in scenario 8 of my current campaign).

I have a couple of issues with custom terrain (probably just my dodgy coding! :)) but these are:
  • Logfile complaints, e.g. error config: Error while loading the map: Unknown tile in map: (Wwf^ZRfe) 'Wwf^ZRfe' but everything in-game works absolutely fine?
  • Problems with terrain masks when combined with custom terrain (hit this in another campaign I'm halfway through writing, I have used terrain masks previously with no problems) so as an ugly hack I replace the entire map instead...
Also, too many custom terrains in various campaigns risks path/name conflicts, despite the namespace separation (at least in my experience).
But as I say, it's probably just lousy logic...

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [engine] ruined village suggestion

Post by beetlenaut »

Spannerbag wrote: February 22nd, 2023, 3:37 pm Error while loading the map: Unknown tile in map:
I wouldn't count on this scenario continuing to load on all systems. That error is usually fatal in my experience. If you didn't create the ZRfe terrain overlay, why don't you just remove it from the map? You can use a text editor to find it if it's not showing up in BfW.

If ZRfe is yours, did you perhaps put the terrain definition inside an #ifdef EDITOR section and nowhere else? Or, are you loading your scenarios (and therefore maps) before you load your terrain definitions? I've seen people do both before.
shevegen wrote: February 21st, 2023, 6:02 pm Would be interesting if we could have some general mechanic where villages can be
damaged, then perhaps not supply food, but can be repaired if a unit occupies it for,
say, 3 turns or something.
In case it's not clear from this discussion, this can already be done anytime someone wants to code it.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [engine] ruined village suggestion

Post by Spannerbag »

beetlenaut wrote: February 22nd, 2023, 11:06 pm I wouldn't count on this scenario continuing to load on all systems. That error is usually fatal in my experience. If you didn't create the ZRfe terrain overlay, why don't you just remove it from the map? You can use a text editor to find it if it's not showing up in BfW.

If ZRfe is yours, did you perhaps put the terrain definition inside an #ifdef EDITOR section and nowhere else? Or, are you loading your scenarios (and therefore maps) before you load your terrain definitions? I've seen people do both before.
Thanks for replying, yep the terrain is mine.
Here's the relevant snippet (the whole _main.cfg is huge as it contains loads of global stuff).
I've removed the [+units]...[/units] content as that's also irrelevant.
Terrain stuff lives in {./utils}. Hope this all checks out. If you need more info please let me know.

Code: Select all

[/campaign]


#
# Uh-oh ... someone's decided to play this pile of junk ...
#
#ifdef RTC47

# Namespace (for persistent variables)
#define RTC47-NS
RTC47#enddef

[binary_path]
    path=data/add-ons/Road_to_Carcyn
[/binary_path]

{./utils}		# Load campaign specific macros

[+units]
  [race]
... removed ...
[/units]

{./scenarios}		# Load scenario files
#endif


#ifdef EDITOR
[binary_path]
    path=data/add-ons/Road_to_Carcyn
[/binary_path]
[editor_group]
    id=RtC47
    name= _ "Road to Carycn"
    icon="group_custom"
[/editor_group]
{./utils/terrain-type.cfg}
{./utils/terrain-graphics.cfg}
#endif
It's really weird because both the game and editor work fine but that error persists, it's been there so long I'd kinda started to ignore it...

That terrain also used to be in my test campaign but no more. To be honest I'll have to remind myself how and when the error occurs, not sure all my custom terrain is complained about - must check - but I really haven't looked at this for ages as it never caused me any great problems.

Will investigate how/when the error arises soon.

Thanks for your help, much appreciated!

Cheers,
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [engine] ruined village suggestion

Post by beetlenaut »

I find it interesting that this mostly works, because the path format isn't correct. It should be {~add-ons/Road_to_Carcyn/utils} and {~add-ons/Road_to_Carcyn/scenarios}. Same thing for the terrain files in the ifdef EDITOR section. I bet fixing this would fix both terrain issues.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
gnombat
Posts: 706
Joined: June 10th, 2010, 8:49 pm

Re: [engine] ruined village suggestion

Post by gnombat »

For what it's worth, I see several other add-ons are using things like {./utils} and {./scenarios}. (example)
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [engine] ruined village suggestion

Post by Spannerbag »

beetlenaut wrote: February 23rd, 2023, 5:34 am I find it interesting that this mostly works, because the path format isn't correct. It should be {~add-ons/Road_to_Carcyn/utils} and {~add-ons/Road_to_Carcyn/scenarios}. Same thing for the terrain files in the ifdef EDITOR section. I bet fixing this would fix both terrain issues.
Thanks for that, I've not looked at this code chunk for ages and it was copied from the old AfterEI _main.cfg.
I've made the changes and fired up the campaign but since no custom terrain is referenced early on I'll have to go through the early scenarios again.
(Not a bad idea since I've made some fundamental changes elsewhere anyway... again :roll:).

That said, I did fire up the campaign from start and checked the logs after scenario 1 turn 1 was loaded and it seemed OK except for the frequent sRGB profile complaint at the end of the log:

Code: Select all

...
warning config: add-on 'Road_to_Carcyn' has no _info.cfg; cannot read version info
warning config: add-on 'stub16' has no _info.cfg; cannot read version info
Checking lua scripts... ok
libpng warning: iCCP: known incorrect sRGB profile
Stub16 is a small campaign I use for testing stuff. Oh, must change the paths there too... :doh:

New _main.cfg paths:

Code: Select all

[/campaign]


#
# Uh-oh ... someone's decided to play this pile of junk ...
#
#ifdef RTC47

# Namespace (for persistent variables)
#define RTC47-NS
RTC47#enddef

[binary_path]
    path=data/add-ons/Road_to_Carcyn
[/binary_path]

{~add-ons/Road_to_Carcyn/utils}		# Load campaign specific macros

[units]
  [race]
... removed ...
[/units]

{~add-ons/Road_to_Carcyn/scenarios}		# Load scenario files
#endif


#ifdef EDITOR
[binary_path]
    path=data/add-ons/Road_to_Carcyn
[/binary_path]
[editor_group]
    id=RtC47
    name= _ "Road to Carycn"
    icon="group_custom"
[/editor_group]
{~add-ons/Road_to_Carcyn/utils/terrain-type.cfg}
{~add-ons/Road_to_Carcyn/utils/terrain-graphics.cfg}
#endif
Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [engine] ruined village suggestion

Post by Spannerbag »

gnombat wrote: February 23rd, 2023, 10:55 am For what it's worth, I see several other add-ons are using things like {./utils} and {./scenarios}. (example)
I vaguely recall a couple of years (and several wesnoth versions) ago I had trouble getting ~add-ons/ to work reliably.
Maybe I was getting [binary_path] syntax wrong? I really don't remember the details now except that for me at least ./ path did work so stuck with that.
As you say, at the time at least, there were other campaigns also using ./ (no idea if campaigns created more recently use it or not).

Time will tell if these path syntax changes fix my terrain issue or not. First reference is in scenario 3 (but not at start, it's added via WML in an event) so will take me awhile to properly test (I tend to play through each scenario rather than skipping via debug because even now, when I play these scenarios I often spot something that needs tweaking).

At least I'm not the only one using ./ :)

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: [engine] ruined village suggestion

Post by octalot »

gnombat wrote: February 23rd, 2023, 10:55 am For what it's worth, I see several other add-ons are using things like {./utils} and {./scenarios}.
Erm, those are officially supported - {./scenarios} is used in 1.16's World Conquest, and they're both used in 1.17's Winds of Fate.
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [engine] ruined village suggestion

Post by Spannerbag »

Is it worth starting a new thread for this?

Anyway, here's an update.

Sadly changing the paths in _main.cfg made no difference, still getting terrain errors :-(

warning config: add-on 'Road_to_Carcyn' has no _info.cfg; cannot read version info
warning config: add-on 'stub16' has no _info.cfg; cannot read version info
Checking lua scripts... ok
error config: Error while loading the map: Unknown tile in map: (Hh^Yhcr) 'Hh^Yhcr'
error config: Error while loading the map: Unknown tile in map: (Wwg^ZRfe) 'Wwg^ZRfe'
error config: Error while loading the map: Unknown tile in map: (Wwg^ZRfe) 'Wwg^ZRfe'


When I launch the game the above errors are not present (unless I'm being too impatient?).

I loaded a save that was a victory (i.e. linger screen), let's call this scenario "A".
The next scenario is (wait for it) scenario "B".

The current (scenario A) map has the 'Wwg^ZRfe' terrain (one instance) so I'm puzzled as to why it appears twice (though it's also present on an earlier scenario's map).
This terrain is not handled normally; there is only ever one occurrence (tile/hex) of this terrain on the map which is added in prestart if a condition is met.
It's also added in in the next scenario (scenario B) because this condition is met.
So I duly proceeded to scenario B but on turn 1 the log hadn't recorded another 'Wwg^ZRfe' error, even though the terrain had been added to scenario B's map in-game.

'Hh^Yhcr' occurs several times in scenario B's map and is used normally; it's part of the map file and isn't mucked about with by WML.
I guess the game can see it even though that scenario has not yet been played.
As the first terrain is added via WML it might be easier to consider this 'Hh^Yhcr' terrain (which is just repurposed ruined human city terrain)?

utils/terrain-graphics.cfg

Code: Select all

# Ruined village as overlay (heals, no income)
{OVERLAY_RANDOM *^Yhcr village/human-city-ruin}
utils/terrain-type.cfg

Code: Select all

# Ruined village as overlay (heals, no income)
[terrain_type]
    symbol_image=yhcr-tile
    id=yhcr_no_income
    name= _ "Village (no income)"
    editor_name= _ "Village (no income)"
    string=^Yhcr
    aliasof=_bas, Vt
    default_base=Hh
    heals=8
    gives_income=no
    editor_group=RtC47
[/terrain_type]
_main.cfg

Code: Select all

[/campaign]


#
# Uh-oh ... someone's decided to play this pile of junk ...
#
#ifdef RTC47

# Namespace (for persistent variables)
#define RTC47-NS
RTC47#enddef

[binary_path]
    path=data/add-ons/Road_to_Carcyn
[/binary_path]

{~add-ons/Road_to_Carcyn/utils}			# Load campaign specific macros

[units]
  [race]
... deleted for brevity and clarity ...
  [/race]
  {./units}					# Append custom units to standard Wesnoth units
[/units]

{~add-ons/Road_to_Carcyn/scenarios}		# Load scenario files
#endif


#ifdef EDITOR
[binary_path]
    path=data/add-ons/Road_to_Carcyn
[/binary_path]
[editor_group]
    id=RtC47
    name= _ "Road to Carycn"
    icon="group_custom"
[/editor_group]
{~add-ons/Road_to_Carcyn/utils/terrain-type.cfg}
{~add-ons/Road_to_Carcyn/utils/terrain-graphics.cfg}
#endif
Could someone just confirm that the above all looks OK please?

And if so, any ideas about how to proceed/where to look next to track down this issue?
Like I say I've never had any problem either in-game or with the editor with this custom terrain so I'm a bit stuck as how to fix it...

Any suggestions greatly appreciated!

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
gnombat
Posts: 706
Joined: June 10th, 2010, 8:49 pm

Re: [engine] ruined village suggestion

Post by gnombat »

I think maybe the error message is spurious, or perhaps it's a bug in Wesnoth, because I can see the same error message in mainline. For example, the following save file gives me the error message Error while loading the map: Unknown tile in map: (Cyd) 'Cyd'. But it still loads OK...

UtBS-A Stirring in the Night-Auto-Save1.gz
(67.39 KiB) Downloaded 30 times
Post Reply