Ship happenz - heavy collide with walls cause damage?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Ship happenz - heavy collide with walls cause damage?

Post by Reactor »

"You and Velbt did a good job bringin' all these glorious stuff back here, Anders. But the battle has just begun. I don't know how did that smuggler get these high-tech Zicca stash, but it doesn't matter anyways, main thing is, finally we have all the firepower and protection we need. Heh, this should be more than enough. Alright then, let's kick the plan into motion! Y'need to get to that industrial zone and shut down the damned radar station 'fore we could get a chopper ride for ourselves. The damn filthy cops are stormin' all them roads, so y'have to go by boat. Velbt here will take y'back to them docks. Once y'there, hijack a powerboat an' ride it across the gulf to Hoboken Station. I'll give another call to that smuggler so he'll do the dirty work for ya, you just jump in an' set course, that's all. Now don't forget, y'll be ridin' a powerboat, not a tank, and hittin' too many them walls will get y'shipwrecked very easily. So no fancy crap, alright? Try to be careful wit' that puppy, and not to ram anythin'. I'll radio you once y'reach Hoboken Station. Good luck, Anders...y'gonna NEED it!"

/Mestengo debriefing Anders/

Well, as you could see it, I shall include a short vehicle level into the campaign, Ship happenz. This will be a riding level only, no shooting involved, the player will have weapon and item selection disabled, all he needs to do is navigate a Motion power boat through a set of canals into the open sea (similar to Water Hazard in Half-life 2, without stopping, getting out of the boat and shooting), so the level shall involve no enemies at all, only riding the boat from point "A" to point "B". Once the player leaves the city of Stavanger, and crosses the gulf, he shall arrive to Hoboken Station and the level will end. I believe the controlling of the Motion power boat can be done utilizing the "slippery surface" on water, and I can pretty much construct a ship HUD vehicle view for that level.

What I don't know is how to set collision damage. I mean, slight bumps won't damage the power boat, regardless if the player touched a nav-buoy, a wall, or a floating oil drum in the water, however, harder hits WILL cause damage to the ship, a full-speed collision with a wall or a static object would instantly kill the player (with an explosion effect), and would display a special obituary indigenous only for this level:
"They don't build ships like they used to..."
"As you sink, you notice a writing on the boat's underside: MADE IN CHINA"
"Oh my, Anders, you hardly were a morsel for those hungry sharks!!!"

So I'm not sure about how to make walls and impassable static objects cause smaller-bigger damage to the player, depending on how fast the player was when he rammed it. Any good suggestions?
User avatar
Rachael
Posts: 13957
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by Rachael »

One thing that was done on All Out War (a skulltag mod) was to put damageable "sensors" on the walls to detect when explosion damage was incoming and adjust the health of the building appropriately.

Such a system could be done with what you're describing too - putting sensors on shorelines and rocks and other obstacles, detecting the proximity of the player - when a player trips a sensor, damage will occur to their vehicle, depending on the object hit. You can define multiple actors for this, allowing you to control damage based on actor, which is easier to manage in a map editor.

You can do this using DECORATE with a special "monster" that is +NODAMAGE and non-solid and does an A_Look at 360 degrees and a very short distance, executing an ACS script in its See state.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: Ship happenz - heavy collide with walls cause damage?

Post by Reactor »

So it is possible :) thank you for the response. This will be the only boat level, so these special sensors would be put into use only in this level (but here, it'll be on every surface and object which the boat can run into).
I'm not sure though, how to calibrate these sensors. What I mean is, if the boat just slightly bumps into a wall or an object, then it would not cause any damage at all. You know what I'm saying...these sensors would "check" the speed the player is ramming into them, and cause damage accordingly, otherwise the stage would be unplayable.

Another story shall be disabling weapon/item selection for this level, but I believe it can be done much easier.
User avatar
Rachael
Posts: 13957
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by Rachael »

Getting the player's speed is possible with ACS.

First, make sure that the player has a TID (can be done with an ENTER script) (example here) so that you can reference them with another script.

Then, using that TID, use [wiki]GetActorVelX[/wiki](tid) and [wiki]GetActorVelY[/wiki](tid). An example would be like this:

Code: Select all

script 1 ENTER
{
	Thing_ChangeTID(0, 1000);
}

script 666 // This is called by your sensors.
{
	int x, y, speed;
	x = GetActorVelX(1000);
	y = GetActorVelY(1000);
	speed = FixedSqrt(FixedMul(x, x) + FixedMul(y, y));

	// Keep in mind, at this point, "speed" is fixed point and will have to be converted back to an integer, otherwise your calculations will be a little crazy. Converting is simple, simply divide by 65536 to convert from fixed point to an integer. Multiply by 65536 to convert from integer to fixed point. You can do your boat damage code here, armed with that knowledge.
}
I know the fixed point thing is a little crazy. Here's a wiki article about it, I hope it clears it up for you.

If you wish to work strictly with fixed point numbers, so that you can forget the whole times or divide by 65536 craziness, you can simply append ".0" to all your whole numbers, i.e. instead of stating "2" in your ACS script use "2.0".
User avatar
Minigunner
Posts: 754
Joined: Mon Dec 28, 2009 5:13 pm

Re: Ship happenz - heavy collide with walls cause damage?

Post by Minigunner »

Reactor, for future reference, people like when someone seeking help is short, simple, and to the point about it. It's fine if you mention what project it's for, even link it, but writing an entire story about the project within a post asking for help with a function or something to be used in it... well, it clutters the post and may deter potential help. Especially so when done on every editing thread you post. If you focus primarily on the questions you have rather than writing about your project, you can get help a lot more easily.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: Ship happenz - heavy collide with walls cause damage?

Post by Reactor »

Thank you Eruanna for all the trouble you went through :) It does not matter what do I have to work with, at all, as long as it works perfectly during the level, as it should, and the player is satisfied what he is experiencing, namely, he won't complain about neither every slight wall/object touch with 0,5 mph will cause the Motion power boat to explode, nor ramming into a concrete wall with over 200 miles per hour, and he just rebounds unharmed like a ball in the flipper.

Well, Minigunner, I usually describe the issue itself in short. The "story" I include is only a small background, and I always write it in distinct letters. Apart from the better understanding of the situation the actual feature shall be used in, it is also written to indicate that I'm more than willing to heed any possible solutions. If the situation described can be solved in more than one ways, then I'm fancy hearing them all and then decide which one to apply. Not to mention this will lessen the chance of answers like "well then don't make a ship level" :)
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by wildweasel »

Reactor wrote:Well, Minigunner, I usually describe the issue itself in short. The "story" I include is only a small background, and I always write it in distinct letters. Apart from the better understanding of the situation the actual feature shall be used in, it is also written to indicate that I'm more than willing to heed any possible solutions. If the situation described can be solved in more than one ways, then I'm fancy hearing them all and then decide which one to apply. Not to mention this will lessen the chance of answers like "well then don't make a ship level" :)
I would honestly have understood your initial post better if the intro paragraph were gone.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: Ship happenz - heavy collide with walls cause damage?

Post by Reactor »

Well sure, if you feel that the backstory is unnecessary, I can omit it alltogether from an "Editing" issue.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by wildweasel »

Reactor wrote:Well sure, if you feel that the backstory is unnecessary, I can omit it alltogether from an "Editing" issue.
Well, as Minigunner said, being clear and concise is key to getting help. Adding a paragraph of in-universe backstory to your problem is more likely to produce a "too long; didn't read" reaction than it is to give a person context.
User avatar
Rachael
Posts: 13957
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by Rachael »

Reactor wrote:Thank you Eruanna for all the trouble you went through :) It does not matter what do I have to work with, at all, as long as it works perfectly during the level, as it should, and the player is satisfied what he is experiencing, namely, he won't complain about neither every slight wall/object touch with 0,5 mph will cause the Motion power boat to explode, nor ramming into a concrete wall with over 200 miles per hour, and he just rebounds unharmed like a ball in the flipper.
You're welcome. :)
User avatar
Minigunner
Posts: 754
Joined: Mon Dec 28, 2009 5:13 pm

Re: Ship happenz - heavy collide with walls cause damage?

Post by Minigunner »

Reactor wrote:Apart from the better understanding of the situation the actual feature shall be used in, it is also written to indicate that I'm more than willing to heed any possible solutions. If the situation described can be solved in more than one ways, then I'm fancy hearing them all and then decide which one to apply. Not to mention this will lessen the chance of answers like "well then don't make a ship level" :)
I can understand that (in a way, I guess), and that's why I also suggested simply mentioning what project it's for, and even putting a link to it is okay.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: Ship happenz - heavy collide with walls cause damage?

Post by Reactor »

I understand :) Currently the project is still in progress, so I don't really have anything to show, however I do keep track of every "Editing" issue, and once the time shall be right, I don't have to wait for the answer, I shall already have it, I can put it into business right away.
I also witnessed Blaskowitz's issue about the angled minigun and the uproar it caused, it serves as a classic negative example how NOT to request assistance.
User avatar
Rachael
Posts: 13957
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by Rachael »

Reactor wrote:I also witnessed Blaskowitz's issue about the angled minigun and the uproar it caused, it serves as a classic negative example how NOT to request assistance.
I kinda laughed when you said that.

People being asshats are great examples of how NOT to be, but there is the other extreme of avoiding their behavior a little too much. :)
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by NeuralStunner »

Rather than using a ton of sensors, would it be better to track the ship's velocity and check for sudden deceleration? This would allow you to apply collision damage to just about any situation, and not have to set maps up specially for it.
User avatar
Rachael
Posts: 13957
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Ship happenz - heavy collide with walls cause damage?

Post by Rachael »

That is an idea, but it can be a bit quirky sometimes not knowing why a ship suddenly decelerates. It could work, but in my experience tracking velocity by itself has always ended up messy every time. Plus, Doom's wall-sliding code might make it so you can not accurately detect when there actually is an impact, instead of the player simply hitting the reverse button full throttle.
Locked

Return to “Editing (Archive)”