Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[ASK] Making Damage & Stats to max 32k


Miharukun
 Share

Recommended Posts

@'Miharukun':

> Hello, do anyone know how to make max damage, deff, stats (will, str, agi, etc.) into 32k like TFF?

currently they are placed as max 255 because the variable that is being used is "Byte" just change it to "Long" and change the other process that connect with the Stats into Long
Link to comment
Share on other sites

@'sherwin':

> @'Miharukun':
>
> > Hello, do anyone know how to make max damage, deff, stats (will, str, agi, etc.) into 32k like TFF?
>
> currently they are placed as max 255 because the variable that is being used is "Byte" just change it to "Long" and change the other process that connect with the Stats into Long

Can you show me how please shewin? I'm currently using Skywyre Primitive v7
Link to comment
Share on other sites

@'Growlith1223':

> as i read this entire thread im seeing the use of a Long in a situation where it will most likely never reach that high, it would be better to use an Integer, while it's not much there is a tiny bit of a faster read/write on Integers than what it would be on a Long

This ^
Link to comment
Share on other sites

@'BeNjO':

> @'Growlith1223':
>
> > as i read this entire thread im seeing the use of a Long in a situation where it will most likely never reach that high, it would be better to use an Integer, while it's not much there is a tiny bit of a faster read/write on Integers than what it would be on a Long
>
> This ^

So i change it to Integer or Long? x-x do integer can reach 32k?
Link to comment
Share on other sites

@'Growlith1223':

> An integer's max is 32767(at least in vb6 it is, in .net it's the same size as a Long but a Long is larger in .net if i remember correctly) so yes, it can reach it, you shouldn't be using a variable bigger than what you absolutely need, it's waste of memory and a waste of speed

Ahh that's what i needed :D thank you so much bro!

so, i just go find byte and change it to Integer right?
Link to comment
Share on other sites

@'Miharukun':

> @'Growlith1223':
>
> > An integer's max is 32767(at least in vb6 it is, in .net it's the same size as a Long but a Long is larger in .net if i remember correctly) so yes, it can reach it, you shouldn't be using a variable bigger than what you absolutely need, it's waste of memory and a waste of speed
>
> Ahh that's what i needed :D thank you so much bro!
>
> so, i just go find byte and change it to Integer right?

Just go into modTypes, look around for PlayerRec, look for Stats(1 To Stats.StatCount - 1) As Byte. change that to an Integer, ofc you will have to change a lot of the subs that interact with those stats(change them i mean) and change their constructors(the word after As) to Integer
Link to comment
Share on other sites

As far as I am aware the runtime will convert any integers to longs in VB6(Internally, mind you.. You won't be able to use the full address space reserved for a Long yourself), which would make using an integer pointless as you'll just make it a tiny fraction slower with more limitations.
Link to comment
Share on other sites

@'Joyce':

> As far as I am aware the runtime will convert any integers to longs in VB6(Internally, mind you.. You won't be able to use the full address space reserved for a Long yourself), which would make using an integer pointless as you'll just make it a tiny fraction slower with more limitations.

Might as well just throw a value of 1 onto a Long, im sure it'll convert!

EDIT:
Correction, judging from what you just said, might as well just throw no limitation and use a Single, im sure that'll be exceptionally fast
Link to comment
Share on other sites

@'Joyce':

> I wonder about that, generally I would say pick what seems the most appropriate.. In this case an Integer, but VB6 Integers are rather strange.

It's a small speed boost to choose an integer over a long but it adds up, trust me and with vb6 you need all the speed you can get >_>
Link to comment
Share on other sites

@'Joyce':

> Boost? I'm not sure I understand how constantly having your data converted between a Long and Integer will be faster than just flatout using the format it'll convert to anyway.

I wasn't talking about converting back and forth i was talking about switching to Integers where needed since i highly doubt anyone ever is going to go past or even needs to go past 32k, just seems a bit unreasonable there(except for maybe experience)
Link to comment
Share on other sites

ok redoing my tests for this type of stuff, An integer is handled within a 2.3ms timespan for a 1 To 32k for loop. a Long is handled within a 1.8 For loop, HOWEVER, i have noticed that there was a small jump in memory consumption with a Long than what it would be with an Integer, being as a Long is 4 bytes memory and an Integer is 2 bytes of memory.
Link to comment
Share on other sites

funny thing the speed enhancement from a long is only if you are using a 32bit processor. Its why 32bit applications run slightly slower on 64bit processors than on 32bit processors this is due to the registers being 64bit in size. Anyways speed wise integer to long on most processors will calculate around the same speed down to the microsecond on a 64bit system. regardless though you should not use a variable type bigger than what is needed if you are going to send the players data over the net or to other people. Also using a long over a integer will double the amount of space the stats will take up PER user. in turn your server and client will use much more ram based on the array of users you have setup and how many stats you have within those users.

Overall its better to just use a integer. Also do not use a floating point for this in vb6 it will end up making it slower for regular adding and subtracting as they do not follow the newer IEEE standards for floating points which most newer processors use to speed up floating point calculations.

Other than that here are the variable types and their equivalent bit sizes.

Byte 0 to 255 8bits
Integer -32,768 to 32,767 16bits
Long -2,147,483,648 to 2,147,483,647 32bit
Currency -922,337,203,685,477.5808 to 922,337,203,685,477.5807 64bit

Floating points.
single 32bits
double 64bits
Decimal 112bits

So go with a integer. yes there will be a slightly decrease in speed but its worth the size.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...