Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (TipmyPip, izorro), 556 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: collision problem after 6.40.5 update [Re: ulillillia] #80700
07/17/06 19:02
07/17/06 19:02
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
But i have always the frame rate between 58 a 60 in fullscreen mode, thats what statistics panel says. BTW, what have you done to workaround this issue ulillillia?

Re: collision problem after 6.40.5 update [Re: demiGod] #80701
07/17/06 21:30
07/17/06 21:30
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
The issue involves fps_max in windowed mode. The jerkiness increases in fullscreen mode. I haven't done anything with collision at all yet, however. For 32 fps, SRV is 31.3 ms at most (assuming the others are at zeros). With entities, blocks, and other objects being rendered, SRV will go down while the others go up still keeping the 32 fps. As to using gravity higher than the -421, use your own gravity code instead.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: collision problem after 6.40.5 update [Re: ulillillia] #80702
07/17/06 22:47
07/17/06 22:47
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
A LOT depends on the size of your model too, your ball is too small to act properly at high speeds. That's why it a. doesn't bounce (the bigger ball does, I've tested it) and b. it's getting stuck in the wall. Try to scale it like at least 3 times as big. Even better results with high speeds when the model is 6 times as large as yours.

I've also changed some values in your code, not so sure though if any of that has fixed it. I've only scaled up your model at the very end of trying a few things out.
Not that it matters, but I would say set the gravity in the main function.

Code:

////////////////////////////////////////////////////////////////////////
// A6 main wdl:
// Created by WED.
////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////
// The PATH keyword gives directories where template files can be found.
//path "C:\\Programas\\GStudio6\\template_6"; // Path to A6 templates directory
//path "C:\\Programas\\GStudio6\\template_6\\code"; // Path to A6 template code subdirectory
//path "C:\\Programas\\GStudio6\\template_6\\images"; // Path to A6 template image subdirectory
//path "C:\\Programas\\GStudio6\\template_6\\sounds"; // Path to A6 template sound subdirectory
//path "C:\\Programas\\GStudio6\\template_6\\models"; // Path to A6 template model subdirectory

/////////////////////////////////////////////////////////////////
// Filename of the starting level.
string level_str = <testBallPhysics.WMB>; // give file names in angular brackets

////////////////////////////////////////////////////////////////////////////
// Included files
//include <gid01.wdl>; // global ids
//include <display00.wdl>; // basic display settings

var d3d_triplebuffer = 0;
var video_mode = 9; // screen size 640x480
var video_depth = 32; // 16 bit colour D3D mode
var video_screen = 1;



/////////////////////////////////////////////////////////////////
// Desc: The main() function is started at game start
function main()
{

time_smooth = 0;
fps_max=60;
fps_min=20;
fps_lock = on;
ph_fps_max_lock = fps_max;
// set some common flags and variables
// freeze all entity functions
freeze_mode = 1;
// no level has been loaded yet...
//gid01_level_state = gid01_level_not_loaded;

// entry: Warning Level (0,1, or 2)
// entry_help: Sets sensitivity to warnings (0 = none, 1 = some, 2 = all).
warn_level = 2; // announce bad texture sizes and bad wdl code


// entry: Starting Mouse Mode (0, 1, or 2)
mouse_mode = 0;

// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);

// now load the level
level_load(level_str);

wait(2); // let level load
// level should be loaded at this point...
//gid01_level_state = gid01_level_loaded;

//+++ load starting values


// un-freeze the game
freeze_mode = 0;

// save start of game here
wait(6); // allow time for functions that wait for "gid01_level_loaded" to load
file_delete("start0.SAV"); // remove any old savefile
wait(1);
if( game_save("start",0,SV_ALL) <= 0)
{
diag("\nWARNING! main - Cannot save 'start' of level (ignore on restarts).");
}
else
{
diag("\nWDL: main - Game 'start' saved.");
}


// main game loop
/*while(1)
{
if(gid01_level_state != gid01_level_loaded)
{
freeze_mode = 1; // pause the game
while(gid01_level_state != gid01_level_loaded) { wait(1); }
freeze_mode = 0; // resume the game
}
wait(1);
}*/
ph_setgravity(vector(0,0,-422));
}


// Desc: this is the function used to restart the game.
function main_restart_game()
{
// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);

// freeze the game
freeze_mode = 1;

if( game_load("start",0) <= 0)
{
diag("\nWARNING! main_restart_game - Cannot load 'start' of level.");
}
else
{
diag("\nWDL: main_restart_game - Game 'start' loaded");
}

// un-freeze the game
freeze_mode = 0;
}


// Desc: this is the function used to quit the game.
function main_quit()
{
//+++ // save global skills & strings
exit;
}

/////////////////////////////////////////////////////////////////
// The following definitions are for the pro edition window composer
// to define the start and exit window of the application.
WINDOW WINSTART
{
TITLE "3D GameStudio";
SIZE 480,320;
MODE IMAGE; //STANDARD;
BG_COLOR RGB(240,240,240);
FRAME FTYP1,0,0,480,320;
// BUTTON BUTTON_START,SYS_DEFAULT,"Start",400,288,72,24;
BUTTON BUTTON_QUIT,SYS_DEFAULT,"Abort",400,288,72,24;
TEXT_STDOUT "Arial",RGB(0,0,0),10,10,460,280;
}

/* no exit window at all..
WINDOW WINEND
{
TITLE "Finished";
SIZE 540,320;
MODE STANDARD;
BG_COLOR RGB(0,0,0);
TEXT_STDOUT "",RGB(255,40,40),10,20,520,270;

SET FONT "",RGB(0,255,255);
TEXT "Any key to exit",10,270;
}*/


/////////////////////////////////////////////////////////////////
//INCLUDE <debug.wdl>;




/////////////////////////////////////////////////////////////////

//***


entity* ball;

//pretend to be a soccer ball physics...
action fisicaBola
{
wait(1);
ball = my;
my.bright = on;
my.ambient = -50;
my.albedo = -50;
my.shadow=on;

phent_settype(Ball,PH_RIGID,PH_SPHERE);
phent_setmass(Ball,1.0,PH_SPHERE);
phent_setfriction(Ball,30.0);
phent_setelasticity(Ball,75.0,100.0);

ph_setcontacts(vector(100000, 0,0), 0,0,0);

phent_setdamping(Ball,30.0,5.0);
phent_addvelcentral(Ball,vector(2,2,0));
//*** doesn´t bounce



while(1)
{
camera.x = my.x - 1500;
camera.y = my.y;
camera.tilt = -35;
camera.z = 1000;
camera.arc = 20;

wait(1);
}

}

function applyBallSpeed()
{
phent_addvelcentral(Ball,vector(500,0,150));
}

on_f=applyBallSpeed;



Like highlighted in red, you didn't use marco's advice in the code.

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: collision problem after 6.40.5 update [Re: PHeMoX] #80703
07/17/06 23:33
07/17/06 23:33
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Hi Phemox, thank you very much for your reply.
Well, i think i must agree with you. I already had tried with a scaled up ball model and the result was much better, however, i never tought i needed scale up all my level where i´m working on (such a hard work!), because this problem didn´t existed in 6.31.4 version with a ball model at exact same scale and at high speeds.
And btw, i´ve tried ph_setcontacts and the problem is the same, but like jcl said now i´m not using it. See please http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/670300/an/0/page/0#Post670300
If this is the answer for the problem, i have a hard update to do, if i want to use version 6.40.5 now...

Re: collision problem after 6.40.5 update [Re: demiGod] #80704
07/17/06 23:54
07/17/06 23:54
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
No problem at all.

I think I've read somewhere that the forces and it's corresponding collision might have different effects in A6.40.x. Did you notice an increase of overall speed of the ball in your game in progress? Normally only very high speeds will get you into trouble.

Maybe also try lowering your small ball model's z height and lower the gravity force (not 0,0,-400 or something, but 0,0,-280 or something), I haven't tested this, but normally this would mean a less fast falling down from the little ball I think.

Anyways, for more reliable results though, it's probably best to increase the overall size of your level.

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: collision problem after 6.40.5 update [Re: PHeMoX] #80705
07/18/06 11:25
07/18/06 11:25
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
Also, be sure not to change the time variables without knowing what they do. Your time settings are all wrong. For instance, setting fps_lock causes your game to run at a random speed, depending on the target PC. Such settings are for testing or for special purposes only.

- Thanks for the hint with the size. I'll add this to the manual.

Re: collision problem after 6.40.5 update [Re: jcl] #80706
07/18/06 16:13
07/18/06 16:13
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Hi, jcl
I´m sorry to insist on this, but the time settings we are talking about i saw them in the forum and without them the ball physics has "explosions", in window mode it appears some kind of tearing and in fullscreen mode the movement its jerky. With time_smooth = 0 and fps_lock = on, the framerate never exceeds the monitor refresh rate (max 70 fps), but the ball physics "seems" to be rigth.

Just ask you one more thing, since these time settings are wrong, what settings should i use please?
Thanks in advance.

Re: collision problem after 6.40.5 update [Re: demiGod] #80707
07/18/06 16:52
07/18/06 16:52
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
That was probably for 6.31. In 6.31, the physics frame rate needed to be a multiple of the game frame rate. Not anymore with 6.40, which synchronizes physics automatically.

Leave all settings at their default positions, - wich means, delete those lines in your code - increase the ball size, and use the precise settings and functions from the ball example in the manual. We've made several ball examples and I never heard about any problems on any PC of the beta testers.

If it then still does not work, upload the modified version - I'll then look at it again. I'll need the configuration of your PC, then.

Re: collision problem after 6.40.5 update [Re: jcl] #80708
07/18/06 20:14
07/18/06 20:14
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Well, now i think the problem is solved:

a) I´ve increased the ball size (about scale up 6 times) and applied a high velocity, the collision seems to be good, even the ball stays stucked when apply a "very high" velocity, which i "think" this velocity will exceed a max_speed to be implemented, because i need to scale up all my level and objects though;

b) About the time settings: without that code, now i don´t have anymore the tearing or jerky problem like in 6.31.4 version. In fullscreen mode i have fps 75, which is the max monitor refresh rate, and in window mode i have up to fps 220;

c) Now i think i must find and adapt the correct physics settings / properties for the ball, considering a soccer ball correct behaviour.

Thank you very much all of you who helped me solving this question.

Cheers.

Page 2 of 2 1 2

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1