Strange shield behaviour and capships shield bubbles
-
Hi everyone,
after years of not having touched Freelancer, I came back to it a couple of days ago and soon started modding again.
When I tried to add a shield to a li_cruiser encounter, I encountered some strange things I would like to ask you guys about. Furthermore, I wasn’t able to create a working shield bubble for that cruiser. I’m pretty sure I’m missing something, it might be a small trick, but I couldn’t find it on the forums anywhere.
Here’s my code.
New equipment file:
[ShieldGenerator] nickname = x_shield_li_cruiser ids_name = 0 ;GENERATESTRRES("Cruiser Shield") ids_info = 264808 DA_archetype = equipment\models\st\li_refractor_shield.3db material_library = equipment\models\li_equip.mat HP_child = HpConnect hit_pts = 6752 explosion_resistance = 0.500000 debris_type = debris_normal parent_impulse = 20 child_impulse = 80 volume = 0.000000 mass = 10 regeneration_rate = 50 max_capacity = 3000 toughness = 110.400002 hp_type = hp_elite_shield_special_10 offline_rebuild_time = 10 offline_threshold = 0.15 constant_power_draw = 0 rebuild_power_draw = 10 shield_type = S_Graviton01 shield_collapse_sound = shield_offline shield_rebuilt_sound = shield_rebuilt shield_hit_effects = 0, gf_li_shield01 shield_hit_effects = 100, gf_li_shield02 shield_hit_effects = 500, gf_li_shield03 separation_explosion = sever_debris LODranges = 0, 20 lootable = true [Shield] nickname = x_shield_li_cruiser DA_archetype = Ships\liberty\li_cruiser\li_cruiser_shield.sur HP_child = SpConnect
shiparch.ini
nickname = li_cruiser ... shield_link = x_shield_li_cruiser, HpMount, HpShield01 hp_type = hp_elite_shield_special_10, HpShield01
loadout:
equip = x_shield_li_cruiser, HpShield01
I know that [Shield] and [ShieldGenerator] have the same nickname, but I doubt that’s the problem since it didn’t work with differing names either.
1) The shield bubble
I took li_freighter_shield.sur and resized it to scale 7 in all directions with Freelancer Model Tool, then renamed it li_cruiser_shield.sur and put it in the right directory. In HardCMP now there’s a nice shield bubble around the cruiser. However, ingame, it’s not. It still uses the hitbox of the cruiser hull.I’ve seen that all other [Shield] entries link to a .3db file, but I wasn’t able to find information about how to make them. I resized li_freighter_shield.3db with FLMT as well, but that didn’t work either. I don’t remember whether FL crashed or it still just used the basic cruiser hitbox.
I noticed that there’s no HpConnect in li_cruiser.cmp, but neither is there one in li_elite.cmp or a few other ships I’ve so far looked at, so that’s probably fine.
What am I missing?
2) Shield behaviour, or: what is offline_threshold for?
Next thing, I tried to shoot that shield down a couple of times and saw some strange behaviour. I know that my shield bubble didn’t work, but instead the ship’s own .sur was used as far as I can tell, and, well, there were some strange things.Variables:
- capacity = 2000
- regeneration rate = 200
- offline_threshold = 0.5
- offline_rebuild_time = 3
What happened:
- Whereever I hit the ship with beam weapons, shield energy drops all the time exactly as it’s supposed to
- When I hit it with torpedos, missiles or mines, the shield only drops when the ship gets hit near its forward gun (that’s where li_cruiser’s HpMount is). No damage in the middle, none in the back, even in the front there’s sometimes no damage at all. It’s basically invulnerable everywhere but the front.
- When the shield goes offline because of mines (Ripper Mine) or Starkiller torpedos, it sometimes comes online from 0 energy, sometimes from 1/3, sometimes 1/2 (1/2 is too much)
- With beam weapons, it always comes online from the point you would expect when comparing capacity to regeneration rate
So I was confused. Then, I started to play with offline_threshold. Standard FL value is 0.15. I couldn’t find any information on what this entry does, that’s why I had set it to 0.5 in the first place.
Variables:
- capacity = 3000
- regeneration_rate = 100
- offline_rebuild_time = 10
Threshold of 1, 5 and 30 lead to a shield that is always offline.
Threshold of 0.5, see above.
Threshold of 0.9:- Leads to the shield having a kind of randomized amount of energy when coming back online. This is true for beam weapons.
- When taken out by mines, it never comes online again.
- Although the pulse weapon I’ve used only did 190 shield damage and the shield had 3000 capacity, 2 shots took it down entirely. Then, it came back online from 0 energy as well.
- Other beam weapons did much more damage, too
So far I’ve only tried ripper mines though. Maybe it’s different for other mines.
I thought threshold could have something to do with ‘damage by a single shot’. That is to say, if the damage is high enough, the shield stays offline. But I wasn’t able to confirm this theory so far.
Does anyone have any insight on those things?
I would’ve loved to have made this a shorter read, but I thought it’d be better to give all of my observations. Thanks to anyone who comments on this.
-
Surs contain the CRCs of the parts they match, so just resizing and renaming won’t be enough. There is now an obj to sur converter.
Can’t say much about the shield (I’ve been away for a while, too, and I’m not as enthusiastic as I once was :)). All I know is that offline_threshold has the effect of reducing the overall capacity. e.g.: if capacity = 3000 and offline_threshold = 0.15, then usable capacity = 3000 * (1 - 0.15) = 2550. You can verify this with Numeric Damage.
-
Does this mean I have to manually create a shield bubble in a modeling program as an .obj file? Can I start from the resized li_freighter_shield.sur when I do this in any way? I couldn’t find a tutorial about that (creating a shield bubble for an existing vanilla ship without a shield bubble). I’d like to know what I have to do exactly before I start to experiment pointlessly.
Do I then need a .3db file at all or can I just link the .sur when it’s done in the [Shield] section like I’ve done already? If so, why don’t all those sections link to .surs in the first place? What’s the .3db good for?
About the second part of your post. So far I’ve known “new” DLLs as plugins for FLHook. Via search I found “FLHack” which has apparently the same thing built-in. So can I use either, with FLHook it would be server-side?
Thanks for the clarification about offline_threshold. I guess it reduces shield capacity for the player as well? I wonder what that parameter is good for.
-
Numeric Damage is a client-side plugin that shows the hull & shield damage numerically; it was ripped straight from FL Hack, as a separate plugin was requested (so if you’re already using FL Hack you won’t need it). It has nothing to do with FLHook (my plugins are all stand-alone).
I’m afraid I’ll leave the other stuff for others to answer…
-
shield_link = x_shield_li_cruiser, HpMount, HpShield01 ```This is part of the problem. I don't know what the shield files are for, but they don't actually seem to create the shield - it uses whatever you link to here. Since apparently capships weren't meant to have shields, their surs have no HpMount, so you have no shield bubble. I guess what you want to do is create a new li_cruiser.sur which contains HpMount. The specifics of that I really will leave to others.
-
Well thank you so far, that’s a start!
If that’s true, I guess I would have to convert li_cruiser.cmp to .obj, use the .obj to .sur converter, add an HpMount via “Append additional Hardpoints to HPid section” in the converter and do everything else that’s needed there, too, to create a new .sur file. Because apparently there’s now way to simply edit an existing .sur file.
I still have no clue about what to do with li_freighter_shield.sur though.
I wonder why I can’t find any topics about this. I assume quite a few people have done this already. Any help would be very much appreciated!
-
About the sur mesh for ships/shield bubbles:
I was testing a lot for Schmackbolzen’s obj to sur converter.
I also tested the usage of shield bubbles and weapon sur-meshes on the ship.
I found out: A shield bubble works like the mesh for a weapon.
These additional meshes are always solid for players flying the ship. This means, if a player uses this ship, you will always have collision with your shieldbubble, even if you don’t have any shield on your ship. Same with weapons.Just NPCs (including stations) can toggle these additional HP-sur-meshes.
About the shield-objects:
shield_link works like this:
shield_link =
shield_object (defined in select_equip),
Hardpoint where the hp_child (defined in select_equip) is attached to (means teleported to the same position and rotation),
Hardpoints for shields using this object.[Shield] (shield link object) uses “empty” 3db files that just contain the hp-point defined at hp_child.
The sur file of these 3db files is now used, because a 3db/cmp file always connects to a sur file of the same name in the same directory.For example:
shield_link = l_freighter_shield01, HpMount, HpShield01
The object “l_freighter_shield01” has one HP, called SpConnect. This one is the hp_child.
The whole object will be moved and rotated until SpConnect has the same position and rotation as HpMount
Shields using HpShield01 will use this shield bubble.For me it always seemed like the object defined in shield_link is not used by the game (thats why your cruiser gets always hit on the hull). Means: Use any standard shield-object there and everything will be finde.
Correct me if I’m wrong.