Tanks - terrain question

Non-platform specific questions.

Tanks - terrain question

Postby Camper1995 » Mon Jul 20, 2009 5:14 pm

Hi all, I just wanna know If can I make with Game Editor terrain like in this game,

So when the game start, computer will random generate the terrain and when you fire and the shot hit the terrain,
it will make hole in to it... Is this possible with GE?

http://www.webgames.cz/tanks/289-1/

Thank you,

CAmPeR. :)
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Tanks - terrain question

Postby Fuzzy » Mon Jul 20, 2009 8:43 pm

Its possible. Its not trivial but i did it a few years ago. I dont have the ged any more.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Tanks - terrain question

Postby Bee-Ant » Tue Jul 21, 2009 5:49 am

Its very possible and easy enough :P
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tanks - terrain question

Postby Camper1995 » Tue Jul 21, 2009 12:03 pm

Well, can you tell me how to do this please? :) thx
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Tanks - terrain question

Postby Bee-Ant » Tue Jul 21, 2009 3:24 pm

The first way,use the "load map from external file" system.there's a demo at Game Demos section.
Then,make some different maps for different terrain.
Finally,use a random variable to load the map randomly :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tanks - terrain question

Postby Camper1995 » Tue Jul 21, 2009 6:15 pm

Yea, but how to do when the shot hit the terrain make the hole in that terrain.

Thx
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Tanks - terrain question

Postby skydereign » Tue Jul 21, 2009 9:16 pm

If you notice in that demo you gave, the holes were set in animation. So if you are doing what Bee-Ant suggested, then you should just have a collision event. Upon collision with the destroying object, increase the animpos, or change animation, so it is more beat up looking. Eventually the terrain will get destroyed, just like the game.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Tanks - terrain question

Postby Bee-Ant » Wed Jul 22, 2009 1:49 am

skydereign wrote:If you notice in that demo you gave, the holes were set in animation. So if you are doing what Bee-Ant suggested, then you should just have a collision event. Upon collision with the destroying object, increase the animpos, or change animation, so it is more beat up looking. Eventually the terrain will get destroyed, just like the game.

Thats right, set the animation direction of all terrain sprites to be stopped. And set the animation from the most intact to the most broken. And then you just increase the collide.animpos anytime your bullet collide with the terrain.
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tanks - terrain question

Postby Camper1995 » Wed Jul 22, 2009 11:31 am

Ok, but I was searching and I cant found where is that most intact and most broken.. :(

So I have a objet called Ground and object called Bullet. So, when Ground collide with bullet ? Destroy Actor bullet and what more.. ?

Thank you,

CAmPeR :)
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Tanks - terrain question

Postby skydereign » Thu Jul 23, 2009 12:30 am

Well, instead of immediately destroying the ground, you would increase its animpos. Something like this.
bullet->Collide(ground)->Script Editor
Code: Select all
if(animpos==5)
{
    DestroyActor("Collide Actor");
    animpos++;
    DestroyActor("Event Actor");
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Tanks - terrain question

Postby Bee-Ant » Thu Jul 23, 2009 1:22 am

Sky, it seems this guy need a demo...
A demo could tell him better than words.

Well,what view do you want?top view?side view?
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tanks - terrain question

Postby Bee-Ant » Thu Jul 23, 2009 2:04 am

Here's the demo...
Is this what you mean?
Attachments
Tank_Demo.zip
(19.23 KiB) Downloaded 168 times
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tanks - terrain question

Postby Fuzzy » Thu Jul 23, 2009 5:31 am

There is a more realistic way. You need an array as big as the max x of the screen. use things like sin and cos to generate some values, storing them in the array, after multiplying them by the max height you want. If you use random you will have to smooth the array values.

Step through the array, drawing lines to a canvas from the number in the array down to the bottom.

Thats your height field.

Next, whenever the tank gets hit, check to see if he is higher than the pixels at his x value. if so, make him fall.

When firing, trace the shot, figure out where it will be next draw. if that is a value that is greater than the value stored at that point of the array, then you have struck the ground.

To draw a pit, go back several pixels from the collision point and take some points out of that array box. then do the same, closer to the collision point. and so on, for a few pixels past the collision. next, redraw the ground using the array, and decide of any tanks are in the air.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Tanks - terrain question

Postby Bee-Ant » Thu Jul 23, 2009 6:04 am

Fuzzy wrote:There is a more realistic way. You need an array as big as the max x of the screen. use things like sin and cos to generate some values, storing them in the array, after multiplying them by the max height you want. If you use random you will have to smooth the array values.

Step through the array, drawing lines to a canvas from the number in the array down to the bottom.

Thats your height field.

Next, whenever the tank gets hit, check to see if he is higher than the pixels at his x value. if so, make him fall.

When firing, trace the shot, figure out where it will be next draw. if that is a value that is greater than the value stored at that point of the array, then you have struck the ground.

To draw a pit, go back several pixels from the collision point and take some points out of that array box. then do the same, closer to the collision point. and so on, for a few pixels past the collision. next, redraw the ground using the array, and decide of any tanks are in the air.

????????????????
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tanks - terrain question

Postby Fuzzy » Thu Jul 23, 2009 6:12 am

Bee-Ant wrote:
Fuzzy wrote:There is a more realistic way. You need an array as big as the max x of the screen. use things like sin and cos to generate some values, storing them in the array, after multiplying them by the max height you want. If you use random you will have to smooth the array values.

Step through the array, drawing lines to a canvas from the number in the array down to the bottom.

Thats your height field.

Next, whenever the tank gets hit, check to see if he is higher than the pixels at his x value. if so, make him fall.

When firing, trace the shot, figure out where it will be next draw. if that is a value that is greater than the value stored at that point of the array, then you have struck the ground.

To draw a pit, go back several pixels from the collision point and take some points out of that array box. then do the same, closer to the collision point. and so on, for a few pixels past the collision. next, redraw the ground using the array, and decide of any tanks are in the air.

????????????????



I hate making demos. But I will! For this.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest