Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating npc pokemon based on level.
#1
Okay, I tried explaining this on msn to someone, but failed. Possibly because this's difficult to explain, possibly because of my english, but I'm gonna try again here anyway.

Note; I'll be talking about not player-owned pokemon here.

I have a pokemon system. Every pokemon has certain "base-stats". A certain amount of strenght, defense, magic and speed. (Different names, but same deal.) The file looks like this :

Code:
[Pokemon1]
Type=
MAX_HP=0
Attack=0
Defense=0
Special_Attack=0
Special_Defense=0
Speed=0
Attack1=0
Attack2=0
Attack3=0
Attack4=0
It goes on like that till Pokemon6 (MAX_POKEMON = 6)
So that're basicly the stats at level 1.

I also have a file that saves how much stats it gains every level. That one looks something like this :
Code:
[Level2]
MAX_HP=1
Attack=1
Defense=1
Special_Attack=1
Special_Defense=1
Speed=1
Learn_Attack=0
Evolve=0
[Level3]
MAX_HP=2
Attack=2
Defense=6
Special_Attack=2
Special_Defense=4
Speed=1
Learn_Attack=0
Evolve=0

So, if a pokemon levels from level 1 to level 2, all it's stats would increase by 1. And if it levels from level 2 to 3, all it's stats would increase by something too.

Now here's the problem. Since this is about NPC-owned Pokemon, they don't level. Instead, they have a high-level pokemon. Say, a level 3 charmander.

It's stats would be the level 1 basestats + the stats you get at level 2 + the stats you get at level 3.

Now, here's my question. The way I'm doing it now doesn't looks very smart to me. If a trainer used a level 100 pokemon, it'd mean a lot of calculating. Is there a better way to do this? I'd especially like to hear from Matt(?) because he's working on a pokemon-like game what his solution on this problem is. Or maybe I'm just thinking too difficult.

I hope I explained it clearly enough, and if not, ask some questions, I'll glady answer them.

EDIT

Oh, and I know using ini files isn't very smart, I plan on switching to binary, but not until I've got everything done, because Ini's are easier to read/debug, I believe.
Reply
#2
I understand what you mean, and don't think it's a good idea to do it that way. You should probably use a function for it:

Code:
Function GetPokeStats(ByVal PokemonIndex As Long, ByVal level As Long) As Long
    Int(Pokemon(PokemonIndex).Str) = 1.2 * Level
    etc...
End Function

And then make types for the pokemons. Not sure if this was what you was looking for. Just gave you a fast idea I had.

But still, its very hard for us to give you some hints on this, because we dont know how the pokemon works, and how you are going to use the stats.
Reply
#3
Yeah this is where the math comes into play. Do like he said to make an equation to get each stat based on level. Mess around till you get about what you want.
Reply
#4
William Wrote:I understand what you mean, and don't think it's a good idea to do it that way. You should probably use a function for it:

Code:
Function GetPokeStats(ByVal PokemonIndex As Long, ByVal level As Long) As Long
    Int(Pokemon(PokemonIndex).Str) = 1.2 * Level
    etc...
End Function

And then make types for the pokemons. Not sure if this was what you was looking for. Just gave you a fast idea I had.

But still, its very hard for us to give you some hints on this, because we dont know how the pokemon works, and how you are going to use the stats.

I think you know what I mean exactly.

The problem is, I don't want to use a formula to calculate it's stats per level. Instead, I want to calculate it based on it's base stats, and on an .ini file that has the amount of stat points it should grow per level. It can vary per level.
Reply
#5
Well you simply want the CurrentLevelStats + NextLevelStats.

So, lets say you still want to use the function. You could do it like this:

Code:
Function GetPokeStats(ByVal PokemonIndex As Long, ByVal level As Long) As Long
Dim i as Byte
    For i = 1 to Level
       Int(Pokemon(PokemonIndex).Str) = GetVar()
       etc...
    Next i
End Function

Now the GetVar will use the "i" variable. Something like this:
Code:
GetVar(path, "LEVEL & i, "Attack")

So in the For loop you will need to add them together, so the previous is added to the new etc..

Code:
Function GetPokeStats(ByVal PokemonIndex As Long, ByVal level As Long) As Long
Dim i as Byte
    For i = 1 to Level
       Int(Pokemon(PokemonIndex).Str) = Int(Pokemon(PokemonIndex).Str) + GetVar(path, "LEVEL & i, "Attack")
       etc...
    Next i
End Function

Remember that the GetVar isnt correctly done here.. I think this would be what your looking for? Otherwise I can give you some other ideas or develop this one.
Reply
#6
I really wouldn't recommend the full use of either method. When you are creating a game, or in your case, re-creating a game such as Pokemon, you do not want to have a simple calculation such as William's suggested (x 1.2). What would be the point of having every Pokemon level the same way? That would make it so that the player could just go out and catch any Pokemon, and have to level the hell out of it inorder to dominate in that game's situation. That would also ruin the point of having other Pokemon other than just having a different looking one.

You would want to implement a more sophisticated system of leveling in that kind of situation. You would be better off creating a matrix of levels, so that way you could have the leveling based off of, we will use rarity for example. If you made it so that the pokemon's stat increase for each level based on how hard it would be to capture it would also give more opportunities for game play. Otherwise what incentive would the player have to play further into the game and catch the almighty legendary bad ass Pokemon. If I can remember far enough back it was Mew or something like that. It doesn't have to be just based of rarity, could also be the type of Pokemon, (Rock, Water, Fire, Grass, etc...) possibilities of creating a good leveling algorithm are endless. Just don't be fooled into creating a very simple formula for the "speed", the process of a single sub seems to be so overly dramatised in these forums. Just as long as you make it efficient.

When creating a matrix for the program to reference to allow the correct constants to be input into the calculation you could simply create it as a table. When opening a table, such as with ADO control and an SQL statement. It will not load up the entire table into memory at that single instant. It will pull up the information enough to search tell whether the values currently pulled up are true, if so then put them in your query, if not then try the next record. So if you wanted to create a single stat system for each individual Pokemon it isn't as bad on performance as it looks.

This is just me being in a tired ramble but you can take what ever information in this to use to your advantage. Just remember the one thing that drives every person who plays a game. The goal to get or reach the best level or object in the game. Give your players that chance and good game play along the way, and you will really have something going for you.

Best of luck to you,
Beldame
Reply
#7
I prefer setting ALL settings manually, per level, but I've already worked this one out. Thanks anyway.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)