Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,631 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
AUM 50 destructable terrain #180714
01/29/08 20:23
01/29/08 20:23
Joined: Oct 2003
Posts: 2,194
Saturn
Metal_Thrasher Offline OP
Expert
Metal_Thrasher  Offline OP
Expert

Joined: Oct 2003
Posts: 2,194
Saturn
AUM 50s desctructable terrain code works when I downloaded it and ran it as was compiled in the download, but if I copy the code and use it in my own level even using the same terrain as given in the download the code is messed up. like it isnt destroyed where I shoot it. It'll pick certain, placed to deform instead. Help?


-Johnny Thrash
Re: AUM 50 destructable terrain [Re: Metal_Thrasher] #180715
01/30/08 10:01
01/30/08 10:01
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Are you using my code to deform the terrain?

Re: AUM 50 destructable terrain [Re: George] #180716
01/30/08 20:09
01/30/08 20:09
Joined: Oct 2003
Posts: 2,194
Saturn
Metal_Thrasher Offline OP
Expert
Metal_Thrasher  Offline OP
Expert

Joined: Oct 2003
Posts: 2,194
Saturn
yes


-Johnny Thrash
Re: AUM 50 destructable terrain [Re: Metal_Thrasher] #180717
01/31/08 15:04
01/31/08 15:04
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
So you have my code and my terrain. What other code are you using?

Re: AUM 50 destructable terrain [Re: George] #180718
01/31/08 19:35
01/31/08 19:35
Joined: Oct 2003
Posts: 2,194
Saturn
Metal_Thrasher Offline OP
Expert
Metal_Thrasher  Offline OP
Expert

Joined: Oct 2003
Posts: 2,194
Saturn
That's all of the code I'm using

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

var vertex_dist[1090];
var hit_coords;
var rocket_speed;

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

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

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

var terrain_chunk = 0;



/////////////////////////////////////////////////////////////////
// Desc: The main() function is started at game start
function main()
{
enable_mouse = ON;
mouse_pointer = 2;
// 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);
}

}


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


/////////////////////Deform Terrain Test Code//////////////////////
//////////////////////////////////////////////////////////////////////////

sound shockwave_wav = <shockwave.wav>;
sound rocket_wav = <rocket.wav>;

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

bmap cross_pcx = <cross.pcx>;

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

entity* rocket1;
entity* terrain1;

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




string rocket_mdl = <rocket.mdl>;
string explosion_pcx = <explo+6.pcx>;

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

function create_crate();
function deform(vertex_number);
function players_bullet();
function move_players_bullet();
function remove_bullet();
function explosion_sprite();

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

panel cross_pan
{
bmap = cross_pcx;
pos_x = 393;
pos_y = 293;
layer = 15;
flags = overlay, refresh, visible;
}

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


action terrain
{
terrain1 = my; // used by vec_for_mesh and vec_to_mesh
my.enable_impact = on; // triggers events if it is hit by rockets
my.event = create_crate;
}

function create_crate()
{
if (you.skill40 != 12345) // not a rocket?
{
return; // then get out of here
}
vec_set (hit_coords, rocket1.x); // store rocket's coords before they get lost
wait (1);
my.skill1 = 1; // set the index to 1
my.skill2 = 50000; // set a huge distance at first; skill2 will get smaller and smaller for the vertices that are closer and closer to the explosion
while (my.skill1 < 1090) // go through all the vertices (1...1089) on the 33x33 grid (not using vertex_dist[0])
{
vec_for_mesh (temp, terrain1, my.skill1); // sets temp to vertex1, 2, 3...
vertex_dist [my.skill1] = vec_dist (hit_coords.x, temp.x); // measures the distance between temp (vertex1, 2, 3...) and hit_coords
if (vertex_dist[my.skill1] < my.skill2) // this vertex is closer than the others?
{
my.skill2 = vertex_dist[my.skill1]; // then it might be the one, so store the distance
my.skill3 = my.skill1; // and its index as well
}
my.skill1 += 1; // move on to the following vertex
}
deform (my.skill3);
}

function deform(vertex_number)
{
vec_for_mesh(temp, terrain1, vertex_number);
vec_scale (temp, 0.7);
vec_to_mesh (temp, terrain1, vertex_number);
ent_fixnormals (my, my.frame); // recalculate the normal vectors, not really needed
c_updatehull(my,10);
}

action player_1st
{
my.invisible = on; // no need to see the player model in 1st person view
while (1)
{
my.skill1 = 3 * (key_w - key_s) * time; // move with w / s
my.skill2 = 2 * (key_a - key_d) * time; // strafe with a / d
vec_set (temp, my.x);
temp.z -= 1000;
trace_mode = ignore_me + ignore_passable + use_box;
my.skill3 = -trace (my.x, temp);
my.pan -= 3 * mouse_force.x;
my.tilt += 3 * mouse_force.y;
if (mouse_left == 1)
{
players_bullet();
}
move_mode = ignore_passable + ignore_passents + glide;
ent_move(my.skill1, nullvector);
wait (1);
camera.x = my.x;
camera.y = my.y;
camera.z = my.z + 30;
camera.pan = my.pan;
camera.tilt = my.tilt;
}
}

function players_bullet()
{
proc_kill(4); // only one instance of this function should run
if (rocket1 != null) {return;} // don't allow more than 1 rocket to be fired at a certain moment
while (mouse_left == 1) {wait (1);} // disable auto fire
snd_play (rocket_wav, 50, 0);
rocket1 = ent_create (rocket_mdl, camera.x, move_players_bullet);
}

function move_players_bullet()
{
var distance_covered = 0;
my.pan = you.pan; // the bullet and the player have the same pan angle
my.tilt = you.tilt; // and tilt angle
my.enable_entity = on; // the bullet is sensitive to other entities
my.enable_impact = on;
my.enable_block = on; // and to level blocks
my.event = remove_bullet;
my.skill2 = 0;
my.skill3 = 0;
my.skill40 = 12345; // unique identifier for the rocket
while (my.invisible == off)
{
my.skill1 = 30 * time; // bullet speed
move_mode = ignore_you + ignore_passable;
distance_covered += ent_move (my.skill1, nullvector);
if (distance_covered > 100)
{
my.skill3 -= 1 * time;
}
wait (1);
}
}

function remove_bullet()
{
beep();
my.invisible = on;
my.passable = on;
ent_playsound (my, shockwave_wav, 200);
//ent_create(explosion_pcx, my.pos, explosion_sprite);
wait (1);
ent_remove (me);
}

function explosion_sprite()
{
wait (1);
my.scale_x = 1.5;
my.scale_y = my.scale_x;
my.passable = on;
my.flare = on;
my.bright = on;
my.ambient = 100;
while (my.frame < 7)
{
my.frame += 1 * time;
wait (1);
}
ent_remove (my);
}




-Johnny Thrash
Re: AUM 50 destructable terrain [Re: Metal_Thrasher] #180719
01/31/08 21:25
01/31/08 21:25
Joined: Oct 2003
Posts: 2,194
Saturn
Metal_Thrasher Offline OP
Expert
Metal_Thrasher  Offline OP
Expert

Joined: Oct 2003
Posts: 2,194
Saturn
PS: If It's useful at all I commented out the create for the explosion sprite, cause it was giving me an error.


-Johnny Thrash
Re: AUM 50 destructable terrain [Re: Metal_Thrasher] #180720
02/04/08 04:12
02/04/08 04:12
Joined: Oct 2003
Posts: 2,194
Saturn
Metal_Thrasher Offline OP
Expert
Metal_Thrasher  Offline OP
Expert

Joined: Oct 2003
Posts: 2,194
Saturn
George, Anyone? Sorry, I just was really hoping somebody might have some kind of answer for this =/


-Johnny Thrash
Re: AUM 50 destructable terrain [Re: Metal_Thrasher] #180721
02/04/08 07:37
02/04/08 07:37
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
I remember this scipt and similar probs I was having but thanks to the 'Master' who made it all possible, I found the answer was in ensuring the terrain was not scaled at all and that the proper amount of vetices were calculated as described in the article if I made larger terrains (66 x 66, 99 x 99).

I even made a working test scenario demo out of it and put it up for others to draw examples from, I was so proud I had got it all right .
Now I use Georges code base exclusively as it works and the comments make it easy for me to gain insight and understanding though I am still a long way away from being a programmer.

Now days, I try to version control all my derivatives but sometimes I am in so much of a hurry that I forget but this should still be the way code is reused, with the proper credits given at the start of the code series and commented editing along every change made before making public, something we all need to keep in mind, myself especially.
Usefull examples can be found in Dougs Templates series where commenting and version control can be easily seen.

George is my inspiration, the programmer who got me into programming thru the wonderful AUM series and the kind help given even though the man was over worked and busy, busy, busy.

So please take the time to read the article carefully, you will find the solution then

Hope this helps in more ways than one...

Re: AUM 50 destructable terrain [Re: Metal_Thrasher] #180722
02/04/08 13:32
02/04/08 13:32
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Sorry for the delay; sometimes I don't visit the forum during the weekends. Anyway, Nems has given the best advice; the problems can appear if the terrain doesn't have the exact size with the one from my demo.

Re: AUM 50 destructable terrain [Re: George] #180723
02/05/08 01:32
02/05/08 01:32
Joined: Oct 2003
Posts: 2,194
Saturn
Metal_Thrasher Offline OP
Expert
Metal_Thrasher  Offline OP
Expert

Joined: Oct 2003
Posts: 2,194
Saturn
To Nems: I tried your suggestions...but the problem remains the same. Thanks for trying though

To George: I even tried using your terrain from the demo. No differance.

Any other possible ideas?


-Johnny Thrash
Page 1 of 2 1 2

Moderated by  George 

Gamestudio download | 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