NamePros.Com (http://www.namepros.com/)
-   Programming (http://www.namepros.com/programming/)
-   -   doing a rpg experience system (http://www.namepros.com/programming/466410-doing-a-rpg-experience-system.html)

liam_d 05-07-2008 04:55 AM

doing a rpg experience system
 
Hi all i am just wondering what is a good way to calculate experience when levelling up in a php rpg game?

mholt 05-08-2008 06:31 PM

Uhhh it depends on the game and how it works. Who are the characters, what is the plot, what do you do in the game, what's the main source of "player persistence" (how does a player "keep going" - usually a type of money or something) ...

Palyriot 05-09-2008 12:58 AM

This is the formula I use for my game

$k is level.

PHP Code:
<?php
for($k = 1; $k <= 1000; $k++)
{
$exp = (3/4) * ((50/3) * pow($k, 3) - 100 * pow($k, 2) + ((850/3) * $k) - 200);
echo
$k.": ".$exp."<br>";
}
?>


Levels 1-1000

Just change the formula a little bit depending on your liking.

hyped 05-09-2008 07:58 AM

it depends how fast you want people to be able to level, and how much experience users are able to obtain per kill or quest or whatever.

in some games, like asherons call, the experience scale was exponential (i think). I believe there were 126 levels, and after about level 100, it seemed like it would take decades to get to the next level.

in other games, like everquest 1, the first 10 or 15 levels were very quick and easy, and then it just became increasingly difficult to level, but not unbearable.

you're going to have to decide what you want the user experience to be like, and then you can choose a basic algorithm and spend a lot of time tweaking it until you're satisfied

Palyriot 05-09-2008 09:09 AM

Well, unless the experience you get from each kill gets less and less, it has to be exponential. The speed of your system not only depends on your experience formula, but also how much experience you give for each kill.

Dreads 05-21-2008 12:30 PM

Wouldnt it bee better to replace $k = 1 to $k = $level ?
<?php
for($k = 1; $k <= 1000; $k++)
{
$exp = (3/4) * ((50/3) * pow($k, 3) - 100 * pow($k, 2) + ((850/3) * $k) - 200);
echo $k.": ".$exp."<br>";
}
?>

Palyriot 05-22-2008 12:43 AM

Originally Posted by Dreads
Wouldnt it bee better to replace $k = 1 to $k = $level ?
<?php
for($k = 1; $k <= 1000; $k++)
{
$exp = (3/4) * ((50/3) * pow($k, 3) - 100 * pow($k, 2) + ((850/3) * $k) - 200);
echo $k.": ".$exp."<br>";
}
?>



If you mean changing $k to $level, then that's just preference. That won't change the program, just the code. If you mean physically changing $k = 1 to $k = $level, the variable $level isn't initialized yet. It would most likely just be the same as $k = 0.

Dreads 05-23-2008 07:29 PM

well yeah i know that, you can make it pull $level from a database.

Palyriot 05-25-2008 03:57 PM

Originally Posted by Dreads
well yeah i know that, you can make it pull $level from a database.



The script I wrote has nothing to do with a database. In my game I use that script to add each level to a database and then I check what level they are by comparing their experience with the database.


All times are GMT -7. The time now is 10:30 AM.
Site Sponsors
Advertise your business at NamePros

Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0