Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Token Registration
Moderator: CCGHQ Admins
Token Registration
by Xander9009 » 28 Oct 2014, 10:06
(For 2014) Is a token registration tag always required for any card put onto the battlefield via token producing functions, or is this only necessary if the object produced is actually a token? I'm asking because I've noticed many missing token registrations in the CW, and they're (almost) all for cards that produce "tokens" which aren't actually tokens (they produced like tokens but not marked with <TOKEN />). If it's not required, does anyone know of any downsides to having the token registration tag anyway?
I just added token registration checks for RSN's Characteristics manager creating functions (so if the function calls for a token to be produced, it makes sure the tokens are registered). It also caught quite a few with a basic PutTokenOntoBattlefield function call. It would be easiest to simply add the missing registrations, even if they aren't needed, than to code it so it checks the "token" for the <TOKEN /> tag. just don't want to cause any problems. Advice?
I just added token registration checks for RSN's Characteristics manager creating functions (so if the function calls for a token to be produced, it makes sure the tokens are registered). It also caught quite a few with a basic PutTokenOntoBattlefield function call. It would be easiest to simply add the missing registrations, even if they aren't needed, than to code it so it checks the "token" for the <TOKEN /> tag. just don't want to cause any problems. Advice?
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
Re: Token Registration
by RiiakShiNal » 28 Oct 2014, 10:53
As far as my tests have gone, it is always required to have TOKEN_REGISTRATION tags if a token is produced (even if it doesn't have <TOKEN/> in the produced token). Side effects for not having the registrations would be crashing either during or after a match. Typically crashes happen when the tokens cease to exist and the game tries to clear the memory used by them, so for persistent tokens it will typically happen at the end of a match, while for frequent tokens that are generated and go away a lot it tends to happen during a match. Occasionally, the crash will not happen even if the registration is missing, but that seems to happen randomly depending on what garbage gets referenced instead of the registration.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Token Registration
by Xander9009 » 28 Oct 2014, 10:57
Alright. That's a good thing for me (it means my card validity checker happens to be working the way it should), but unfortunately, it means quite a few cards need fixed. Thanks. I remembered you mentioning this when first explaining your characteristics functions to me, but I didn't know if the missing <TOKEN /> tag had any effect. Since it doesn't, I'll go fix thoseRiiakShiNal wrote:As far as my tests have gone, it is always required to have TOKEN_REGISTRATION tags if a token is produced (even if it doesn't have <TOKEN/> in the produced token). Side effects for not having the registrations would be crashing either during or after a match. Typically crashes happen when the tokens cease to exist and the game tries to clear the memory used by them, so for persistent tokens it will typically happen at the end of a match, while for frequent tokens that are generated and go away a lot it tends to happen during a match. Occasionally, the crash will not happen even if the registration is missing, but that seems to happen randomly depending on what garbage gets referenced instead of the registration.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
Re: Token Registration
by NeoAnderson » 28 Oct 2014, 12:29
As i see thereis another thing to consider, if experienced:
When you call PutTokenOntoBattlefield() and uses a card that is into deck(not token) the registration will causes the crash of the game. So for cards that are inside the deck should not be called.
When you call PutTokenOntoBattlefield() and uses a card that is into deck(not token) the registration will causes the crash of the game. So for cards that are inside the deck should not be called.
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Token Registration
by Xander9009 » 28 Oct 2014, 12:30
Noted. Thank you.NeoAnderson wrote:As i see thereis another thing to consider, if experienced:
When you call PutTokenOntoBattlefield() and uses a card that is into deck(not token) the registration will causes the crash of the game. So for cards that are inside the deck should not be called.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
Re: Token Registration
by NeoAnderson » 28 Oct 2014, 13:45
Now i did remember that sometimes i had to remove the token registration due of some game crash, i was going crazy on some cards ( i don't remember exactly which cards) but sometime if we use token registration the game crashes.Xander9009 wrote:Noted. Thank you.NeoAnderson wrote:As i see thereis another thing to consider, if experienced:
When you call PutTokenOntoBattlefield() and uses a card that is into deck(not token) the registration will causes the crash of the game. So for cards that are inside the deck should not be called.
The weird thing is that i remember that were some cards of a set like flip cards, all cards are coded with the same structure, so there was no reason that only some of them crashed when the token was registered!
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests