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 » Wed Sep 18, 2013 6:17 pm

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: 1021
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt » Thu Sep 19, 2013 4:29 pm


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

Post by Iran » Thu Sep 19, 2013 7:44 pm

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: 770
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir » Thu Sep 19, 2013 8:46 pm

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 » Sat Sep 21, 2013 8:25 pm

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: 770
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir » Tue Sep 24, 2013 11:36 pm

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 » Wed Sep 25, 2013 8:22 pm

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