Max skill level

Posted by Rendo on Tue 05 Oct 2004 08:21 PM — 7 posts, 26,580 views.

#0
I'm a retard, I can barely code and I'm getting the frustrated :(. The max skill level for any skill is 2^31, and I'm wondering how in the hell can I make it more than that so I can have skills going past 2.137billion. It'd really help develop the MUD I'm working on and I'm just a halfwit. Thanks.
USA #1
You could use 64-bit unsigned integers but frankly you might want to think of alternate solutions e.g. three 'tiers' of skill levels - 0, 0, 0 is the minimum, then 0, 0, 1, and so on, until 10000, 10000, 10000 or whatever.
Australia Forum Administrator #2
Ah, at the rate of obtaining a skill every 5 minutes, for 2^31 skills, it will already take 20,428 years to get them all. :)
USA #3
I think he is talking about the required level to practice the skill, rather than the max amount of skills. Or is it not that?
#4
Yes, the required character level, since the game uses a powerlevel system. I feel so stupid, it's probably so simple but it just won't work. For instance, if I make the skill required at 20b, the skill will show up as -1,437,363,737 or something like that, as if it loops or something. I just want to make it work :( Help me please.
Australia Forum Administrator #5
It's a reasonable question. You need to look in the file limits.h, this defines, amongst other things, the max for a long:

#define LONG_MAX 2147483647

(which, as you correctly point out, is 2^31).

However under many compilers you can now use 64-bit integers, which might be:

long long (gcc)

or

__int64 (Microsoft).


That's two underscores before the int64.

If you change the relevant parts of your code and recompile, then it should work.
USA #6
There is also the option of unsigned long/int/whatever to double your effective range without having to adopt a new number size.