Advertisement

Spawn time according to level?

Started by June 11, 2007 03:39 PM
4 comments, last by BigFreak 17 years, 8 months ago
I couldnt decide where to open this thread(there should be one more forum part which starts with game :D), so sorry if this is wrong forum. I want some kind of algorithm, which i can use for defining the spawn of the next monster.So far i have something that is very useless.I will be glad if u help me to develop it or rebuild it. srand (GetTickCount ()); int r = (rand() % 175) + 75; canavaryaratmaframe = framecount + r - levelcount*10 ; and what do you need to know to build an algorithm, the max level or any kind of information?? thanks
I had a big reply typed out then I realised I didn't really follow what you wanted to do, heh.

You want the spawn time to decrease in relation to the player's level (i.e. spawn time is inversely proportional to the player's level)?
Advertisement
So, what you want to do is have monsters spawn quicker the higher your level?

OK. What you're describing can be modeled many different ways, you just have to pick one and stick with it.

One way is with a hyperbolic function, i.e.

spawn time = 1 / (player level)

Get something like Graphmatica or some other graphing program and fiddle with numbers like this:

spawn time = 2 / (player level), spawn time = 1 / (2 * (player level)) etc.

Until you get a curve that looks like what you're trying to achieve. What you want to remember about these graphs is the the height is the spawn time and the distance across (to the right) is the player's level.

This kind of curve will increase very quickly, which is why it is important to fiddle with the numbers to get the shape you're after.

Other ways of doing it would be to set a minimum spawn time and say something like:

spawn time = -(player level) + (spawn time at level 0)

After a time, this will become 0 and even less than 0. This is why you need a minimum for this kind of equation.

Anything like this will give you an algorithm to use. You just have to fiddle until it looks nice.
Nick Wilson - Junior C# Developer | See my crappy site
i slept and went to school after my message and now.. :D


Quote:
Original post by BigFreak
I had a big reply typed out then I realised I didn't really follow what you wanted to do, heh.

You want the spawn time to decrease in relation to the player's level (i.e. spawn time is inversely proportional to the player's level)?


Yes thats exactly what i want.

And NickHighIQ, i have "derive" which can help me to find some curves.Lets see what i can find =)

thanks for ur replies



so far i have

((300/x) - 20) - ((((300/x) - 20)/100)*z)

x is levelcount and z is a random between 10-30.

that looks good in higher levels as a curve(after like level 6).

but before higher levels it gives huge framecounts like 200 or so,what can i do for that? another algorithm for lower levels :S i need help from experienced game-makers..

ps: my game has 14 levels,for now
I'd think about it on a slightly higher level to what you are right now.

You essentially want:

timeToSpawnInSeconds = -k * player.level

k will be the however-many-times-less-than-the-player-level-the-spawn-time-should-be constant, maybe with some other things multiplied by, added to, or subtracted from. But in its most basic form it'll look like that. Try and keep it simple when you're just calculating the formula. And factorise! :D

This topic is closed to new replies.

Advertisement