#1 2015-03-25 23:14:19

gaya
Member

Jetpacks?

Is there any docs or examples on the physics of the game? I wanted to implement a few powerups, such as:

Speed rune, to make the player run faster.
Jetpack, to make the player fly in all directions (similar to Tribes)

Offline

#2 2015-03-26 10:06:59

spikeymikey0196
Member

Re: Jetpacks?

You could perhaps look into how other powerups worked in sauerbraten then add them back into the require place in tess but with edited attributes? :3

Offline

#3 2015-03-26 13:34:27

gaya
Member

Re: Jetpacks?

Are they the same code? Hasn't the game logic, context and interfaces changed in tesseract?

Offline

#4 2015-03-27 12:01:18

chasester1
Member

Re: Jetpacks?

Both are easily implemented:
speed is capped by the property maxspeed in ent.h in struct physent all you have to do is change this for a player after he picks up the pickup. Search for N_trypickup (i think) this may have been changed in tesseract  beacuse of the removal of pickups. If so goto ctf.h and look for flag pick up amd follow that .. pick up requires server authorization so you may have to dig a lil.

A jet pack technically doesnt work like you said but what your looking for is in physics.cpp in a function called modifyvelocity. If you want it like the spectator mod basically then just set an if statement there that sets the players physic state to PHY_FLOAT, when activated and check for it there and just change the bool flat at the top of the function to true. Then you dont have to worrie about creating physics.

if you want a more accurate jet pack, simply add to the PHY_ enum like PHY_JETPACK and then check for it don't forget to apply the gravity through the corrisponding function and then add air friction .. i think its normally set to 1/36 *velocity. You can see if they have landed by looking for the correct PHY_ STATE. If you have any particular questions ask;)

Offline

Board footer