Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Jachan19
15
Years of Service
User Offline
Joined: 1st May 2011
Location:
Posted: 19th Nov 2014 01:26
While I am waiting for the solution of my other problem by someone else, I am coding something else to kill my waiting time... But I encountered another but few problems that I could unable to figure out... Before you start think like "Why don't you just research around first instead 'ask first before research'???" or "Why not programming first before asking?" or something, I DID researched around and tried to coding as much as I could... but sadly, so far, DBPro is not very famous to show up in google search and they mostly used Java or C++ to program which I sometimes don't understand to translate them into DBPro language. In other word, MOST of those sites I found through google are not very accurate to answer any of those problems of mine... okay, few of it but again, not very accurate enough. I will ask my problems here and hope anybody do have some good knowledge to fix it up, that if you already programmed some TCG in your past.
Yes, I am thinking to program a TCG game just for fun because it's one of my favorite genres because it's fun to form the deck you really like and hope for a miracle comeback during playing. (Yes, I had many miracle comebacks in this Pokemon TCG videogame I had bought last week, without losing after my second loss, even I had started with only-one pokemon in first few turns to survive until second basic pokemon had been finally drew).

- Cards -
This is not a big problem as I could tell... except to coding in the correct way... Which method should I actually create to code the cards in the whole card-database; A or B?
A - Using dimension command combined with Type command as such as Card(Number).Name$, Card(Number).HP, Card(Number).Power, Card(Number).Effects
B - Using dimension command without Type command like this; Card(Number, Name$, HP, Power, Effects)

For each card, do I have to create that amount for the functions to functioning the card to "fulfill the conditions to play and trigger the effect(s)" stuffs inside? Or is there any better method to cover almost everything for each card's card-rules?

- Deck -
Let me think about this and correct me if you find any error...
When put any card you like in the deck, I would have to flag each card as up to max-number deck-number... I am not very sure how to flag the extra copy of same card...? And how to shuffle the deck with all of those added-in cards is still unknown to me. To draw could be bit easy to figure out by just reduce the in-game deck-number from total number down to zero... To search a card out of the deck could be tricky to figure out...
To summarize them up, my problems of deck is...
- Detect/Flag the more-than-one copies of same card in one deck
- Shuffling
- Play a card with the effect that could allow you search a card in deck to add your hand (or summon to the card-battlefield either) which how to do search through your deck

- Graveyard / Discard Pile -
I am pretty sure it's almost same as deck but face-up and almost act same function as if you are "searching a card from deck"... right?

- Card-Battlefield -
Let me guess; I would have to program both player's field with number of creature/monster zones for X,Y to have any creature card "attach" to each zone when summoning... right? And deck's X,Y as well as Graveyard's.

- Opponent AI -
Lucky, I don't think I have any problem with this because I know what to code it down... so far... But I will let you know when I encounter any problem from this though.

I think that's almost everything I had encountered those problems...
I know it's more than "few" questions but I am a quick-learner, so I will make sure to understand how they works pretty quick once I read your advices / answers / solutions. I really love DBPro because it's the language I can actually write better than C++.(had ALMOST failed it in my college but miraclely passed instead)
So... yeah. Thank you for taking your time to read. ^.^=b
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 19th Nov 2014 06:31 Edited at: 19th Nov 2014 06:32
Quote: "A - Using dimension command combined with Type command as such as Card(Number).Name$, Card(Number).HP, Card(Number).Power, Card(Number).Effects"


use the Types, it is more readable and maintainable.

Quote: "When put any card you like in the deck, I would have to flag each card as up to max-number deck-number... I am not very sure how to flag the extra copy of same card...?"


You will probably want several arrays.

1)master list of all cards, with the basic data for each like name, hp, effects

2)list of cards a player 'owns' this does not need to copy the basic data from the master list, it only needs to reference the card's master list index. It should also include a count of quantity owned for each card, and a count of quantity used. this count of used is how you can limit the max-number in the deck

3)list of cards in the deck. again no need to copy the base data, just reference it from the master list.

Quote: "- Graveyard / Discard Pile -
I am pretty sure it's almost same as deck but face-up and almost act same function as if you are "searching a card from deck"... right?"


yeah, a graveyard is just another deck/array/list.

Jachan19
15
Years of Service
User Offline
Joined: 1st May 2011
Location:
Posted: 19th Nov 2014 22:36
Okay, thought so. It may make a huge list to create but better than to catch myself a HUGE stuck and force to cancel the project. (new word: "Programmer's Block." XD)

Quote: "1)master list of all cards, with the basic data for each like name, hp, effects

2)list of cards a player 'owns' this does not need to copy the basic data from the master list, it only needs to reference the card's master list index. It should also include a count of quantity owned for each card, and a count of quantity used. this count of used is how you can limit the max-number in the deck

3)list of cards in the deck. again no need to copy the base data, just reference it from the master list."

1) Do you mean to start the basic-level cards where it would be very easy to create-program before advance to next level? If so, yeah, that's what I am doing it right now... even though I do have a little trouble to focus on it which I sometimes add non-basic ones in it, lol. But yeah, better stick with basic to test around until it's perfect-balance before advance to next-level, just like Yugioh's releasing booster packs as very-first one was too basic while later contains next-level advancing cards, right? =)
2) So, basically, create a card-trunk list that player collected / got AND create a deck-trunk list (as you "named" it; "master list") that player WILL use it to play/battle??? Okay, gotcha.
3) Yeah, okay. Sadly, it will have to be do it so for opponent's deck however. But yeah, I get you now.

Figured about Graveyard, thanks again.

In conclusion, I will take that you have no idea of the answer about the second question of Cards, correct? It's really okay if you don't have any. I am still programming it to build the playmat / battlefield around to be prepared with using a dummy card before actually using the cards I created for fun.

Thank you so much, Ortu! give you a thumb-up! =b
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Nov 2014 21:54 Edited at: 20th Nov 2014 21:57
for 1) the master list doesn't mean basic as in simple, I meant all the relevant info about a card like its name health abilities and so on. this can be as simple or complex as you need. basically this master list will have one entry for each card in the game and will have all the info about that card. anytime you need to know something's about a card, you look it up in this list. this master list is not modified by the player or by gameplay. think of this as the publishers list of cards the game uses.

2) is a list of all the cards a player has won, bought, whatever and has available to put into a deck to play with. this list can just reference that cards location within the master list along with counts and quantities relevant to the player. when you need info about this card, get it from the master. you can think of this list as the players full collection of cards.

3) is the cards selected from 2) which the player is actually using to play. this is the deck.

as far as question two do you mean about implementing the abilities and effects? like tap this card to deal 2 damage to target - this is where the game gets complicated and there is no quick and easy answer. you could make a function for each specific card, but that is not very efficient. better to break abilities and effects in general types then pass specific values as parameters.

function dealDirectDamage(amount, target)

then any card which can deal damage can all use the same function and pass in thier own values.

Jachan19
15
Years of Service
User Offline
Joined: 1st May 2011
Location:
Posted: 20th Nov 2014 22:58
1) OH! in other word, "printed" cards. Yeah, I already know that and had it covered... I hope... But I am not really done to programming the field-zones yet, still working on each card-XY depend on amount of cards to place down.

2) oh...?

3) Oh okay.

Quote: "as far as question two do you mean about implementing the abilities and effects? like tap this card to deal 2 damage to target - this is where the game gets complicated and there is no quick and easy answer. you could make a function for each specific card, but that is not very efficient. better to break abilities and effects in general types then pass specific values as parameters. "

I thought it would be easy if they would just make a Type like "Card.TapAbility" and "Card.TapAttack" which either will lock the other one? If two tap abilities, then add number in end while making a double though (TapAbilityOne, TapAbilityTwo, TapAttack).

I guess to function the card-rules on each card will have to be used by "Function" commands for each card to list, almost like that you mentioned of direct-damage combine with create-card-list?
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 21st Nov 2014 05:44
Types can only hold data, they can't take actions.

You can keep track of a card's tap state with a type like card.isTapped = true/false, but you will need a function or some other code to actually execute the effects caused by the tap

Jachan19
15
Years of Service
User Offline
Joined: 1st May 2011
Location:
Posted: 21st Nov 2014 06:32
yes but you can actually flag it which I did it in some games I had coded, it works somewhere better.
Like, while is true to tap, it flag to rotate it to 90-degree and have it detect the card-name (or ID or whatever) while find the tap-flag to take its effect(s) and once the whole effect(s) finish, flag it as "HadBeenTapped" to evade the repeating-effect in any next run-loop until the turn where it will be untapped and can be tapped once again.

I mean, that's what I could imagine it be possible anyway.
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 21st Nov 2014 07:35
yeah, that works for keeping track of a card's state and for triggering effects

Login to post a reply

Server time is: 2026-07-17 12:28:35
Your offset time is: 2026-07-17 12:28:35