Inside3D!
     

Mathlib v2
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Sat May 20, 2006 1:04 am    Post subject: Reply with quote

http://tlb.circa1984.com/dev/mlx20.zip

Quake Archive Mirror
http://quake.errorabove.com/QuakeC/Weapons/mlx20.zip

Mathfrag Final.

Uses min, min3, max, max3, anglemod, randomvec, sqrt, pow.

Four weapons.

Piecemaker (replaces grenade launcher)
Mr. Smartypants (replaces super nailgun)
Ulysses DemiCannon (replaces supershotgun)
Forte Scale Blaster (replaces nailgun)

You can do whatever you want to with this Frik. Wink

EDIT: above has been updated following the release of MathFrag Final. I'm not going to do any more on this, due to idea burnout.

Besides, I really should get back to Quake: Operation Hellsmash anyway.
_________________
"Roboto suggests Plasma Bazooka."


Last edited by Dr. Shadowborg on Mon May 22, 2006 3:08 am; edited 2 times in total
Back to top
View user's profile Send private message
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Sat May 20, 2006 1:15 pm    Post subject: Reply with quote

the super nailgun is dancing !
_________________
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Sat May 20, 2006 3:41 pm    Post subject: Reply with quote

Hey cool DrShadowb0rg, I'll try it out later today. Though it would be cool if you could come up with some things using the more interesting match functions, sqrt, pow etc.

I stealithly uploaded a new mathlib yesterday, recheck the link from the first post.
_________________
Back to top
View user's profile Send private message Send e-mail
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Sat May 20, 2006 6:18 pm    Post subject: Reply with quote

FrikaC wrote:
Hey cool DrShadowb0rg, I'll try it out later today. Though it would be cool if you could come up with some things using the more interesting match functions, sqrt, pow etc.

I stealithly uploaded a new mathlib yesterday, recheck the link from the first post.


I'll see what I can think up, no guarantees though. Wink


EDIT: Thought up two, they will be ready sometime tomorrow, day after at the latest.
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Mon May 22, 2006 2:08 am    Post subject: Reply with quote

Final version from me posted, see original post for ldownload and quick info.

Condiments and bug reports appreciated.
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Mon May 22, 2006 2:40 pm    Post subject: Reply with quote

the reflecting rocks

no more abusing movetype_bounce + gravity 0!
_________________
Back to top
View user's profile Send private message
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Mon May 22, 2006 4:55 pm    Post subject: Reply with quote

CheapAlert wrote:
the reflecting rocks

no more abusing movetype_bounce + gravity 0!


Actually, the rebounding stuff doesn't use mathlib.qc functions. It's closer to the code that was used in scourge of armagon, only heavily modified to use a function I wrote called ReboVec. I haven't tested it yet, but in theory, ReboVec can even be used to provide richocet vectors for even hitscan type attacks.

Uses of mathlib.qc in the two new weapons:
sqrt: Used in the DemiCannon's damage calculation for direct hits.
pow: Used in the Forte Scale Blaster's damage calculation.
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Mon May 22, 2006 5:37 pm    Post subject: Reply with quote

Is that why it has the same bug as SoA, where the rebound always gets forced closer to the normal than it should be, because you are doing out_vector = in_vector - (normal * 2) and instead you need to do out_vector = in_vector + (normal * (normal * in_vector) * 2) (Thanks to div0 for helping me to work this out)

Also, the spawn weapon feels far too strong, but that's somehting that can be sorted out by almost anyone Smile
Back to top
View user's profile Send private message
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Mon May 22, 2006 6:54 pm    Post subject: Reply with quote

Lardarse wrote:
Is that why it has the same bug as SoA, where the rebound always gets forced closer to the normal than it should be, because you are doing out_vector = in_vector - (normal * 2) and instead you need to do out_vector = in_vector + (normal * (normal * in_vector) * 2) (Thanks to div0 for helping me to work this out)

Also, the spawn weapon feels far too strong, but that's somehting that can be sorted out by almost anyone Smile


Actually, the formula I'm using is result = olddir+(2*trace_plane_normal) NOT result = olddir-(normal*2).

I tried the formula you posted, however, all it did was cause the deathball to not rebound proper. (i.e. it just kept rebounding into the wall, instead of away from it)

If what you mean by spawn weapon is the Forte Scale Blaster, well... It does need a bit of tweaking I suppose. Right now, it operates under a formula of 4 to the power of self.health/25 / 10. Which is rather ugly and amateurish really, but gets the job done. =P
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Mon May 22, 2006 8:51 pm    Post subject: Reply with quote

I might have my + and - the wrong way around...

But the basic idea is: instead of just using the normal, you need to scale the normal by the dotproduct of the entry vector and the normal. That way you can do nice shallow bounces that will nearly always hit the enemy exactly where you planned, instead of it sharply kicking away almost perpendicular.
Back to top
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon May 22, 2006 9:36 pm    Post subject: Reply with quote

The correct formula is
out = 2N(N dot I) - I
but in that case I (incident vector) points the other way. (away from the plane)


So the formula you want is
out = 2N(N dot I) + I
Where I is velocity, N is trace_plane_normal. I don't think I has to be normalized...


The 2 can be changed to modify bounciness: 1 is no bounce (just slides off surfaces), 1.5 is half bounce (probably similar to Quake grenade), 2 is full bounce, >2 is actually picking up speed with each bounce
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Mon May 22, 2006 10:59 pm    Post subject: Reply with quote

Thank you. But I think a better way to determine how bouncy you want it, is to seperate the speed from the in vector, then scale the speed before combining it with the out vector.
Back to top
View user's profile Send private message
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Mon May 22, 2006 11:09 pm    Post subject: Reply with quote

Lardarse wrote:
I might have my + and - the wrong way around...

But the basic idea is: instead of just using the normal, you need to scale the normal by the dotproduct of the entry vector and the normal. That way you can do nice shallow bounces that will nearly always hit the enemy exactly where you planned, instead of it sharply kicking away almost perpendicular.


Indeed, I'd figured that something like that might have happened, so I tried it just before reading your post here. Embarassed

Silly me, I should have realized that was what happened immediatly, but I was kind of rushed, having to be somewhere at the time.

Anyway, it works good, so that'll be in the bugfixed version, which will come out sometime in the near future, barring anybody noticing any other bugs...
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Tue May 23, 2006 3:03 am    Post subject: Reply with quote

I like the mod, but none of the weapons give that 'woah, math' feeling. I'll try to see if I can come up with an idea that does..
_________________
Back to top
View user's profile Send private message Send e-mail
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Tue May 23, 2006 2:57 pm    Post subject: Reply with quote

FrikaC wrote:
I like the mod, but none of the weapons give that 'woah, math' feeling. I'll try to see if I can come up with an idea that does..


True enough. It's pretty hard to come up with something that does though.

In any event, it was pretty much intended as just a quickie example mod, you might say my half-assed attempt to try and help promote mathlib.qc so that it wouldn't get shoved aside and forgotten like it did when it first came out a couple of years ago.
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group