LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



Go to page : Previous  1, 2, 3, 4  Next

View previous topic View next topic Go down Message [Page 2 of 4]

EVENTALIST
EVENTALIST
#11 Learn to script - Page 2 Empty Re: Learn to script
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
@elisamuelps- so you wanna learn more about lag prevention and cause?
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#12 Learn to script - Page 2 Empty Re: Learn to script
Loading

handy333

handy333
Active Member
Active Member
Active Member
profile
great, whenever I have a question, I'll come to you.
Active Member
Show Signature
Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox https://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
ACTIVATED
ACTIVATED
#13 Learn to script - Page 2 Empty Re: Learn to script
Loading

elisamuelps

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
mr_wiggles wrote:@elisamuelps- so you wanna learn more about lag prevention and cause?

yah really i need it ^^ i just noticed too that many of my scripts togheter make lags but individual it doesnt make it D: there is a solution? really i need it because with 2gb of ram i can't go more of 8-10 fps :S
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#14 Learn to script - Page 2 Empty Re: Learn to script
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Yea its complex, im learning about it my self because my scripts do the same, i found that its due to the links between the active classes, Ruby self manages memory and it does this by marking the active classes, when a class is no longer in use GC or garbage collector then returns the memory back to the OS.

You can reduce lag by reducing un necessary updates to variables that are not used that often, after long equations you can use Graphics.frame_reset, but you can't over use it of it makes it worse, im still learning about it.

Also reducing Global variables and variables in general, like try to use locals when possible instead of class.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#15 Learn to script - Page 2 Empty Re: Learn to script
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
@NuKa_BuBble - About rand()

http://www.cplusplus.com/reference/clibrary/cstdlib/rand/

A lot of Ruby is just C commands.

Code:

There are lots of random number generator algorithms - VB uses one that in a class called a pseudo-random number generator (PRNG)

From MSDN:

SUMMARY
The RND function in Visual Basic generates pseudo-random numbers according to a specific algorithm. For certain scientific or statistical studies it might be important to understand how these numbers are generated. This article documents the algorithm used.

A full treatise on the statistical nature of this algorithm is beyond the scope of this article but the topic is widely discussed in the scientific literature.
MORE INFORMATION
Microsoft Visual Basic uses the linear-congruential method for pseudo-random number generation in the RND function. The following pseudo code documents the algorithm used:
x1 = ( x0 * a + c ) MOD (2^24)

where:

x1 = new value
x0 = previous value (an initial value of 327680 is used by Visual Basic)
a = 1140671485
c = 12820163

The 'MOD' operator in the formula above returns the integer remainder after an integer division.

The expression x1/(2^24) will then return the floating-point number between 0.0 and 1.0 that is returned by the RND function.

Note that the above algorithm cannot be implemented in Visual Basic code in such a way that the random number sequence generated by the RND function can be reproduced. This is because internally Visual Basic uses an unsigned long data type that is not supported by the Visual Basic language.

The following C/C++ code can be used to generate the first ten pseudo-random numbers that Visual Basic generates:
#include "stdafx.h"

int main(int argc, char* argv[])
{
unsigned long rndVal;

rndVal = 0x50000L;
int i;
float rndFloat;

for (i=0;i<10;i++)
{
rndVal = (rndVal * 0x43fd43fdL + 0xc39ec3L) & 0xffffffL;
rndFloat = (float)rndVal / (float)16777216.0;
printf("Value is %.15f\n",rndFloat);
}
return 0;
}

Note that, by default, the Rnd() function will return the same sequence of pseudo-random numbers each time the program is run. For some purposes (such as statistical studies where repeatability is required) this may be appropriate. For other types of applications, such as games, this may not be appropriate. If a different sequence is required, use the Randomize statement prior to the first call to Rnd(). This will initialize the random number seed by using the system timer. If a different sequence is required but must be repeatable in future, use the syntax Randomize X where X is some specific numeric value.

It is important to recognize that Rnd() returns a new sequence for each component in which it is used; that is, if your main EXE generates one sequence and uses a Visual Basic ActiveX DLL to generate a sequence also, these sequences are independent of one another.
REFERENCES
For additional information about how earlier versions of Microsoft Basic generate pseudo-random numbers, please click the article number below to view the article in the Microsoft Knowledge Base:

28150 RND and RANDOMIZE Alternatives for Generating Random Numbers
Source: http://www.vbforums.com/archive/index.php/t-220878.html
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
#16 Learn to script - Page 2 Empty Re: Learn to script
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Thank you! Very Happy

If you have enought time, can you check at my woodcutting script?
The only one
Show Signature
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
ACTIVATED
ACTIVATED
#17 Learn to script - Page 2 Empty Re: Learn to script
Loading

elisamuelps

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
thanks mr_wiggles i will try it to solve my problem, then i will send one of my edited scripts, so u can see what is bad Smile

also, it is possible to make a script for rmxp that manange to allocate more ram in your proyect? that is beause when rubby manange the memory, i dont know why but it doesnt allow more ram limit, for example 350 mb of ram used, but the main idea is to make it allocate more ram like 500-800 mb if u see the actual commercial pc games have this option id tech have this option to make the game allocate more o less ram depending of your current ram, but also is possible in rmxp?
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#18 Learn to script - Page 2 Empty Re: Learn to script
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Im not sure, i looked online and found nothing about it. However i did find this to be interesting.
http://ruby.about.com/od/tasks/f/benchmark.htm

I know that doing this will set the process to high priority.
Code:

spc = Win32API.new('kernel32','SetPriorityClass',['p', 'i'], 'i')
spc.call(-1, 0x00000080) # High Priority
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#19 Learn to script - Page 2 Empty Re: Learn to script
Loading

elisamuelps

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
the xas anti lag already have this function and this doesn't make the game faster D: it is set to higher priority but the idea is to store more ram, to high priority means that this process in windows will be updated more often that the another process open, (this option is good if u have alot of process in second plane runing on windows) the bad about this is that rmxp doesnt come with source code, so we cant do nothing to fix it from the source, and too we cant make it uses the lastest direcxt and we can´t make it allocate more ram :/ the only way i think is to make a C++ library and attach it to a rgss script
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#20 Learn to script - Page 2 Empty Re: Learn to script
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
You can do that in ruby, tho im not that far along yet, im still learning the WIN32API function.
EVENTALIST
Show Signature
EVENTALIST

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 2 of 4]

Go to page : Previous  1, 2, 3, 4  Next

 

Chatbox system disabled
Personal messaging disabled