Turret Scaling

Started by FlessenGreendart, December 24, 2014, 04:23:10 PM

FlessenGreendart

Just a quick question for you guys; is it possible to adjust the scale of a turret on a hull without increasing the size of the hull itself and using the xml to scale it back down?
No rush on an answer, just curious really.
Merry Christmas folks!

ai_enabled

Hello!
Not yet, we will add it with the next release.
Also the "firing point" will be made adjustable, so it will be possible to set the exact point where the projectiles are coming from.
Regards!

Hammish

Wait, next release is going to have build-in scalar values for turret models and the code for the shot origin is confirmed?

Suuuuuhweet.  Now I won't have to bug Flessen for multiple scaling of turret sizes because Blender hates me. :D

ai_enabled

Sure, and it will be available soon.

ai_enabled

#4
Syntax example:

<item_data>
<durability>25000</durability>
<gfx>
<model>turrets/energy_turret_01.obj</model>
<textures>
<diffuse>turrets/energy_turret_01/dif_256.jpg</diffuse>
<specular>turrets/energy_turret_01/spec_256.jpg</specular>
<normal>turrets/energy_turret_01/nrm_256.jpg</normal>
</textures>
<scale>1.5</scale> <!-- huge! -->
<offset>0;0;-0.25</offset> <!-- little bit up -->
</gfx>
<weapon>
<fire_origin>0.241;0.000;0.000</fire_origin>
...
                        </weapon>


So you can offset turret position, scale it and set the fire origin.
The fire origin work best for rays. The projectiles always firing from zero height (Z=0, because they are physics objects). But you still can offset projectiles by X/Y.
Also the fire origin is the point where muzzle flashes appears.

FlessenGreendart

That is really good news! :)
Will the fire origin be able to be set for multi-barrel type weapons (two fire origins)?

What I actually meant with the question, though, was could weapons have different scales on different hulls, e.g. Machine Gun being smaller on a Banshee than an Avalanche?

Hammish

Quote from: FlessenGreendart on December 25, 2014, 04:39:33 PM
That is really good news! :)
Will the fire origin be able to be set for multi-barrel type weapons (two fire origins)?

What I actually meant with the question, though, was could weapons have different scales on different hulls, e.g. Machine Gun being smaller on a Banshee than an Avalanche?

AI will be able to tell you for sure, but I still doubt it on the two fire origins given that the origin point seems to be set to the overall turret data and not as a component in the projectiles.

ai_enabled

#7
Syntax is changed, thanks for response!

<item_data>
<durability>25000</durability>
<gfx>
<model>turrets/energy_turret_01.obj</model>
<textures>
<diffuse>turrets/energy_turret_01/dif_256.jpg</diffuse>
<specular>turrets/energy_turret_01/spec_256.jpg</specular>
<normal>turrets/energy_turret_01/nrm_256.jpg</normal>
</textures>
<scale>1.5</scale> <!-- huge! -->
<offset>0;0;-0.25</offset> <!-- little bit up -->
</gfx>
<weapon>
<projectiles>
<projectile>
<gfx>
<!-- other data -->
<muzzle_flash_sprite>
<width>0.4</width>
<height>0.4</height>
<textures>
<diffuse>projectiles/muzzle_flash_01.png</diffuse>
<color>1;0.7;0.5;1</color>
</textures>
<flash_origin>0.118;0.000;0.000</flash_origin>
</muzzle_flash_sprite>
<fire_origin>0.2;0.000;0.000</fire_origin>
</gfx>
<!-- other data -->
</projectile>
</projectiles>
<fire_origin>0.241;0.000;0.000</fire_origin>
...
                        </weapon>

Let's make multibarrel weapons! :-)

About scaling - currently scale of turret is set by the weapon XML and it's independent from hull XML. If you have any ideas how we can do it without over-complication of syntax - we're listening!

Update is available now!
Regards!

FlessenGreendart

Honestly, the flash origins and fire origins are a wonderful addition!

What I was thinking was something like this:

<root>
<header>
<id>hull_banshee</id>
<title>Banshee</title>
<description>Fast, maneuverable interceptor type hull. Perfect ship for quick attacks.</description>
<enabled>1</enabled>
</header>

...

<weapon_slots>
<!-- energy (left) -->
<weapon_slot>
<id>0</id>
<slot_type>1</slot_type>
<slot_size>1</slot_size>
<display_type>1</display_type>
<direction>-30</direction>
<rotation_angle>120</rotation_angle>
<rotation_speed>200</rotation_speed>
<position>0.020;0.300;-0.122</position>
<!-- smaller than average -->
<weapon_scale>0.75</weapon_scale>
</weapon_slot>

<!-- ballistic (center) -->
<weapon_slot>
<id>1</id>
<slot_type>2</slot_type>
<slot_size>1</slot_size>
<display_type>1</display_type>
<direction>0</direction>
<rotation_angle>100</rotation_angle>
<rotation_speed>100</rotation_speed>
<position>-0.140;-0.120;-0.180</position>
<!-- larger than average -->
<weapon_scale>1.3</weapon_scale>
</weapon_slot>

</weapon_slots>

This way, smaller hulls could have smaller turrets, rather than looking like a gun attached to an engine :P
If you think it complicates things too much, as I said before, you can work around it by making the mesh larger and then scaling it down in the hull xml.

Hammish

That actually seems pretty feasible to me, Flessen.  I mean, scale is just going to be a final multiplicative value anyway, so maybe the game could just put them together.  On a hull with turret scale 1.3 sporting a gun set to scale 1.5, maybe the game just sets the final model to scale 1.95.  I would think it'd just be small tweak to the math check.

I don't think I'd use it, personally, but I can see how it'd lead to some fun effects. :)

And now, off to fix the hell out of BTC, lol.  I'll have to check and see how the effect ends up looking on the tri-lasers I have, though, and may just keep them as they are so they all stay parallel to one another for nice visuals.  I get the feeling that with beam weapons they'll all converge at the cursor, which is another cool effect that I'd like to try, just not for those particular guns. ;)

FlessenGreendart

Admittedly, it's more for custom hulls than the vanilla ones. The best example I can give is my starfighter mod I'm working on, where the hulls are smaller than the Banshee, and if I want visible turrets, they cover most of the ships.
I've scaled them to about the size of the banshee mk2 and used the xml scale to bring it down:



To give you an idea. (also, sneak peak  ;))

Hammish

Nice work on that!

And yeah, I can see what you mean; I always liked the aesthetic of underslung guns being fairly oversized, but it can stretch realism with the scaling you were mentioning. ;)

Would be nice to be able to upscale them, too, if my other buddy ever finishes modeling the battleship I commissioned.

Hammish

Also, quick question, in the new core.cpk I'm not seeing any turrets thus far that make use of the turret scaling, just the fire origin.  Are either/both optional tags and if they are, what if they are left off?  It just goes with 1.0 scale and 0,0,0 origin?

ai_enabled

They're optional, you can add <scale> and <offset> tags in turret GFX description where you need them.
About scaling of the weapon slot on the hull - it's a good idea, we can implement it when we finish other tasks.
Regards!

FlessenGreendart

Cool, I look forward to using it  :)