home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Alternate gravity

by Bitstream on 08/24/2010 14:47, 10 messages, last message: 10/01/2010 12:07, 2202 views, last view: 04/27/2024 08:40, closed on 10/01/2010 14:18

Hi Everyone,

i generally dont like the "i'm new to this game, it rocks and here is my stupid noob question..." posts so i read/searched the forum and wiki for a while and looked at several Quadropolis-Mods. But after some weeks and some more trys i think i need a different approach so here is my own stupid thread:

The idea is not new and even metioned in several times in other threads: Being able to change the gravity (force and direction) is the feature i'm really missing in the cube2 engine.

First i thought it cant be that hard to make am MOD for this and even include it in the Map-Editors code for easy mapping but unfortunately the gravity in cube2 seems to be very hardcoded to the z-axis. Furthermore it's not only the gravity that has to be rotated, there are several other things that needs to be adjusted if you want to be able to walk on walls or the celing - FieldOfView, Movement, Hitboxes...

And to even make it harder i want to be able to easily adapt the code to new versions of cube2. Maybe it's better to create functions or use pointers that alter the values in the existing gravity-calculation insted of recoding the existing functions to change as few lines as possible in the original code???


My first idea was to exchange the x/y/z-values before a calculation and change the modified values back after that... but this isnt possible because to collision detection is still checking the z-axis and not along the x-axis for example. Furthermore even if it had been successful its not a good solution because you could only point the gravity 90/180 degree in 6 directions (up,down,left,right,forward,back).

Second try was to create a personal gravity vector for each physobject an rotate the gravity after calculation... => better because we could point gravity for each individual object to any direction but collision detection / ground detection still using z-axis. => Doesnt work...


Any great ideas how to include a fexible and adjustable gravity MOD witch isnt killed with each new cube2 release because i takes years to merge the sourcecode?

   Board Index   

#1: ...

by Blarget2 on 08/24/2010 15:22

and for everyone else that did not understand him at all, here is a video of it being done in the source. http://www.youtube.com/watch?v=J6JtH2Gg7EA

reply to this message

#2: BloodFrontier

by LeftClickersPhone on 08/25/2010 00:42

Didn't BloodFrontier do this?

reply to this message

#3: Re: BloodFrontier

by Quin on 08/25/2010 03:39, refers to #2

No, never. Stuff like this needs a complete rewrite of the physics subsystems to use quaternions instead of yaw/pitch/roll due to "gimbal lock".

reply to this message

#4: Re: BloodFrontier

by LeftClicker on 08/25/2010 04:05, refers to #3

Sorry, I should've been more clear. Didn't BF have adjustable gravity (not the walking on walls et cetera).

reply to this message

#5: ..

by Bitstream on 08/25/2010 10:39

@Blarget2: Thanks for the clarification, i was so focussed on problems / solutuions that i haven't realized the lack of basic descriptions. ^^

I think some movies show best what i mean. For example look at Hell Club in Matrix2 or the Inception trailer.
http://www.youtube.com/watch?v=5Ylbt9NJYgg
http://www.youtube.com/watch?v=FO14vgynx1k

Or it's done in several Source-Engine projects, the cyberspace in Dystopia MOD is another good example. (1:40)
http://www.youtube.com/watch?v=P6ez9-fGdS0


@LeftClicker: Adjustable gravity (for example 50% or 200% gravity) can be easily implementet in the cube2 code. The problem begins when i want another gravity direction instead of the normal floor. (down the z-axis)


@Quin: I'm not familiar with the quaternions system, so i did a quick wiki-check on quaternions and gimbal lock - seems like a lot of hard stuff! I think i'll not be able to implement this in a reasonable time... is this the only way to go?


reply to this message

#6: Re: ..

by Quin on 08/25/2010 16:22, refers to #5

Well, as you approach 90 degrees on one axis, another axis loses its range of motion. There are ways around this, like what NASA would do with their space craft; as the number approaches 79 degrees, switch another axis around so that the current axis can keep moving.

This is not the best solution, the math can get pretty heady (at least one spacecraft was lost due to computational errors, if that says anything), and keeping track of it all is pretty nasty. Not impossible, but no method is really that easy. If it was, I would have already done it myself.

reply to this message

#7: ..

by Meigus on 08/26/2010 09:33

You should take a look at the Tremulous code to see how they do it.

Or look over at Xreal, as someone suggested Trem-style walking on walls, and within a short while, a guy had a demo going with full first person shooting I think, mostly because Tremulous and Xreal are based on the ioquake3 engine.

reply to this message

#8: ..

by MikomDude on 09/29/2010 01:02

Then how do you just change the power of the gravity?
I know that you can change it in Platinum art sandbox with the "/gravity" command but that doesn't seem to work in Sauerbraten.

reply to this message

#9: Re: ..

by |ice|sub-zero|L on 10/01/2010 04:35, refers to #8

That's because its an external command in Sauerbratens engine and is not a ingame command. How ever you can edit two .cpp files and make gravity an internal command. However it still only works two ways, up and down. Unless of course you spend a lot of time coding it to work in more than two functions.

Now on the subject that was originally in place, they are talking about making not only up and down, but also wall runs.

reply to this message

#10: ..

by MikomDude on 10/01/2010 12:07

Is it possible that you could tell me how to edit those two .cpp files? I\'m not that much of a sauer-scripter.

I know it might be a bit work for such a small thing but I\'d really like to know.

reply to this message

   Board Index   


Thread closed!

This thread has been closed, which is why you can't post any more messages in it.


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53868837 visitors requested 71644016 pages
page created in 0.022 seconds using 10 queries
hosted by Boost Digital