Travelling Tradesmen - a trading scenario with advanced AI

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

Moderator: Forum Moderators

User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

Hey there, guys and gals.

I present you with an 8-people scenario where the winner is the first player to earn a specific sum of money and protects it from thieving attempts till the start of his next turn. Killed trader loses 20% of his money in favour of the attacker and respawns in the central city with low hitpoints and remains petrified until his next turn to prevent an easy kill. Attacks unleashed from a city hex are punished however by 1-turn prison once the attack ends.

Image Image Image

How do you earn money:
Enter any village, buy a weapon there and carry it to another village where the price is higher.
Initially you can carry up to 3 weapons in addition to using your default attack in a fight. If you level up to L2 or L3, you may buy L2 or L3 weapons respectively, that are more expensive and more powerful.
Each controlled village earns you 1 gold per turn.
Fixed market map: There are 8 villages that offer a specific weapon type at the lowest price. The farther from such a village you sell that particular weapon, the more money you earn by selling it.
Fluctuating market map: Villages have randomly generated stock for each weapon type (0 to 5 pieces). They also have one random weapon type on production there. Plan your routes so that you can buy cheap where the stock is high and sell expensive where the stock is low. Once in 10 turns every village produces its weapon type (maxes its stock to 5 pieces). All the other types drop in count by 1 piece.


General store:
* Lantern (100 gold). Illuminates. Useful since your leader is neutral and most of the enemies chaotic.
* Knapsack (50 gold). Allows to carry a total of 4 weapons.
* Horse (300 gold). 9 movement points, can carry up to 6 weapons in total.
* Flying machine (300 gold). 10 movement points, can carry up to 5 weapons in total.

Knapsacks, horses and flying machines cannot be combined. Lantern can be combined with any of these.


Potion store:
* Healing potion (10, 20 or 30 gold for L1, L2 or L3 trader respectively). Full heal, removes poison.
* Endurance potion (150 gold). Raises your max HP by 10.


Thieves' den:
* Hire ruffians, thugs, bandits (10, 25, 100 gold respectively). Two criminals of your choice spawn next to a trader of your choice. They encircle him if possible.
* Deposit money (1% of the sum). Store any sum here to prevent money loss because of death.


AI traders:
Those guys are pretty smart. They know how to trade weapons, being able to pursue multiple profit destinations at the same time.
They know how to heal themselves at the Potion shop.
They can shop at the General store for backpacks, horsies, flying machines. Ability to purchase lanterns under consideration.

To play against AI traders, first set them normally as computer-controlled when you create a session.
IMPORTANT: So far you can play against AI on the map with fixed market only.
For network sessions with AI to work properly, you MUST set the AI players in the initial dialogue. Any AI trader has to be marked as AI there, otherwise he won't know what to do. If ever any side changes its ownership from a human controller to AI or vice versa, the player whose turn it is MUST access the floating menu via RMB and change the human/AI mark for the side.


Wilderness:
There are monsters in the wilderness that respawn the more frequently the more players are present. Initially they are L0, around turn 50 they power up to L1, around turn 100 they reach the final L2.
L1 and L2 monsters have a cap of 3 units per sector.
Corner bosses guard 400 gold each.


Comments or feature proposals are welcome. :wink:
Last edited by Kvinkunx on July 23rd, 2010, 3:33 pm, edited 5 times in total.
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

Fixed bugs:

* Weapons in the backpack had wrong text in a weapon shop if sold and some other were bought in the same shopping session.
* Lantern and knapsack were sometimes incompatible.
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

Fixed bugs:

* Many script parts worked wrong when there were empty player slots between player sides (running status, AI scripts taking over players at shops).
* Made AI traders less aggressive.

Changes:

* AI traders can now shop in the general store for knapsacks, horsies, flying machines.
* Replaced L0 muddies with peasants, L1 muddies with augurs. Muddies were too little a threat.
* Placed more terrain obstacles close to the center.

To do:

* AI traders still tend to die too often. Perhaps I should make them even less aggressive.
* Make the AI trader decision to shop at the general store more effective.
* Droiding a formerly human-controlled side still doesn't result in proper AI behaviour.

AI traders should be stable now. Report any errors please.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2176
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Ken_Oh »

I was intrigued by the concept of this add-on so I gave it a try.

It's neat, but there are some major problems with it. I'm surprised that you found Mudcrawlers as too little of a threat, because it seems to me that most everything is too huge of a threat. I've spent most of my turns getting gang-raped by the hordes, as do the AI players. I've reached a location for trading and then gotten instantly killed on the enemy turn.

The AI is pretty smart, so I have to congratulate you on that. The main problem for the AI now, it seems, is that it continually just attacks other players in the city. This leads to a continuous jailing cycle, especially with 7 AI.

And, maybe there shouldn't be jail for attacking monsters. How about if it's only for attacking other players?

The message dialogs are annoying. Maybe it wouldn't be so bad if the AI wasn't always jailing and killing each other, but as it is I'm clearing at least 6 messages before I get back to my turn. I think you should employ what we have in Wesband, a [chat] tag set in Lua (see Wesband/lua/Utils.lua if you want to see an example).

I would have started small, with 4 players and then expanded on the idea once you got it working well. 8 players is a mess, for a lot of reasons.

I think you should slow the enemies by 1 or 2 movement points when you spawn them, to make them more manageable.

I also think the AI shouldn't be able to walk on towns or castle walls. It's bad enough that you get hammered in all directions by enemies, but if you don't even get a chance to trade, it's hopeless. Take a look at this: http://dl.dropbox.com/u/776904/wesnoth/ ... slings.JPG Looks like I'm not getting cheap slings.

Along with that, it seems like there should be a max number of units from a spawn point available on the screen at once.

Does the number of enemies scale to the number of sides playing? If not, I would do something like that.

Anyway, great concept. I like the way that death isn't a huge deal, as there's no way to prevent cheap deaths in a game like this. I just think the game needs a lot of tweaking and it'll be really good.
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

Thank you for your in-depth opinion!

It seems that so far I was unnecessarily obsessed with the idea that even in short sessions the traders should reach L2.
I have removed one starting creep in each sector and made their respawn less frequent. The respawn frequency does reflect the number of players. I think changes to frequency do the job without a need to put a cap on unit count in each sector. Easy to change if I'm proven wrong.

AI traders do not heap up in the city anymore. It seems that the right aggressivity for them is -0.5. They still like to land an effective blow but usually leave the city at once. Despite this fix I understand that all the jail messages may be annoying. I'm not familiar with lua so I can only guess what your piece of code does? I have simply set the jail message to be displayed to the assailant only. No more spamfest and hopefully it is intuitive enough when you see a trader visually put behind bars if you play the mod for the first time.

Creeps now cannot move next to the city so that should do for the "unfair" imprisonment when a trader in the city attacks a creep. In the next version will also fix the case of thugs summoned in the city.

Creeps had traits, which was not really useful. Removed. I agree that it is now better when they have strictly 5 MP. Lessening their numbers and respawn frequency also opened another question: the scenario perhaps needs faster movement over distances. Gave traders 7 MP, Horsies 9 MP, Flying machines 10 MP.
Reduced number of pockets: Flying machine 5, Horse 6.

Number of players doesn't seem like a trouble to me so far. Now that the AI traders are less aggressive and don't spam you with jail messages at least. You can switch off any you don't want to play with. The map has a specific structure based on 8 weapon cathegories so I had to plan this since the beginning. I might reduce the number of players to maybe six and use the two freed sides to stuff like NPC allies for hire. Don't know yet, would require to redesign the map probably.

I'm thinking allowing 1 trader to become a Sheriff, changes to lawful, able to hire spearmen but penalized for any trader deaths.
The opposite would be a Don, changes to chaotic, has a discount in thieves' dens and possibly other advantages and disadvantages.
Once I complete this part of the concept, I would know whether to reduce the number of players and what to do with the map.
KiraLexi
Posts: 1
Joined: June 27th, 2010, 1:02 am

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by KiraLexi »

Having played a lot of this mod and talked about it some with Kvinkunx, here are my suggestions:
  • Market fluctuations based on supply and demand. This might be hard, but it would be very cool.
  • The sheriff/don idea sounds great.
  • Weapon upgrade shop, where players can buy poison, drain, etc for their weaponry.
I'll let you know if I remember or come up with anything else.
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

Thanks for your ideas, mate.

It will require some amount of time but I am interested in doing so.
I already have an idea how the market should fluctuate. Let's see once I implement it.
Changing prices will require some sort of indication of stock I think.

Not sure yet whether I will allow to modify any weapon or just the basic "fists" attack. Perhaps the latter one since it is easier to control, so eg. you could buy a poisoned dagger at the Thieves' Den which will replace your "fists".
Since the core idea of the mod is to trade weapons, you would hardly want to purchase a weapon, then eg. brand it with poison at the Thieves' Den and then sell it once you reach your destination. I think.
Hirgwath
Posts: 2
Joined: March 28th, 2009, 12:03 am

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Hirgwath »

on supply and demand: I think all that has been discussed is lessening demand in an area when a merchant goes and sells a certain weapon there. This would lead to practically everything decreasing in value over time unless demand for that weapon correspondingly increased in the place where the merchant originally bought it.

This would eventually create an equilibrium across the map, which is a bit boring. As a way around this, I suggest random natural disasters. Natural disasters, like mudslides for caves, wildfires for forests, sand storms for desert, blizzards for northwest, etc. could be used to A. change the terrain of an area for a period of turns, like in the Dark Forecast survival scenario and B. increase *all* demand in the area, because in principle the disaster would damage a lot of goods. After the disaster had ended, terrain could return to normal, and weapon prices could return to their *original* values from the beginning of the game. This would add variety in terrain and prices and a whole new element to the game.

I also think this would add the theme of player-merchants swooping down into disaster areas trying to sell their goods at extortionary prices, which I think would be funny in a cynical way for the players. :)

I hope this is doable, and I know that terrain changes are from playing Dark Forecast, so...

Good luck with this great add-on.
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

Hey mate, thanks!

I actually got multiple options in regards to stock and its replenishment. I can take into account just purchases, take into account just sales, or both: in order to create a living environment of changing stock.

I will go for the last one. Still thinking about preserving the old map for conservative players and to create a separate script under the same map for the fluctuation fans. Anyway, I like better the new approach for the sake of replayability. Still not decided upon the initial distribution of stock; should it be even for starting locations or totally random? Random often makes a fun point in Wesnoth as well as an element of frustration. With the introduction of the new system it won't be required to travel the map fully across to make a good deal though.

Equilibrium: this will be done via fluctuation NOT affected by trader sides. I plan to implement a mechanism that over time produces a specific kind of weapons at some shops, leaves intact most of the other and reduces the remaining ones. Or perhaps to produce one type and reduce all the other types over time. Gonna be subject to tests.
This has to work first prior to introducing any special events which do major changes to stock like you suggest; and I really fancy the idea once the basic functions are implemented. :wink:

Terrain changes: Yes, they are easily done.
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

Sheriff/Don changes are delayed until the new stock-related changes are implemented.
YbeRn00b
Posts: 144
Joined: April 3rd, 2006, 8:56 pm

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by YbeRn00b »

I would just say great work!
I like this mod a lot.
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Kvinkunx »

My pleasure, mate!

Enough of a reason for me to keep the old variant with fixed prices as well as to implement the new one.
Velensk
Multiplayer Contributor
Posts: 3991
Joined: January 24th, 2007, 12:56 am

Re: Travelling Tradesmen - a trading scenario with advanced AI

Post by Velensk »

I was rather impressed by this scenario however the AI seems incapable of completing a long/very long game because it is far too fond of fighting and does not know how to bank it's earnings. Even after every AI was a typhoon none of them ever rose above 1500 cash at any time.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced

Post by Kvinkunx »

Thank you, mate!

A valuable remark.

I might implement AI banking sometime later. For the time being though, the AI should play safer than before to make it over 1500 gold. I have simply decided to order L3 AI traders to ignore creeps since they don't need to lvl up anymore. L1's and L2's are more cautious now too.

I have also reconsidered again the overall wilderness danger level and decided to make the creeps even less numerous.
Went for the unit cap per sector too as Ken_Oh initially suggested.


1.3.0 is out!

Changes:
* At the beginning there is only one creep per sector
* Creeps respawn twice less often
* L1 and L2 creeps have a cap of 3 units of the respective type per sector
* Thug creep line replaced by Elvish Shaman line (unit cap reason: central Ruffians are able to lvl up to Thugs and would mess Thug count)
* Creeps now power up to L1 after turn 50, to L2 after turn 100 (exact turn number depends on respawn rate, which depends on number of traders)
* Fixed bug with the message about powered up creeps shown at different turn than at the one they first appear
* AI traders are less aggressive now
* AI traders stop hunting creeps and focus just on trade and upgrades at L3
* Fixed bug with AI repeatedly buying upgrades they already have
* L1 trader trousers now reflect side colour
User avatar
Kvinkunx
Posts: 69
Joined: March 20th, 2007, 7:00 pm
Location: Prague, Czech Republic
Contact:

Re: Travelling Tradesmen - a trading scenario with advanced

Post by Kvinkunx »

Recent tests reveal that 1.3.0 offers too little a threat to skilled players, at least when it comes to L0 creeps.

Anyone has played the latest version?
Post Reply