New COB constants? - Page 2

New COB constants?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

Won't this just lock a unit to one direction? I don't see any "set MAX_SPEED" in there, so the unit will still be able to move straight, right?
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Awesome awesome awesome awesome awesome!
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

yuritch wrote:Won't this just lock a unit to one direction? I don't see any "set MAX_SPEED" in there, so the unit will still be able to move straight, right?
Well, sort of. If you order it to move elsewhere it'll keep tyring to turn to that direction to move that way. But yes it can still move 'straight'.
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Post by Noruas »

Is thar a way to detect team color with cobs?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Not currently, what do you want it for? There is a way to get a units team however.

I'm thinking of adding set RADAR/SEISMIC/JAMMER/SONAR/ETC_RADIUS, anyone want?
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Post by Noruas »

Well i either need a way for the cob to detect team color for different but same effects can go, with colors that some what match... Or i need, which would be easier, the special effect i am calling, to detect team color.

Image
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Noruas wrote:Well i either need a way for the cob to detect team color for different but same effects can go, with colors that some what match... Or i need, which would be easier, the special effect i am calling, to detect team color.

Image
Yeah, that's more a case of giving teamcolour access to effects rather than anything COB related.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

But where would we control that?
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

FLOZi wrote:Not currently, what do you want it for? There is a way to get a units team however.

I'm thinking of adding set RADAR/SEISMIC/JAMMER/SONAR/ETC_RADIUS, anyone want?
UNCLOAK_RADIUS for the reveal cloaked units distance thingy?

EDIT: And Builddistance perhaps?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Guessmyname wrote:EDIT: And Builddistance perhaps?
Very yes.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Guessmyname wrote:
FLOZi wrote:Not currently, what do you want it for? There is a way to get a units team however.

I'm thinking of adding set RADAR/SEISMIC/JAMMER/SONAR/ETC_RADIUS, anyone want?
UNCLOAK_RADIUS for the reveal cloaked units distance thingy?

EDIT: And Builddistance perhaps?
Would be good, requires me shifting uncloakradius over to unit from unitdef, mind. As would builddistance.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Ignoring those for the time being:

Code: Select all

#define RADAR_RADIUS			 87 // set or get
#define JAMMER_RADIUS			 88 // set or get
#define SONAR_RADIUS			 89 // set or get
#define SONAR_JAM_RADIUS		 90 // set or get
#define SEISMIC_RADIUS			 91 // set or get

#define CURRENT_FUEL			 93 // set or get
Have all been added. Fairly self explanatory I think?

I have something planned for 92.

@neddie: some useteamcolour=1; tag somewhere that would render the whole sprite in teamcolour.
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

What about tan, sin and cos? Really nice to see exponents, and fuel is also VERY handy.

Things like:

PIECE_XZ

you get two variables at once? how exactly does that work? Can I get just the Z value for example? Now that I think of it, A fun way of getting sin etc is to use a dummy piece rotaded some angle and then read in values with PIECE_XZ.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

i guess i can add tan sin and cos. They'd have to be * 65536 though as they would return floats.

The coords are packed; you can get the seperate elements thusly;

Code: Select all

x = packed / 65536;
z = packed & 65535
Note that your compiler.cfg for scriptor probably still has a '?' character instead of '&' for bit-wise and. I must get around to releasing my updated one.

Anyway, next up are
get TRANSPORT_ID gets the unitid of the transport the unit is currently in

and adapting get HEADING to take an optional unitid parameter. This will allow scriptors to align loaded units with their transport.

Also lucky number 92 will be implemented; get DO_SEISMIC_PING or something along those lines. Reads poorly but should be handy.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Hurrah, done:

TRANSPORT_ID (94)
- usage: get TRANSPORT_ID
- returns the ID of the transport the unit is currently loaded into
- returns -1 if not loaded

HEADING (82)
- usage: get HEADING (unitid)
- returns the heading of the current unit if no unitid supplied, or the heading of the supplied unit

DO_SEISMIC_PING (92)
- usage: get DO_SEISMIC_PING (size)
- Does a seismic ping of the units seismicSignature by default, or of the size specified
- Does the LUA calls and Global AI calls that a standard movement-caused seismic ping will do.
- This would probably be more efficient if I made a 'DoSeismicPing' method in unit.cpp rather than copying the code across. Possibly I'll clean it up in the future.

EDIT: Made the change in DoSeismicPing. Comitted, rev 3823. :-)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Can you give us GET PITCH, as well as heading? If so, then Zpock's neato suspension script, as well as some other things, would be much easier to do.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh, and PRINT is the greatest thing, ever. Really. It's already allowed me to solve some nasty problems.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

At a glance, the pitch information is held as a float3 so that would be trickier, unless I allowed manipulation of each component.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

If ya did a rough conversion on the GET, returning radians, it'd probably be acceptable for most purposes.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Or GET PITCHX, GET PITCHY, GET PITCHZ especially since radians assumes floating point which just isnt possible in cob so there'll be a huge margin of error....
Post Reply

Return to “Engine”