3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Slowing Down your ENTIRE SCENE According to Game Simulation (TRY IT NOW) !!  (Read 1562 times)

« on: November 24, 2011, 08:00:36 AM »



Introduction :
Today I Brought to you an Idea that may Help you Slowing down your Entire Game Scene, You might be seen such a Tutorial in The Topic area Like : Dramatic Slowmotion Which made by 'RobertooMolvadoo' , my thanks and Greetings to those whom Presented such an Idea;
but my Project we'll talk about is something Like the Same Idea but sort of advanced to support Every Possible Object in any Normal Scene to be Slowed Gradually According to Your Game Simulation

Description :
The Project Includes a Prototypes Objects to Show how to do this more Clearly with yours;

The Scene we're Talking about Contains :

  • Rotated Sun with Shadows
  • Rotated Sky Represents the background
  • 2 Characters (yours, and CPU) SkinMehsed Supports Jumping, Running, and Other Animations
  • Sound Sources , and Sound Effects
  • Static ,and Dynamic RigidBodies in Order to Move Characters

Of course any Scene won't Leave the Prototypes above, and if you've Realized you would found that most of Objects in the Scene are Containing a move-able Actions;
Now Slowing Control is not according to time , but According to Press\Holding the Left Mouse Button, You can make it anything you wish by Editing the Main Script in the Project , You Can make it Slowing Down according to a Specified Time (Between : from-to) , You Can make it Even Pause by Simply Make the Simulation Value = 0.0f, and All the Scene Will Automatically be Paused (Typically) as if the Simulation Controls the Entire Scene, so in this Project I want you to Consider Simulation as the boss of the Scene :D

BASIC Slow Motion Script : (for Scene Including RigidBodies, SkinMehses\Characters, Sounds)
Code: [Select]
///----------------------------BASIC SLOW-MOTION SCRIPT----------------------------------\\\
float SlowMotionSpeed = 0.02;                          //Control SlowMotion's Speed

float NormalSimulation = 0.016666f;
float NormalFrequency = 44100;
float SimulationSpeed = SlowMotionSpeed;
float Simulation,AnimationSpeed,SoundFrequency;

void Main()
{

///Replace the OBJs and OUTs with yours as Follows to avoid errors
Character        = OBJ_198;

///Defining functions to variables
// Returning the Variable Frequency Simulation to a float Variable "Simulation"
iSimulationFrqSet(Simulation);

// Gathering Animations Speeds (in order of Appearance in your scene) into a one Varaible
OUT_<<AnimationSpeed>> = OUT_<<AnimationSpeed>> = AnimationSpeed;

// Gathering Sounds' Frequencies (in order of Appearance in your scene) into a one Varaible
OUT_<<SoundFrequency>> = OUT_<<SoundFrequency>> = OUT_<<SoundFrequency>> = OUT_<<SoundFrequency>> = SoundFrequency;

// Display Simulation (erase that Group if you wish)
OUT_DisplayedValue = Simulation*60; //display Simulation with int values
OUT_DisplayedValue = Simulation; //exactly display of Simulation

///Intializing Section :
if (iInitializing())
{
Simulation = NormalSimulation;
SoundFrequency = NormalFrequency;
}

///A Small Engine for slowing-down the scene Gradually (Optional)
// if LMB pressed and held, the Scene will slow down (Gradually);
if (iMouseButtonDown(0))
{
//Gradually decreasing
Simulation = iFloatTendTo(Simulation,NormalSimulation,0,SimulationSpeed,0);
SoundFrequency = iFloatTendTo(SoundFrequency,NormalFrequency,0,SimulationSpeed,0);

}
// if LMB released, the Scene will return to its default speed (Gradually)..
//..Represents in the Variables "NormalSimulation" for Physics and "NormalFrequency" for sounds;
else
{
 //Gradually increasing
Simulation = iFloatTendTo(Simulation,0,NormalSimulation,SimulationSpeed,0);
SoundFrequency = iFloatTendTo(SoundFrequency,0,NormalFrequency,SimulationSpeed,0);
}

}

Notice :
  • Replace Variables in the Script with yours;
  • <<AnimationSpeed>> Represents every Animation Speed Output for your SkinMeshes;
  • <<SoundFrequencies>> Represents every Sound Frequency Output for your Sounds;

ADVANCED Slow Motion Script : (for Scene Including RigidBodies, SkinMehses\Characters, Sounds, Rotated Sun and Background)
Code: [Select]
///----------------------------ADVANCED SLOW-MOTION SCRIPT----------------------------------\\\
float SlowMotionSpeed = 0.02;                          //Control SlowMotion's Speed

float NormalSimulation = 0.016666f;
float NormalFrequency = 44100;
float MaxRotateSpeed = SlowMotionSpeed;               //here where you can Return the Max Sun Rotation Speed
float SimulationSpeed = SlowMotionSpeed;
float Simulation,AnimationSpeed,SoundFrequency;
float sx,sy,sz,bx,by,bz,cx,cy,cz;
float SunRotate,BackgroundRotate;
int Sun,Background,Character;
Quaternion SunOrientation,BackgrounOrientation;

void Main()
{

///Replace the OBJs and OUTs with yours as Follows to avoid errors
Sun              = OBJ_110;
Background       = OBJ_176;
Character        = OBJ_198;

///Defining functions to variables
// Returning the Variable Frequency Simulation to a float Variable "Simulation"
iSimulationFrqSet(Simulation);

// Gathering Animations Speeds (in order of Appearance in your scene) into a one Varaible
OUT_1 = OUT_23 = AnimationSpeed;

// Gathering Sounds' Frequencies (in order of Appearance in your scene) into a one Varaible
OUT_44 = OUT_66 = OUT_88 = OUT_352 = SoundFrequency;

// Set the Speciefied Orientation Object to a Rotate Angles
iObjectOrientationSet(Sun,SunOrientation);
iObjectOrientationSet(Background,BackgrounOrientation);
iQuaternionFromEulerAngles(SunOrientation,sx,sy,sz,"xyz");
iQuaternionFromEulerAngles(BackgrounOrientation,bx,by,bz,"xyz");

// Continues Rotate
sx += SunRotate;
by += BackgroundRotate;

// Display Simulation
OUT_220 = Simulation*60; //display Simulation with int values
OUT_264 = Simulation; //exactly display of Simulation

///Converting Variables According to Simulation
//Animations' Speed according to Simulation
AnimationSpeed   = iFloatInterpolate(Simulation,0,NormalSimulation,0.0,250,true);

//Sounds' frequency according to Simulation
SoundFrequency   = iFloatInterpolate(Simulation,0,NormalSimulation,0,NormalFrequency,true);

//Specified Orientation According to Simulation
BackgroundRotate = iFloatInterpolate(Simulation,0,NormalSimulation,0.0,MaxRotateSpeed,true);
SunRotate        = iFloatInterpolate(Simulation,0,NormalSimulation,0.0,MaxRotateSpeed,true);


///Intializing Section :
if (iInitializing())
{
Simulation = NormalSimulation;
SoundFrequency = NormalFrequency;
//this is just an Exceptional Case for My Meshes' Orientations' Coordinates:
sx = bx = -90;
}
//Reset Sun at every 100ْ Rotation
if (sx >= 100)
{
sx = -90;
}
///A Small Engine for slowing-down the scene Gradually (Optional)
// if LMB pressed and held, the Scene will slow down (Gradually);
if (iMouseButtonDown(0))
{
//Gradually decreasing
Simulation = iFloatTendTo(Simulation,NormalSimulation,0,SimulationSpeed,0);
SoundFrequency = iFloatTendTo(SoundFrequency,NormalFrequency,0,SimulationSpeed,0);

}
// if LMB released, the Scene will return to its default speed (Gradually)..
//..Represents in the Variables "NormalSimulation" for Physics and "NormalFrequency" for sounds;
else
{
 //Gradually increasing
Simulation = iFloatTendTo(Simulation,0,NormalSimulation,SimulationSpeed,0);
SoundFrequency = iFloatTendTo(SoundFrequency,0,NormalFrequency,SimulationSpeed,0);
}

}

Notice :
To See how to Create a Spin-Able Sun and Background Check this Topic out :
http://www.3drad.com/forum/index.php?topic=7409.msg58765#msg58765


I Won't Bother You with Details , Download , and See your Self .. (if you wish Edit it to fit your Project, but Becareful not to Corrupt it)
non-compiled Version : v7.22 only soon there will be for v7.12
http://www.mediafire.com/?jynxcjadwrl3e3j

Compiled Version :
in the Attachments below;
« Last Edit: November 29, 2011, 02:45:40 PM by omarkronos »
« Reply #1 on: November 26, 2011, 03:36:19 AM »
OMG! THIS IS AWESOME! pure awesomness :)
::=::Look at this ::=::
Rally game

The most important thing that happens, you usualy miss it , but after sometime you will remember
 
even if you didint noticed. Go forward and never look back
« Reply #2 on: November 26, 2011, 07:58:16 AM »
OMG! THIS IS AWESOME! pure awesomness :)

Glad I Helped ;you can replace all the Objects in the Scene with yours :
SoundEffects, SoundSources, Animated SkinMeshes, RigidBodies, and Characters
and Enjoy Your Customize  ;)
« Reply #3 on: November 26, 2011, 07:59:36 AM »
will it be able to be in 7.12 or 7.03? :)
::=::Look at this ::=::
Rally game

The most important thing that happens, you usualy miss it , but after sometime you will remember
 
even if you didint noticed. Go forward and never look back

jestermon

« Reply #4 on: November 26, 2011, 08:10:44 AM »
Finally got a chance to look at this. Great fun, and well put together. Nice work omarkronos.
« Reply #5 on: November 26, 2011, 08:14:43 AM »
will it be able to be in 7.12 or 7.03? :)

Yes  ??? .. You have a Problems Editing it , or an Error has Occurred or something ?
« Reply #6 on: November 26, 2011, 08:20:22 AM »
Finally got a chance to look at this. Great fun, and well put together. Nice work omarkronos.

My Thanks and Greetings Jestermoon , I was Commenting on your Last Topic while You Sent me Your Comment :D
Real awesome work , I Love such a games
« Last Edit: November 26, 2011, 12:37:28 PM by omarkronos »
« Reply #7 on: November 29, 2011, 08:44:57 AM »
i have problesm loading it pops up error message every single time
« Last Edit: November 29, 2011, 09:20:19 AM by jestermon »
::=::Look at this ::=::
Rally game

The most important thing that happens, you usualy miss it , but after sometime you will remember
 
even if you didint noticed. Go forward and never look back
« Reply #8 on: November 29, 2011, 11:50:32 AM »
i have problesm loading it pops up error message every single time

What Version you're using ? Because I am using 7.22 !
does the error message from the Partition file or from the Game it self ?
have you replaced every specified folder in its place in your 3drad folder ? even the Sounds ?

if still there will be errors

I am compiling it right now dude ..  ;)
« Last Edit: November 29, 2011, 01:39:17 PM by omarkronos »
« Reply #9 on: November 29, 2011, 01:41:39 PM »
i have problesm loading it pops up error message every single time

I've Installed 7.12 and Tried to Open the Project by it , an Error message pop up as you said .. tried to merge it didn't work also
So I'll Compile it Right now .. and I am working on Converting it to 7.12

sorry for this Mistake man

edit:
Compiled Version Released

edit:
SlowMotion's Scripts Released Separate
« Last Edit: November 30, 2011, 06:04:26 AM by omarkronos »
« Reply #10 on: November 30, 2011, 10:53:47 AM »
ok i will wait for the compiled version (if you did it already you forgot the file ;) )
::=::Look at this ::=::
Rally game

The most important thing that happens, you usualy miss it , but after sometime you will remember
 
even if you didint noticed. Go forward and never look back
« Reply #11 on: November 30, 2011, 11:29:42 AM »
ok i will wait for the compiled version (if you did it already you forgot the file ;) )

!!! the Compiled version is Already in the Attachments dude  :)
« Last Edit: November 30, 2011, 11:32:12 AM by omarkronos »
« Reply #12 on: November 30, 2011, 01:49:01 PM »
oh above :D stupid me :D
::=::Look at this ::=::
Rally game

The most important thing that happens, you usualy miss it , but after sometime you will remember
 
even if you didint noticed. Go forward and never look back
Pages: [1]