Staredit Network > Forums > SC2 Assistance > Topic: Bullet Physics
Bullet Physics
Jan 2 2011, 1:32 am
By: LoveLess  

Jan 2 2011, 1:32 am LoveLess Post #1

Let me show you how to hump without making love.

How, plain and simple.

I want to make bullets originate from a unit, if it hits terrain or armored units, it stops/bounces. If it hits a unit, deals damage. I am in no means too familiar with this realm though, so any help is appreciated.



None.

Jan 2 2011, 1:44 am lilneo Post #2



No pro, but I'm pretty sure that's a bit far for the editor...
But, don't take my word for it I'm not saying because I know that but just because with my huge experience with sc1, and my fairly big experience with sc2. That seems a bit much.

I played a tps map a while back, and even with that you couldn't shoot voluntarily in a direction. You had to be aiming at a unit, then it would command the marine to attack.

~lilneo



None.

Jan 2 2011, 1:51 am FatalException Post #3



Don't listen to lilneo, it's doable. :P

I was having trouble with this several patches ago (the last time I worked on my map), as the GetHeight functions weren't working properly, but the basic idea is pretty simple. You get the angle that you want the bullet to come out at and you move a point along the bullet's path. You center a small region on the point, with a radius equal to or greater than the distance that the bullet travels each loop so you don't miss any spots, and you check that region for units each loop. If there is a unit in the region, apply damage and terminate the bullet loop. If there isn't, continue on.

Now, it gets more difficult when you start dealing in three dimensions, or if you want more accuracy without lag. To check if you've hit terrain, you need to get the bullet's relative height to the terrain: If it's less than 0, the bullet is underground. However, this method doesn't work with cliffs--the bullet will do a fun little jump when it reaches a cliff and continue on like nothing happened--and it starts breaking when you start working with hills larger than dimples (or at least it did several patches ago). Do you want more detail, either on the code flow or the math? I'll probably end up writing a tutorial for this sometime, anyway.

Attached is a prototype third-person shooter map that I worked on during the beta. It uses the methods I've described above, and has the problems I've described above. Hopefully the height functions will have been fixed by now, but I don't remember if I left the map in a working state. You may have to select the ghost to start, and you can use 1 and 2 to switch between a rifle and a grenade launcher. Pl0x don't completely rip off my systems from this map. :P

Attachments:
test 2a.SC2Map
Hits: 2 Size: 284.96kb

Post has been edited 2 time(s), last time on Jan 2 2011, 2:01 am by FatalException.



None.

Jan 2 2011, 1:51 am NicholasBeige Post #4



Look up "Trace Line Functions".

As of right now we cannot create collision between missiles and terrain/cliffs. And, I don't think we ever will be able to unless a 3rd party creates it or if a work-a-round is constructed.



None.

Jan 2 2011, 3:35 am LoveLess Post #5

Let me show you how to hump without making love.

Ah, alright. Thank you. I will update the topic if and when I make a viable system for bullet physics.



None.

Jan 2 2011, 8:02 pm payne Post #6

:payne:

Search for "SCCAP" when creating a game on Battle.net 2: the guy did make missiles bounce off walls and such. :O



None.

Jan 3 2011, 9:13 am BeDazed Post #7



Maybe you could make an invisible sprite that encompasses walls/terrain you want to bounce off.



None.

Jan 3 2011, 11:06 am NicholasBeige Post #8



Quote from payne
Search for "SCCAP" when creating a game on Battle.net 2: the guy did make missiles bounce off walls and such. :O

He used regions on all of his walls and simply detected if a unit entered the region and was a missile, then just did some fancy mathematics to calculate the angle of bounce and sent the missile on its way. Not sure how he did the actual bounce or whether or not he used a unit as his actual missile and gave them 'move' commands. Most likely it was the latter.

A missile has a constant height (as far as I am aware). This is offset from the Terrain Height from where it is launched. I think if you look at marauders shooting up a ramp, you can see that the missile just follows the terrain height. Or create a massive hill using raise/lower terrain and shoot missiles over it. As far as I am aware you can't change this (and I believe it's just laziness on Blizzard's part). Especially noticeable when collosus and other units are shooting through cliffs...

For the most bang for your buck in terms of customization, use the good old fashioned dummy unit and order it to move to the point where you want it to be shot at... Then you just give it an ability, create persistent > search area > baneling suicide. So that if it comes within x range of another non missile unit (or even missiles included) it will explode. Only downside is that, this is simple but it relies heavily on triggers.



None.

Jan 4 2011, 3:49 am FatalException Post #9



You can change the height of the missile.

This video is from the map I attached above, when it was working. As you can see, I got it traveling in nice parabolas over flat land, and I can detect where it lands accurately; the problems start when shooting it over uneven ground--you can see the jumps in its path in the second half of the video. The numbers on the left side are the reported height of the missile over the terrain (which are clearly wrong). If the height functions are working better than they were in the beta, I could probably get this map in working order so you can look at it.



None.

Mar 29 2011, 11:05 pm Bolshevik09 Post #10



inst there a condition called "if ground is passable"
Also there is Pathing called no air. So it would make the unit move a different direction when it collided to try and go around. You could detect this via conditions.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[02:53 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: I'll check it out this weekend!
Thanks
[02:47 am]
Symmetry -- I'll check it out this weekend!
[02:40 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: Another map maker? Damn we really ARE back
I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
[02:27 am]
Symmetry -- Another map maker? Damn we really ARE back
[01:51 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Now that I wanted to change my avatar, the error image is showing up, haha.
[01:34 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
[01:33 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
[01:31 am]
Ultraviolet -- Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Is it forbidden to have a large avatar?
actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
[12:20 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: https://staredit.net/profile/133367/ dude's avatar is massive
Is it forbidden to have a large avatar?
[12:04 am]
Ultraviolet -- https://staredit.net/profile/133367/ dude's avatar is massive
Please log in to shout.


Members Online: UndeadStar, Ultraviolet