How to make game item that is available in several levels?
Posted: Fri Nov 08, 2024 9:01 am
I decided to ask you others if you had implemented something similar, and ask how you did it.
It is not that I cannot do this, it is just a matter of wondering what would be the best way to do this, and hence asking how others might have implemented this.
While in title I am talking of Item available in several levels, which is basically the same thing, the real example is that I am making this Card Game based Football game. Between matches there is going to be a shop to buy more cards.
However, which cards will be available to buy, would depend upon the league. As in Junior Leagues has certain cards available, while Championship Leagues has some other cards available.
Idea is that Cards have some variables in them, like could be:
But how should I do the availability?
Like I could have: meaning it is available from seasons 1-3 (which might be the case in most times that cards are available from certain season to certain season, not outside those boundaries.
This would however make me need to make interpreter function to interpret the "1-3" string.
To avoid interpreter part, I could instead make:
But I don't think that is a good thing to do, that rather take the extra hassle of interpreter function to make it otherwise clearer looking.
However, I would like to keep the options open of having non sequential seasons too, in case I decide to go different route.
Like maybe player can choose whether he in next season moves to amateur or professional league, which could mean different set of cards. In this case it might be better to use something like:
Meaning cards wouldn't be available in season 3 and 5, but seasons 1, 2, and 4 would have them.
Naturally instead of {1, 2, 4} I could use names, like {"kids leagues", "Championship League"}
This would otherwise be good, except I do dislike the idea that the code becomes messier than "1-3" for example, since say I have 100 cards, and then each of those needs to be written separately.
something like "1-3" vs {"name1", "name2", "name3"} is clearly much clearer and easier to read and upkeep.
As a last thing I am also thinking that perhaps I should even keep up the possibility that other stats could change between seasons.
Like maybe in season 2 cards rarity is rare, in third season it is common to show up.
Similarly pricing could be higher in season 2, and price lower for each following season, in that case I might even need subtables:
Anyone having dealt with something like this before, and how did you solve this? Is there any neat way to get this done?
It is not that I cannot do this, it is just a matter of wondering what would be the best way to do this, and hence asking how others might have implemented this.
While in title I am talking of Item available in several levels, which is basically the same thing, the real example is that I am making this Card Game based Football game. Between matches there is going to be a shop to buy more cards.
However, which cards will be available to buy, would depend upon the league. As in Junior Leagues has certain cards available, while Championship Leagues has some other cards available.
Idea is that Cards have some variables in them, like could be:
Code: Select all
Card = {price=10, Name="kick", Rarity=5}
Like I could have:
Code: Select all
Availability="1-3"
This would however make me need to make interpreter function to interpret the "1-3" string.
To avoid interpreter part, I could instead make:
Code: Select all
AvailabilityStart=1
AvailabilityEnd=3
However, I would like to keep the options open of having non sequential seasons too, in case I decide to go different route.
Like maybe player can choose whether he in next season moves to amateur or professional league, which could mean different set of cards. In this case it might be better to use something like:
Code: Select all
Availability={1, 2, 4}
Naturally instead of {1, 2, 4} I could use names, like {"kids leagues", "Championship League"}
This would otherwise be good, except I do dislike the idea that the code becomes messier than "1-3" for example, since say I have 100 cards, and then each of those needs to be written separately.
something like "1-3" vs {"name1", "name2", "name3"} is clearly much clearer and easier to read and upkeep.
As a last thing I am also thinking that perhaps I should even keep up the possibility that other stats could change between seasons.
Like maybe in season 2 cards rarity is rare, in third season it is common to show up.
Similarly pricing could be higher in season 2, and price lower for each following season, in that case I might even need subtables:
Code: Select all
Card = { Name="Kick", ["season1"] = {price = 10, rarity=5}, ["season2"] = {price=5, rarity=20} }