• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

I'm programming the Pokémon TCG base set

I'm not sure if maybe this rule has changed since then, but in your latest version on itch I went first and was able to also attack on my first turn, which in modern formats is not allowed
 
I'm not sure if maybe this rule has changed since then, but in your latest version on itch I went first and was able to also attack on my first turn, which in modern formats is not allowed

Yeah I based the whole thing on the original Gameboy game, in which players could attack on the first turn. I'm planning for a future milestone to add togglable variant rules.
 
Milestone 7, finally done. This was more or less finished like two weeks ago but then I got a new job and things have been weird.

A lot of general improvements in this one. The tutorial now exists. If you've never played the Pokémon tcg I would love your feedback on how it works. There's also some minor improvements to the overworld: the club is a bit larger now that the screen can scroll to follow the player. There's also the world map which allows you to travel to the lab, though there's not much there yet.
 
i dont know if this is only my issue but whenever i fight lexi and i win against her after i win and im about to get the booster it doesnt appear and the game pretty much stops working
 
Are you still working on this? I found this thread while trying to learn how to hack the GBC ROMs for the original two TCG games. Definitely checking this out now!
 
I'm back. I'm actually the same guy from earlier who made all those bug reports, had to make a new account because I forgot which email/password I used to make the original one. I did a "casual" run of the game and a bit of testing beyond that, haven't gotten around to testing every card but I still found several things to report.

Spoiler: Bug reports


I know it's been a while since you worked on this, and I understand, I haven't been here in a long time because real life's been keeping me busy too. Just leaving these here if you ever do come back, I hope you do. TCG fangames might start getting more attention soon now that Nintendo's releasing a TCG mobile game.
 
I'm back with 0.7.1. Or more accurately, I'm done lurking. Rest assured I've been keeping an eye on both this and the itch.io page near daily since I last posted. Over the past month I've been getting better at developing a new work-life balance, and so I've gotten back to work on milestone 8. That starts with fixing all the bugs found in that time, and there were many. I also added the first new feature of the Milestone: the enhanced deck builder. It's definitely an improvement, though I may still need to get used to it. I already have some ideas for how to improve it. If you have any feedback in that regard let me know.
 
Good to see it's back! There are still bugs to be found of course. These were the results of a "casual" playthrough followed by a quick test of each grass type:

Spoiler: Bug reports


And I do have a suggestion for the deck builder: It's slightly annoying when I want to search for a trainer card, and initially nothing comes up because I previously I was looking for Pokemon by type, and now I gotta go back and click "all types" again in the menu. Very minor thing but I suggest making trainer cards count as all types instead of as none.

A non-deck building suggestion I have is to have a way to see what you get from a booster pack instantly, skipping the animation of all 10 cards sliding across the screen. Currently if you try to do that by clicking "Done", it just exits the screen and you don't get to see what you got.
 
Last edited:
Here's the bugs I found while testing the Fire, Water, Electric, and Fighting types:

Spoiler: Bug reports
 
Last edited:
And finally, the Psychic types, Colorless types, and remaining trainer cards.

Spoiler: Bug reports
 
Hi. What do I have to do with the files once I download the game? So then I tried finding it in the Itch.io app, but it doesn't show up. I tried a few different names but no luck
 
Hi. What do I have to do with the files once I download the game? So then I tried finding it in the Itch.io app, but it doesn't show up. I tried a few different names but no luck
to be honest I've never tried it directly... You should be able to extract the files and run the html file, assuming you're on a desktop. This is the first time I've heard of the itch.io app, but I imagine it's a launcher for exe versions of downloaded games. I build my games to html5 because most people are more willing to playtest a game if they can play it in browser rather than trust a random exe file. The downloads are mostly for archiving anyway. It should be playable from the zip folder, but I definitely recommend playing it in browser instead.
 
to be honest I've never tried it directly... You should be able to extract the files and run the html file, assuming you're on a desktop. This is the first time I've heard of the itch.io app, but I imagine it's a launcher for exe versions of downloaded games. I build my games to html5 because most people are more willing to playtest a game if they can play it in browser rather than trust a random exe file. The downloads are mostly for archiving anyway. It should be playable from the zip folder, but I definitely recommend playing it in browser instead.
Thanks for the info. I guess I'll keep playing on the brower. Btw, I was battling the first character in the 2nd area and my game isn't letting me pick a prize card. I can click on all other cards to zoom in on them but I can't pick a prize card. I was able to just fine before this battle. I have ublock, would that be causing it?
 
to be honest I've never tried it directly... You should be able to extract the files and run the html file, assuming you're on a desktop. This is the first time I've heard of the itch.io app, but I imagine it's a launcher for exe versions of downloaded games. I build my games to html5 because most people are more willing to playtest a game if they can play it in browser rather than trust a random exe file. The downloads are mostly for archiving anyway. It should be playable from the zip folder, but I definitely recommend playing it in browser instead.
Oh and also, does the game select any of my decks for play at random?
 
Thanks for the info. I guess I'll keep playing on the brower. Btw, I was battling the first character in the 2nd area and my game isn't letting me pick a prize card. I can click on all other cards to zoom in on them but I can't pick a prize card. I was able to just fine before this battle. I have ublock, would that be causing it?
Seems like you fell victim to this bug I reported earlier, it's unfortunately pretty common in this version of the game:

- First and perhaps most significantly, my game would sometimes enter a strange bugged state where whenever I drug a card around, it would leave that spot highlighted while the card itself either teleported back to my hand or the corner of the screen. It looks like this:
View attachment 161727
other than that, the game can be played as normal... up until the point when someone gets knocked out. Whether it's me or the opponent, when the game prompts me to either pick a prize card or send in a new Pokemon, I am unable to do so. It's not a complete softlock as I can still concede the duel from the menu, however the next duel will still be in this bugged state as well. There have been 2 or 3 occasions where this weird game state appeared and disappeared without softlocking me, but 9 times out of 10 when it happens the only cure is to reload the page. And it turns out, saving your progress just doesn't "count" when the game's in this state, when you reload the page you'll be sent back to your last save BEFORE the glitch happened. As for what causes it to happen, I've seen it occur most often the duel after I use the debug menu (even if I don't actually do anything but open and then close it). However, it doesn't always happen, and rarely I've seen the game enter this state when I had never even touched the debug option.
You'll have to reload the page when you see it happening. Try to remember to save in between each duel in case it pops up again on the next duel.
 
Out of curiosity, how did you structure the code for the pokemon attacks/powers/trainers? I'm working on something similar in Python, and I've been spending a lot of time working out the structure ahead of time so I don't end up with a huge tangle of spaghetti code.
 
I cannibalized the three starter decks and made a deck with Blastoise, Dewgong, Lapras, Machoke, and Hitmonchan that's been wrecking the NPCs pretty consistently since I got a few more trainers. I have no idea if this is because the AI isn't that great or because I'm just that awesome, but I choose to believe it's entirely due to my mad skills, yo. ;)

Vick: "You're deck it" should be "Your deck is"

"Player recieved a booster pack" should be "Player received a booster pack". EI, not IE.I think collecting the coin also spells receive wrong.

My Lapras was confused, tried to retreat, and failed. The energy was discarded, but the Lapras still showed that the energy was on it until the turn ended.

Please, please, let the player force the text animation for the current box to complete instantly by clicking on it a second time. Or just don't include any animation and have the text display instantly. I actually like that idea better, though that's a personal preference.

I got a mutual KO, clicked on Grimer, giving it the white edge, then selected a prize card. The game didn't register me clicking on Grimer again to bring him out and I had to choose a different Pokemon.

Was it a stylistic choice to leave the GB cards pixelated? Because Bulbapedia has non-pixelated images for all but six of them (https://bulbapedia.bulbagarden.net/wiki/Category:Pokémon_Card_GB_cards), and I could use the pixel art upscaler hq2x to upscale the remaining six for... eh, moderate improvements. Not great, but a little better than just leaving them alone, I think.

Actually, I went ahead and upscaled the 6 Game Boy images that didn't have a print analogue. Let me know if you want me to do the same for the rest of the GB images, or if you'll crop the print images yourself, or neither. It wouldn't take me but a few minutes.

I would prefer to have some way to know which cards are in which boosters.

When using a pokeball, if you click on one pokemon, then click directly onto a different pokemon, the game doesn't register the change. You have to click the first pokemon again before the game will let you select a different one. Confusingly, it still shows the second pokemon when you click it, even if the first one is the one that is actually selected.

I did 40 damage to the vending machine pidgey, the listed amount of HP, but it wasn't knocked out.
 
Out of curiosity, how did you structure the code for the pokemon attacks/powers/trainers? I'm working on something similar in Python, and I've been spending a lot of time working out the structure ahead of time so I don't end up with a huge tangle of spaghetti code.
To be honest it is probably spaghetti code. I'm definitely a designer first and a programmer second. For the attacks each generic pokAttack points to a List of compontents that are attack effects (deal damage, deal a status effect, flip and if heads to these effects and if not these, etc). If I was smarter I would've probably hard coded trainers and powers to use the same system but instead I need to hard code every trainer. I never planned for this to go beyond Neo so all told that's a few dozen so whatever. For Powers, those that have to be individually activated are basically trainers, but those with passive ones have to be checked for every time and I see no way around that. Every damage calculation checks for Machamp. Every retreat checks for both Dodrio and Dark Muk. And in turn, every check of a pokemon power checks if Muk is in play. I'm not sure how to make that more efficient.

I'm sure you've already figured out for yourself that some cards are much harder to implement than others. That's why about a third of the Vending and Rocket sets aren't available yet. I figured I'd get the easy cards out of the way first and add what is harder more slowly.
I cannibalized the three starter decks and made a deck with Blastoise, Dewgong, Lapras, Machoke, and Hitmonchan that's been wrecking the NPCs pretty consistently since I got a few more trainers. I have no idea if this is because the AI isn't that great or because I'm just that awesome, but I choose to believe it's entirely due to my mad skills, yo. ;)
Yeah that's generally how I do it. Improving the AI will I'm sure be an ongoing struggle of this project. For the most part it makes ok decisions. From what I know of the gameboy games that's mostly how the game works, you're supposed to be struggling with a bad deck early on but once you get a decent one you should be able to take care of most of the generic trainers pretty easily. The club masters actually have strategy in their decks that the ai can carry out (and also cheat) which I haven't implemented.

Was it a stylistic choice to leave the GB cards pixelated? Because Bulbapedia has non-pixelated images for all but six of them

I did 40 damage to the vending machine pidgey, the listed amount of HP, but it wasn't knocked out.
It was. I got upscaled images from https://pkmncards.com. The illustrations on Bulbapedia looked bad in comparison when placed on the upscaled cards. Imo I find the pixilated look to the upscaled versions more charming anyway, it makes it more apparent a card is from GB.


I did 40 damage to the vending machine pidgey, the listed amount of HP, but it wasn't knocked out.
I got the Vending cards from pokemonaaah.net I've found some of the cards have typos and Vending Pidgey is one that I didn't catch before the build. I've been trying to get them to fix it but it's been slow. I'll probably just eventually fix them myself.



Most of the rest of those are either features that I'm planning on eventually adding or bugs/issues I know about.
 
Every damage calculation checks for Machamp. Every retreat checks for both Dodrio and Dark Muk. And in turn, every check of a pokemon power checks if Muk is in play. I'm not sure how to make that more efficient.
I don't know if this helps you, but the plan for my game is to use an event-driven approach. I don't know if it's too late for you to implement something similar without a horrendous level of refactoring, but here's what that will probably look like in my program:

An event manager is a class that's basically a list of the active effects, which are functions or references/pointers to functions (depending on the language). The event manager also contains functions to add or remove effects from the manager list, as well as some way of keeping track of what phase/event connects to what effect/function/event listener/event handler (they're all the same thing), possibly with separate lists, or even separate event manager objects, for each phase.

Each phase of gameplay (draw phase, attack phase, etc.) would be considered an event. When the manager is told that a phase/event happens, it goes down the list of functions/effects/event listeners/event handlers that have been mapped to that phase and calls each function on the list, including access to game state information that the functions would need to know and/or modify.

So Dodrio evolves, which automatically calls the function to add the Retreat Aid function to the Retreat phase list in the event manager. Then somebody decides to retreat their Pokemon, which triggers everything on the list, which in this case is just Retreat Aid.

As a side-note, I solved an issue I was having, where an attack ended prematurely or ignored existing effects on the enemy Pokemon (e.g. Transparency/the baby rule and Swift), at least theoretically. I haven't actually implemented any of this yet. The solution was to add a pointer indicating the current location in the effect list as well as adding functions to the class that are effectively commands for the list, such as run_next(), skip_next(), skip_all(), skip(effect_name), skip(type, location, etc.) skip_to(effect_name), etc.

So the player attacks a Haunter with Transparency, fails the coin flip, and the effect triggers the skip_all() function to push the pointer all the way to the end of the list, ending the attack phase. It also passes some information along to the rest of the program to not to run the damage calculation phase, but I haven't put as much thought into that yet.

Or the enemy attacks with Swift, which ignores weakness, resistance, and all other effects (and weakness and resistance are already effects on the list), so it triggers skip_all(location="enemy_pokemon"), which skips all the effects that are on the enemy pokemon and likely jumps straight to the damage calculation step.

Although, technically a function with associated information is more of a class than a function. I'll have to think some more about how I store the information for the effect's location.

Alternatively, I could include damage calculation in the attack phase, in which case Transparency would just skip_all() and Swift would skip_to(damage_calculation). It would make passing the information around easier, but it risks cluttering up the phase. I dunno, that's an implementation detail and I'm not there yet.

Anyhow, I don't know if any of this helps, but I hope it does! : )
Improving the AI will I'm sure be an ongoing struggle of this project.
I don't entirely understand the math behind it, but I'm planning to use Monte Carlo simulations, where you randomly simulate the possible outcomes a bunch of times and use that to select the best outcome. I'm likely to either use UCB1 algorithm or UCT to balance exploration (options that haven't been tried much) with exploitation (options that have done well in previous iterations of the simulation). UCT is more complex than UCB1 but gets better results. UCT builds a series of nodes and travels down them until it gets to the end, where it randomly simulates the rest of the game and uses the results of that simulation to update the node values. The biggest downside to UCT is that, because of the high branching factor of the unknown cards, I'd need to cheat a bit and make all the cards visible to the AI to make it work.

For your game, you've already got basic AI code up and running, so you might be able to just use the results of that to create a probability score for each choice, then refine that with a few dozen or hundred random simulations. If you wanted to save processing time, you could tell the simulations to end as soon as a prize card is taken, though obviously the resulting AI wouldn't be as strong.
 
Last edited:
The powers, yeah, would definitely be more efficient that way. The most I care about it is that it's not inefficient enough to cause any lag. (the bigger problem would be my deck builder. Repopulating after searching takes like half a second) I have something of an event system that works well enough that querying it for a list of active power effects vs querying it to check every bench spot for a specific pokemon name is kind of six-of-one, or at least is equivalent enough that I don't want to go back and redo everything. That type of improving for efficiency is the exact type of programming I hate.

And uuh yeah. AI algorithms... I definitely know what those are. I am more or less doing that in a few areas. It does calculate priorities for deciding to switch, which pokemon to switch to, which attack to use, which cards to discard and search for... I think where my system is mostly falling apart is that it doesn't combine all those decisions together. It decides to switch, then decides to attach energy, then decides to attack. As I think Regi_Grass has pointed out a couple times there are times where it has a ko but switches out instead. It works most of the time, and for now I choose to be ok with that.

I guess I choose to be ok with that because, to reiterate, I hate this kind of programming. So much. To be honest I started this project to try to work on middle-tier development, not this. And finally after on-and-off a total of a year of development I'm starting to work on other things besides the duel simulator. So yeah, aside from copious bugs to fix I'm kind of ok where it is now. I'm happy to work on the dialogue speed. I'm happy to make way to show what cards are in each pack. But yeah, I probably do have to fix that issue with that card selection window huh. Things will be improved eventually, but I'd like to focus on other features to have a real presentable game first.
 
Back
Top