Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,526 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 3
Page 1 of 2 1 2
simple ROPE PHYSICS #62562
01/21/06 18:03
01/21/06 18:03

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Here's a free script on applying physics to a rope through c-script, no professional or commercial edition required, it just uses the laws of mathematics.

OOOOOOOOOOOCLICK HERE TO DOWNLOAD THE VERY SMALL ROPE PHYSICS DEMO!OOOOOOOOOO
Here's a screenshot:


Here's the code for the whole demo:
Code:


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

path "Data";
/////////////////////////////////////////////////////////////////
// Filename of the starting level.
string rope_wmb = <ROPE.WMB>; // give file names in angular brackets

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


bind <burst.tga>;bind <axis.tga>;bind <temp.mdl>;bind <sphere.mdl>;


/////////////////////////////////////////////////////////////////
// Desc: The main() function is started at game start
function main()
{
// 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(rope_wmb);

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

//+++ load starting values

freeze_mode = 0;

// 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);
}

}



/////////////////////////////////////////////////////////////////
// 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>;


var tester=0;bmap axis=<axis.tga>;bmap burst = <burst.tga>;
entity* rope0;entity* rope1;entity* rope2;entity* rope3;entity* rope4;entity* rope5;
font standard_font = <font1020.bmp>,10,20;var gravity=9;var spacing=40;
string gravi="space to morph objects\nright click for camera rotation\nmouse wheel to zoom\nleft/right arrows for spacing\nleftclick for up/down movement\n\n\n\n\n\n\n\n\nGRAVITY (M/S)\n(up/down arrow\nto change)";
text grav{pos_x=10;pos_y=0;font=standard_font;string=gravi;flags=visible;}
panel debugger{pos_x=0;pos_y=0;flags=visible;
digits=50,320,4,standard_font,-1,gravity;
digits=70,480,4,standard_font,1,rope0.x;
digits=70,500,4,standard_font,1,rope0.y;}
panel debugger2{pos_x=0;pos_y=0;flags=visible;bmap = burst;}
panel debugger3{pos_x=0;pos_y=400;flags=visible;bmap = axis;}

//for multiple of the same

function roper1(){rope0.skill1-=spacing;my.light=on;my.ambient=-100;
if(rope0.skill1>-3000){ent_create("temp.mdl",vector(0,0,rope0.skill1),roper1);}
my.pan=my.z/10;
while(1){
if(rope0.skill50!=my.skill50){if(rope0.skill50==1){ent_morph(my,"sphere.mdl");
my.skill50=rope0.skill50;}else{ent_morph(my,"temp.mdl");my.skill50=rope0.skill50;}}
my.pan+=10*time;
my.red=126*cos(my.z-total_ticks*7)+126;my.green=126*cos(my.z-120-total_ticks*7)+126;
my.blue=126*cos(my.z-240-total_ticks*7)+126;
vec_diff(my.skill1,my.x,you.x);vec_to_angle(my.skill4,my.skill1);//find the angle between the object closer to the rope end and this one
if(my.skill5>-90+gravity/1.5){my.skill5-=5*gravity*time;}vec_for_angle(my.skill1,my.skill4);//allow gravitational change of object
//depending on object closer to rope end by decreasing its euler tilt in
//relationship to the higher object
vec_normalize(my.skill1,spacing);vec_add(my.skill1,you.x);vec_set(my.x,my.skill1);//keep the object the same distance
//away from the next object closer to the rope end to prevent stretch of rope
//because of movement
wait(1);}
}
action roper{my.passable=on;rope0=me;
ent_create("temp.mdl",vector(0,0,my.skill1),roper1);wait(30);
while(1){
if(mouse_left==off){
my.x+=mickey.x*2;my.y-=mickey.y*2;}else{
my.x+=mickey.x*3;my.z-=mickey.y*3;}
//my.x=clamp(my.x,-400,400);my.y=clamp(my.y,-400,400);

if(my.x>=-400 && my.x<=400){debugger2.pos_x=my.x/5+100-(16);}
if(my.y>=-400 && my.y<=400){debugger2.pos_y=-my.y/5+500-(16);}
if(key_cuu==on){gravity+=time;}if(key_cud==on){gravity-=time;}
if(key_cur==on){spacing+=3*time;}if(key_cul==on){spacing-=3*time;}
spacing=clamp(spacing,10,5000000);//set spacing to 1 for springiness!
wait(1);}}


function morfob(){if(rope0.skill50==1){rope0.skill50=0;
ent_morph(rope0,"temp.mdl");}else{rope0.skill50=1;ent_morph(rope0,"sphere.mdl");}}
on_space=morfob;

action light{my.invisible=on;my.passable=on;my.lightrange=2000;
my.skill2=30;my.skill1=-97;
my.skill7=900;//zoom
while(1){
my.red=126+126*cos(total_ticks*5);my.green=126+126*cos(total_ticks*5-120);
my.blue=126+126*cos(total_ticks*5-240);

my.skill7-=mickey.z/2;
if(mouse_right==on){my.skill1+=mickey.x/3;my.skill2-=mickey.y/3;
my.skill2=clamp(my.skill2,-89,89);}
vec_for_angle(my.skill4,my.skill1);vec_normalize(my.skill4,my.skill7);
vec_set(camera.x,my.skill4);vec_set(my.skill4,camera.x);
vec_inverse(my.skill4);vec_to_angle(camera.pan,my.skill4);
wait(1);}
}







Have fun!

Look forward to cloth and paper examples coming soon!

Re: simple ROPE PHYSICS [Re: ] #62563
01/21/06 20:42
01/21/06 20:42
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Fantastic!

What about an air-snake-game!

Re: simple ROPE PHYSICS [Re: Pappenheimer] #62564
01/21/06 21:05
01/21/06 21:05
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Yeah, thatīs a real behavior!
Itīs very impressive to play around with it..


no science involved
Re: simple ROPE PHYSICS [Re: fogman] #62565
01/21/06 21:19
01/21/06 21:19
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline
Expert
XNASorcerer  Offline
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
Trojan horse Dropper.Generic.JT Detected!!!!

Re: simple ROPE PHYSICS [Re: XNASorcerer] #62566
01/21/06 21:22
01/21/06 21:22
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
I think he has packed the exe with nacasi...
This is a known problem of nacasi (or with the scanners), but itīs not a trojan horse!


no science involved
Re: simple ROPE PHYSICS [Re: fogman] #62567
01/22/06 01:06
01/22/06 01:06

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Thanks fogman and Pappenheimer,
Yes I did pack it with Nacasi, but you can
CLICK HERE TO DOWNLOAD THE ZIPPED VERSION OF THE SIMPLE ROPE PHYSICS EXAMPLE THAT WAS NOT PACKED WITH NACASI!

Re: simple ROPE PHYSICS [Re: ] #62568
01/22/06 02:47
01/22/06 02:47
Joined: Oct 2003
Posts: 2,628
IL,US
FeiHongJr Offline
Expert
FeiHongJr  Offline
Expert

Joined: Oct 2003
Posts: 2,628
IL,US
Very cool, Sure will be lookin forward to more from you Excellent work I like the way it looks when you go into the minus gravity Could you imagine seeing this if you were on acid lol


http://www.freewebs.com/otama_syndicate/index.htm - Each master to his own technique.

- Not me said the bee, Nor I said the fly.
Re: simple ROPE PHYSICS [Re: FeiHongJr] #62569
01/22/06 05:26
01/22/06 05:26
Joined: Nov 2004
Posts: 862
Australia
DavidLancaster Offline
User
DavidLancaster  Offline
User

Joined: Nov 2004
Posts: 862
Australia
Nice scripting work wing, that was a fun demo!

Re: simple ROPE PHYSICS [Re: ] #62570
01/22/06 15:00
01/22/06 15:00
Joined: Mar 2005
Posts: 969
ch
Loopix Offline
User
Loopix  Offline
User

Joined: Mar 2005
Posts: 969
ch
Very nice script! This applied on a big scary dragon-like snake...whoooo

Re: simple ROPE PHYSICS [Re: Loopix] #62571
01/22/06 19:12
01/22/06 19:12
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
WING, as you are looking for paid work, wouldn't it be an idea to add some features to this rope and sell the code?

Features for instance:

- make the rope of small columns which are turned relating to their position within the curve of the rope - to make it look more like a real rope
- or, perhaps better or as an additional option for a user, make the parts invisible and attach each part to some vertices of a rope model
- give a player entity the option to grap it, to swing with it, and to climb it up
- with an easy way to integrate it into the templates or whatever with accustomizable values...

Page 1 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

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