my very own velocity indicator! :) - what class to put it in

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
timonator
Star Pilot
Star Pilot
Posts: 4
Joined: Thu Jan 01, 1970 1:00 am

my very own velocity indicator! :) - what class to put it in

Post by timonator »

so i've hacked together a little velocity indicator that doesn't harm believability like flying star trash would.
instead i got inspired by M.I.S.C. (Military Interface for Space Combat) which uses a pretty huge three-dimensional grid that the hud draws for you (i suppose) which works really great - finally you'll see whether you're drifting sideways, backwards or are actually flying forwards.

the code is - except for testing and fine-tuning parameters and effects of SPEC - pretty much done, but i have no clue where it belongs.
basically i'll need a place where i get access to the current position and - for SPEC stuff - data about the distortion of space (dunno if i need to calculate this myself by analysing the ships velocity or something.)

if someone tells me where to put it i'll fine-tune it, add support for spec and high velocities and then submit a patch to this forums or wherever you guys like it.

thanks.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Welcome timonator not sure where you would place you code if it your code is python it's more than likely it fits data side if C or C++ then it needs to be integrated in to the main engine apart from that i am not sure on of the devs should be by later.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
timonator
Star Pilot
Star Pilot
Posts: 4
Joined: Thu Jan 01, 1970 1:00 am

Post by timonator »

hello and thanks for the nice welcome :)

it's C/C++ code.

i tried putting it into the star code, where it might be at least minimally relevant, but it resulted in non-moving grids that were re-drawn for each star individually, which is obviously wrong :(
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Post by jackS »

You want to be poking around in cockpit.cpp -- that's where the rest of the HUD, Radar, etc. is drawn.
timonator
Star Pilot
Star Pilot
Posts: 4
Joined: Thu Jan 01, 1970 1:00 am

Post by timonator »

thanks. i've put my stuff there, but it seems like if i call GetParent()->Position() from the cockpit class i get only (0 0 0) as vector, how come? how can i get the position of the players ship relative to the major star or whatever you guys are using as origin of the coord system?
i know that GetParent gets me the unit of the ship, because if i use GetVelocity instead i get stuff based on how fast i am.

thanks in advance :)
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

You might want to check that GetParent() is not NULL (which it will be if you are dead), and also look at GetParent()->fullname... for the main menu it will start out as "dumbfire", which could very well have a position of (0,0,0).

AFter loading a game Position() should work, so that's very strange if it doesn't.
timonator
Star Pilot
Star Pilot
Posts: 4
Joined: Thu Jan 01, 1970 1:00 am

Post by timonator »

i'm not getting anywhere...
the values i get from those calls are always constant even if i fly with afterburner or SPEC:

Code: Select all

// this function call is inside void GameCockpit::Draw()
Unit *ThePar = GetParent();
// these values get passed to my indicator function as "const QVector &center"
ThePar->Position()
ThePar->LocalPosition()
ThePar->UpCoordinateLevel(ThePar->Position())
ThePar->DownCoordinateLevel(ThePar->Position())

// and this is how i find out wether or not the vector changes
std::cout << center.i << " " << center.j << " " << center.k << std::endl;
i don't want the cockpit to keep track of the ships position by itself by having its own position vector and adding the ships velocity vector onto it every time the indicator gets re-drawn!

help :(

PS: AccessCamera()->GetPosition or AccessCamera->GetPQR and then using P as position doesn't work either :(
does vegastrike have the position of the players ship in ram at all? >_>
Post Reply