TCG Era 1.3.0

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

Moderator: Forum Moderators

Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

TCG Era 1.3.0

Post by Luther »

For those of you who think that there's not enough luck involved in Wesnoth, that the game is just too deterministic, I bring you the TCG Era, where not only is combat random, but so are the units you get! :twisted:

Current version is 1.3.0. Hopefully fixed some OOS errors.

In this era, each player starts by recruiting one Vampire Bat. After that, the recruit lists are randomized. The possibilities for recruits include all units in core and the dependency add-ons. Does not include units with no weapons.
  • In TCG Castle, your recruit list contains a number of slots for unit types equal to the recruitment capacity of the largest castle. You may recruit each unit type only once (unless the same type appears in more than one slot, in which case your list will appear to be smaller). Whenever you recruit, that unit on your recruit list gets replaced by a new random unit type. The right-click menu has a command that lets you see the internal recruit list. This is useful for seeing if you have any duplicate entries.
  • In TCG 1, you only get one slot. This maximizes randomness.
Dependencies:
  • Luther's Lua Pack
  • Era of Myths
  • RPG Creation Kit
TCG stands for trading-card game, which is what provided the inspiration for this kind of random unit selection.

This era is available on the 1.8 add-on server.

I'd like to thank those who have worked on embedding Lua in Wesnoth. I learned Lua in less than 24 hours just for the sake of writing this add-on.

Please let me know of any bugs or gameplay issues.

The add-on includes a version-by-version Changelog for those who are curious.
Last edited by Luther on October 3rd, 2010, 7:06 am, edited 26 times in total.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: TCG Era

Post by Gambit »

You need to use MP safe random functions.
http://wiki.wesnoth.org/InternalActionsWML
see [set_variable] random vs rand

I didn't look at your era so I don't know if this is the exact problem you're having or not. Just one of the things to look out for when using random numbers.
Some day you may be able to let users build and save decks. That would make it way more TCG. As it stands right now your addon isn't TCG at all. It's just random recruits.
Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

Re: TCG Era

Post by Luther »

Gambit wrote:You need to use MP safe random functions.
http://wiki.wesnoth.org/InternalActionsWML
see [set_variable] random vs rand
The problem was that I used Lua's math.random to get the random numbers. After seeing your post, I realized I could fire a set_variable tag to get the MP-safe rand. I tested it this time using two computers playing each other through the MP server.
Gambit wrote: Some day you may be able to let users build and save decks. That would make it way more TCG. As it stands right now your addon isn't TCG at all. It's just random recruits.
:hmm: Sounds like you disagree with the name. If enough people think the name is misleading, I might consider changing it. But IMO, random recruits are what TCGs are all about. Also, if someone made a campaign out of this concept, the recall list would serve well enough as a deck.

BTW, what's the difference between the Multiplayer Development forum and the Faction & Era Development forum?
User avatar
Vendanna
Posts: 626
Joined: September 16th, 2006, 10:07 pm
Location: Spain

Re: TCG Era

Post by Vendanna »

Luther wrote:BTW, what's the difference between the Multiplayer Development forum and the Faction & Era Development forum?
Multiplayer development, has posts about maps for multiplayer, balance threads for units, and reviews of replays.

Faction & Era: this is were you post your faction or eras ideas, for suggestions/versions.
"Mysteries are revealed in the light of reason."
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: TCG Era

Post by Gambit »

I'd keep this here in Multiplayer Development since you're not actually adding new units.
random recruits are what TCGs are all about. Also, if someone made a campaign out of this concept, the recall list would serve well enough as a deck.
Only half true. It's random out of a custom, lovingly crafted, deck. You get to choose the pool out of which the randomness comes.
The problem was that I used Lua's math.random to get the random numbers.
You should probably mention this to Silene. I'm sure lua's randomness could be made multiplayer safe.

Did it work when you used WML?
Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

Re: TCG Era

Post by Luther »

I didn't quite use WML. Here's the code that works. It activates the set_variable tag from within Lua.

Code: Select all

W.set_variable{name = 'typeN', rand = '1..'..#unitTypeList}
local type = unitTypeList[WV.typeN]
WV.typeN = nil
Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

Re: TCG Era

Post by Luther »

I recently stumbled across something very disturbing on the wiki: EventWML#Multiplayer_safety. It says here that user input or random numbers will cause OOS errors unless done inside one of the specified list of events. In TCG, all summonings happen either in a menu command or an ai turn event, neither of which are covered by that list.

To playtest in the past, I would get out my desktop and my netbook, log them both into the multiplayer server, and have them play against each other. Somehow, the game played perfectly even though I get OOS errors when playing against other people. The only things my two computers have in common is they both connect through the same router (and therefore have the same IP), and they run Ubuntu 9.10.

When playing against others: In one case, I played a 2p map with fog. This caused OOS errors, but I don't know what the other player saw.

In another game, it was 3p, without fog, and 2 humans and 1 AI. The other player reported not being able to see any summoned units, except possibly his own (forgot to ask, sorry).

I plan to fix this by taking out the menu command and doing an [auto_summon] inside turn refresh and a leader's moveto events.

Pro:
  • Automatic. No more menu clicking.
  • The AI will be able to summon in the middle of a turn, not just in the beginning.
  • The lack of an ai turn event means that replays will work.
Con:
  • If multiple keeps are within range of each other, the player has less freedom as to where they summon from.
On a related note, I find it very strange that menu commands that take user input are not MP safe, since Bob's RPG Era makes liberal use of them.
User avatar
em3
Posts: 342
Joined: April 1st, 2009, 8:59 pm
Location: Poland

Re: TCG Era

Post by em3 »

Hm... what if instead of a random summoning of a unit you would create a random recruit list for a leader every turn?

This would be equivalent to "drawing a hand" in TGC and "discarding" any unused units.

I think this would eliminate the OOS errors (this would happen at the start of the turn).

You could also remove units from the generated recruit list as they are recruited...
ride on shooting star
Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

Re: TCG Era

Post by Luther »

I think this idea is excellent. The game would have almost the same amount of randomness, and it would give the player more control. I'll have to research exactly how to get this done.

I feel that duplicate entries should be allowed on the recruit list, and unused entries should be retained for the next turn.
User avatar
em3
Posts: 342
Joined: April 1st, 2009, 8:59 pm
Location: Poland

Re: TCG Era

Post by em3 »

Thanks.

I don't know the inner works behind the recruitment and recall system, but maybe using the latter would be easier? Just a thought.
ride on shooting star
Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

Re: TCG Era

Post by Luther »

I thought about using recall lists, but it was easier to set up a proxy recruit list in Lua and reset the real recruit list whenever it needed to change.
Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

Re: TCG Era 0.6.1

Post by Luther »

I've decided to start posting Changelog entries in new posts. Hopefully, no one will mind me bumping the thread for this purpose...

0.6.1-beta2
TCG Castle no longer breaks when a keep is on the border.
User avatar
em3
Posts: 342
Joined: April 1st, 2009, 8:59 pm
Location: Poland

Re: TCG Era 0.6.1

Post by em3 »

I tried TCG6 against default AI. It was fun, if a bit too easy.

1. I didn't like the fact that almost only high level units were available for recruiting. I know the leaders are all high level units themselves (which I don't think was necessary either); yet, it was hilarious when I entered the enemy keep and recruited the same unit type as the enemy leader (Fire Dragon). The result is a few strong units on battlefield playing hide and seek.
Maybe there should be some "rarity" or "chance for appearance" based on level?
2. The "internal recruit list" shows untranslated unit names.

3. The "internal recruit list" could display icons for the units. I think this is possible with dialogs (like in wesband). This just an aesthetic detail, though, and I'm not sure how cumbersome to code.

4. I thought that there could be and option to offer (or force) a player to "discard" one of his "cards" at the end of turn if his "hand" is full. Still, this one would not probably work with AI -- unless there would be a mechanism to only affect human players.

5. I thought that the "internal recruit list" should be always shown at the beginning of turn. Still, if you recruit only once in 3-4 turns -- as it is now -- it would be more annoying than useful.

EDIT: Ad. 1. OK, I see what you did here. You picked units from mainline that don't advance to anything. That's your choice, I guess, although I prefer battles with more than 3-4 units per side... Adding more versions of the era with different available units would be pointless, too, as the number of combinations unit-set * rule-set would explode into too many variants of the era.

I'm thinking about making a variation of your era where you actually build your "deck" in game, buying unit types for gold. This will have to wait until I finish my student obligations.
ride on shooting star
Luther
Posts: 128
Joined: July 28th, 2007, 5:19 pm
Location: USA

Re: TCG Era 0.6.2

Post by Luther »

Changelog:
0.6.2-beta3
The command "Show actual recruit list" should now show translated unit names.

@em3: Thank you for playing. Keep in mind I prefer to keep things as random as possible rather than balanced.
em3 wrote: 1. I didn't like the fact that almost only high level units were available for recruiting. I know the leaders are all high level units themselves (which I don't think was necessary either); yet, it was hilarious when I entered the enemy keep and recruited the same unit type as the enemy leader (Fire Dragon). The result is a few strong units on battlefield playing hide and seek.
Maybe there should be some "rarity" or "chance for appearance" based on level?
I prefer to give each unit equal time. Due to advancement branching, level 2 and 3 units are much more numerous than level 1s. Also, the AI seems to usually recruit the most expensive units. As for leaders, I think it's important for leaders to be more powerful than recruited units. Otherwise, it would be too easy to assassinate the enemy leader, ending the game too quick. If you want there to be more units on the field you might try raising the start gold or gold per village.
2. The "internal recruit list" shows untranslated unit names.
Thanks for seeing that. It should be fixed now.
3. The "internal recruit list" could display icons for the units. I think this is possible with dialogs (like in wesband). This just an aesthetic detail, though, and I'm not sure how cumbersome to code.
I would think that would take too much space. Especially since you can already see icons in the normal recruit window.
4. I thought that there could be and option to offer (or force) a player to "discard" one of his "cards" at the end of turn if his "hand" is full. Still, this one would not probably work with AI -- unless there would be a mechanism to only affect human players.
I think this would make it too easy to avoid the randomness. If players could discard their least favorite unit each turn, they might end up with a dream team.
5. I thought that the "internal recruit list" should be always shown at the beginning of turn. Still, if you recruit only once in 3-4 turns -- as it is now -- it would be more annoying than useful.
I thought the internal recruit list would only be useful when your normal recruit list shows fewer units than it should, so you can see what unit is duplicated (and for debugging). Do you use it more than that?
EDIT: Ad. 1. OK, I see what you did here. You picked units from mainline that don't advance to anything. That's your choice, I guess, although I prefer battles with more than 3-4 units per side...
I do include all the core unit types that can attack (so no Elvish Ladies). Maybe you got unlucky and didn't see any low-level units. You should occasionally see some level 0 or 1 units.
I'm thinking about making a variation of your era where you actually build your "deck" in game, buying unit types for gold. This will have to wait until I finish my student obligations.
I would like to see that. I think forking is wonderful for anything even remotely artistic. :D Of course, if your era is more faithful to the TCG tradition than mine, I might have to change the name of this one :roll:
User avatar
em3
Posts: 342
Joined: April 1st, 2009, 8:59 pm
Location: Poland

Re: TCG Era 0.6.2

Post by em3 »

Luther wrote:@em3: Thank you for playing. Keep in mind I prefer to keep things as random as possible rather than balanced.
My pleasure, really. :)
I prefer to give each unit equal time. Due to advancement branching, level 2 and 3 units are much more numerous than level 1s. Also, the AI seems to usually recruit the most expensive units. As for leaders, I think it's important for leaders to be more powerful than recruited units. Otherwise, it would be too easy to assassinate the enemy leader, ending the game too quick. If you want there to be more units on the field you might try raising the start gold or gold per village.
Hm, I understand your points, I guess. It's more down to preference than to being right or wrong about something.
I think this would make it too easy to avoid the randomness. If players could discard their least favorite unit each turn, they might end up with a dream team.
Not really. There are many available units and there's a already a small chance to make a dream team.
I thought the internal recruit list would only be useful when your normal recruit list shows fewer units than it should, so you can see what unit is duplicated (and for debugging). Do you use it more than that?
Good point. No, not really. I peek into it from time to time to remember what options do I have. As I could feasibly recruit a unit every 3 turns... I sometimes forgot what I had in stock.
I do include all the core unit types that can attack (so no Elvish Ladies). Maybe you got unlucky and didn't see any low-level units. You should occasionally see some level 0 or 1 units.
Yeah, I actually peeked into LUA code and saw there some low level units. Modifying starting gold or income is an option, I guess.
ride on shooting star
Post Reply