Turrets on vessels drawing

Discussion about the game and its default mods.
Post Reply
Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Turrets on vessels drawing

Post by Iran »

How does OpenRA draw the turrets on vessels like the Cruiser? How does it adjust the turret drawing for the Cruisers rotation? The turrets themselves are loose files and not part of the graphics (unlike turrets on tanks).

Matt
Posts: 1144
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »


Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

That gives me an overview of the concepts involved but not the implementation. Is there anything I could check in the code?

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

Cmd. Matt wrote: http://blogs.ijw.co.nz/chris/index.php/ ... sitioning/ may be outdated already though.
That had a number of limitations, and was replaced ~6mo ago with proper 3D positioning in https://github.com/OpenRA/OpenRA/pull/2887. Take a look at the Turreted trait implementation to see how it is used.

Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

could you give me the name of a few source code files to look at to get a grasp of the implementation? My math is pretty poor and I don't have experience with 3D math at all..

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

The Position method in Turreted.cs would be a good place to start, and then look up the definitions of the functions it uses (and the functions they use).

It is pretty much all 3D vector stuff, so you may have some trouble. You may be better off looking at the old code implementation described in that blog post, which is much simpler and probably good enough for your static map previews.

Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

I decided to go with hard-coding the y and X offsets for the turrets on units which need it, it was 3 hours of work for RA1 and I think it will be about 1.5 hours for C&C95.

Post Reply