Strategic structure campaign

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
SFault
Posts: 483
Joined: November 10th, 2009, 2:21 pm
Location: Esbo, Finland

Strategic structure campaign

Post by SFault »

I was planning to create a campaign that is not story based but strategy based. I mean that player can choose the battles he/she wants to do next and instead of buying units player can also use the money to buy buildings that give bonus. There would be opponents that also progress during the time and the main idea is to conquer all ten counties.

The basic format is that first player does maintaining actions in free regime scenario and ends the scenario by selecting the county he/she wants to attack. Then there is battle scenario that is located in that county. Of course there will be more into it later but I could start with this.

So... I would like to hear some comments how to implement this in a way that I will have minimal amount of painful code twerking. I've seen some campaigns having some similar style. Is there some good one that I could use as base? I'm going to make it for 1.13. I would like to avoid those huge nested If statements but I'm bit afraid that there just isn't a way round it even with use of switch.

The main issue will be with the regime scenario since it will be played again and again. I was thinking that I could have first_time flag that when up will set up variables into initial state. After that the variables will be saved before launching the battle scenario. And when returning to the regime the variables are read into the scenario in the start event (or prestart). Is this good idea? Is there some super easy way to do it? I'm somewhat familiar with the [set_variables] tag. (In Elves Banding for War campaign the hero and hero's unit list & gold store are switched from time to time. Doesn't seem too clean code but it works.)

For buildings I was thinking making an array with each element having information of the building (id, built/not, name, cost, etc). Does this sound ok? The buildings will give gold bonus, new units to recruit, xp bonus (trained units) and such. The main map shall have 10 (or so) counties that either belong to the player or to opponent. I guess that would be another array for the logic.

I'm still at the design phase so any pitfalls that you guys can think of would be nice to hear in advance.
segmentation fault
EBfW, GtR, Art, Old art
User avatar
skeptical_troll
Posts: 500
Joined: August 31st, 2015, 11:06 pm

Re: Strategic structure campaign

Post by skeptical_troll »

The closer thing to what you are trying to do is 'cities of the frontier', to my knowledge. It's hard to say what's the best way of coding it before trying, I suspect.

However, my main concern on this would be the AI. Unless this is meant to be just for multiplayer, you have to make the opponents advance in some way, and Wesnoth AI will not be able to deal with anything different than recruiting/moving/attacking. Do you have a strategy for that? Will the opponents' development be pre-determined or something? I'd suggest you sort this out before spending much time on coding.
User avatar
SFault
Posts: 483
Joined: November 10th, 2009, 2:21 pm
Location: Esbo, Finland

Re: Strategic structure campaign

Post by SFault »

My idea was that after each battle scenario (or before the regime scenario) there will be turn for opponent. Basically the (story) map will be divided into ten parts (counties) and each part is controlled by player or opponent (in first version there will be only one opponent). With randomization the opponent will pass or attack player's county. If so, the player will have the defense battle instead of attacking after the regime phase. The randomization is altered by some factors (e.g. if opponent hasn't attacked in several turns the chance increases).

I'm not sure if we are at the same page here.The idea is that the regime scenario always happens in the player's home county. If home county is lost, then it's game over. In the regime player can construct buildings and do some other stuff (recruit special units, buy items, gather intelligence etc). Then he goes to have a talk with general and in the dialogue available counties for attack are presented. Player chooses one and that leads to the next scenario which will be battle against the opponent in that county. The player can also choose to skip the battle phase to increase money or wait for some building to be constructed.

But yeah. Haven't thought much of the AI yet (and I'm pretty poor in AI design). My plan was to have a passive opponent in the first version just to get the basic flow going. The opponent owns all the other 9 counties and will not attack back. Later on there will be several opponents that do battle against each other also.
segmentation fault
EBfW, GtR, Art, Old art
Post Reply