Craft limit, Starship limit, Starfighter limit, Object limit

Need help editing the game? Check for help here!

Re: Craft limit, Starship limit, Starfighter limit, Object limit

User avatar
AngeI
Cadet 1st Class
Posts: 139
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Sat Oct 17, 2020 6:39 pm

Thanks for the answer! I had wanted to at least increase the amount of possible lasers from 256 to 512, but this blows it wide open. So I could have 192 flight groups AND 128 asteroids? But Asteroids are also classed as a flight group are the not?

Random Starfighter
Recruit
Posts: 8
Joined: Tue Oct 13, 2020 12:14 am

Post by Random Starfighter » Sat Oct 17, 2020 7:11 pm

FlightGroups are a separate thing from spawned objects, tied more closely to mission logic. When a FG is spawned into the mission, it depends on what kind of object it is. So a craft FG will spawn into the Craft section, counting towards the vanilla limit of 96 craft per region. Meanwhile an asteroid FG will spawn into the Space Object section, counting toward the 128 Space Object limit. But yes, they're both FlightGroups and both count toward the 192 FG limit in the mission file.

I can look into increasing the Space Object count for more asteroids. It didn't work very well when I tried it in XvT, causing some visual artifacts. But it's worth a try in XWA.

User avatar
AngeI
Cadet 1st Class
Posts: 139
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Sat Oct 17, 2020 7:23 pm

Awesome, thanks for the explanation :) Certainly separating out things like asteroids could be useful in populating a mission with a wider area of asteroids instead of travelling a few km out to be clear of it.

Random Starfighter
Recruit
Posts: 8
Joined: Tue Oct 13, 2020 12:14 am

Post by Random Starfighter » Sat Oct 17, 2020 8:01 pm

To increase the number of Space Objects, originally 128 per region, to something like 256:

Code: Select all

At offset 14CD3, replace C1E007 with C1E008
7 is 128 objects, 8 is 256, 9 is 512, etc. Adjust however you want. Since they're not commonly used it may not be necessary to go super high. When the game is performing frame updates, it has to loop over the entire allocated section, whether there's something there or not. That applies to craft and projectiles as well. So if performance is a concern, it's something to keep in mind.

As far as I can tell it's working without any problems. Although having lots of asteroids on screen, besides adding to visual clutter, does contribute to rendering slow-down. More stuff to test.

For mines, they spawn in a grid. So if you assign a mine FG with 8 craft per wave, they spawn an 8x8 grid for 64 total.
For asteroids, they randomly spawn around their starting waypoint. If you assign an asteroid FG with 8 craft per wave, it randomly generates 8 asteroids of varying size and distance.

User avatar
AngeI
Cadet 1st Class
Posts: 139
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Sat Oct 17, 2020 8:39 pm

Thanks mate. I noticed mines actual spawn numbers depend on the difficulty level you set. Lets just assume a single mine, then easy would only spawn the 1 mine, medium spawns 2, hard spawns 3. Also if I simply wanted to increase projectiles to 512 instead of something stupidly high, what would be the offset for that? Is that the same as above or a different code?

Random Starfighter
Recruit
Posts: 8
Joined: Tue Oct 13, 2020 12:14 am

Post by Random Starfighter » Sat Oct 17, 2020 9:17 pm

Difficulty shouldn't matter for mines.

For projectiles, same place, different value. This gives you 512 projectiles.

Code: Select all

At offset 14C68, replace 750BBA1000 with B800020000
At offset 14C6D, replace 0000 with EB0A

User avatar
AngeI
Cadet 1st Class
Posts: 139
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Sat Oct 17, 2020 9:27 pm

Random Starfighter wrote:
Sat Oct 17, 2020 9:17 pm
Difficulty shouldn't matter for mines.
.
It shouldn't but it does for some reason :D This behaviour is the same in TIE Fighter, harder difficulty spawns more mines.

Random Starfighter wrote:
Sat Oct 17, 2020 9:17 pm

For projectiles, same place, different value. This gives you 512 projectiles

Code: Select all

At offset 14C68, replace 750BBA1000 with B800020000
At offset 14C6D, replace 0000 with EB0A
Awesome, thank you! :)

User avatar
Trevor
Ensign
Posts: 447
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sat Oct 17, 2020 9:50 pm

This is just friken awesome.... :)

So, unfortunately being arrays, while logical, doesn't seem to lend itself to any enhancement (tied to single thread cpu).

then again... maybe a hook could take every second entry and process it on a second cpu leaving only half the number for the original game to process.

Trev

Bman
Lieutenant
Posts: 887
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sun Oct 18, 2020 9:12 am

Great! So having more than 6 wingmen per FG for AI FG's would be a great example of using the xwa_hook_mission_tie hook to assign FG texture maps. Asteroid fields would need LOD meshes for performance for sure.
.
Random, have a related question. 1) I know how to make Asteroids targetable in the CMD screen and destroyable by just changing a couple of offsets, the latter to that of a mine type object. The problem is their formation then becomes like a grid similar to the mines and if they take one laser hit, poof! Do you know to properly make them targetable and break up into pieces like a starship, station, and other "normal" object attributes ?
.
2) When enabling RotartyGunTurret meshes on starships, we know right now there is a limit of 16 RotaryGunTurret meshes with a maximum of 2 laser hardpoints per mesh, for any .opt model. Do you have any ideas on how to increase the possible number RotaryGunTurret meshes? Most starship models here have never utilized that feature, but the trade off is we get more laser hardpoints that are mirrored on both sides of a starship, up to 128 or something like that, instead of just 32. But they fire from the hull meshes or static turret meshes. Not as realistic.
.
3) Holy grail question everyone has asked for years... just looking in the Strings.txt file, I believe their is a limit of around 223 fixed craft slots, each with their own unique stats, some categorized by type such as starfighters, freighters, starships, stations, etc. Any clever ideas on how to expand on that to make an unlimited database of unique slots that could be dynamically added to and used for any given mission file? I would assume no, but just asking. Thanks :-)
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

Random Starfighter
Recruit
Posts: 8
Joined: Tue Oct 13, 2020 12:14 am

Post by Random Starfighter » Sun Oct 18, 2020 6:35 pm

I'm speaking from XvT experience here, but basic objects don't have hitpoints, so I'm not sure if there's any way around "one hit kill" without making them spawn in as a craft. If that could be accomplished, it might be possible to have fancier explosions too. But that would be a much more complex patch. I can make asteroids to be merely destructible like mines in XvT, but I don't know where to look in XWA.

No idea about the turrets. I wouldn't know where to begin, either. All I know is there's a limit of 50 mesh components and what looks like 16 active turrets. XvT was the same way.

Yes, the holy grail. These are all fixed-length arrays embedded into the game executable. Resizing or moving them would be a monumental task. The best idea I can think of would be to hook into the mission loading functions and hot-swap entire elements of the array with something else. Kind of like how the hangar hooks can do different things for each mission.

I'm really not very familiar with XWA's coding. Sorry this is all outside of my area of expertise...

User avatar
AngeI
Cadet 1st Class
Posts: 139
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Sun Oct 18, 2020 7:25 pm

Random Starfighter wrote:
Sun Oct 18, 2020 6:35 pm

Yes, the holy grail. These are all fixed-length arrays embedded into the game executable. Resizing or moving them would be a monumental task. The best idea I can think of would be to hook into the mission loading functions and hot-swap entire elements of the array with something else. Kind of like how the hangar hooks can do different things for each mission.
Is this what the hooks actually do? Replace entire sets of code by calling them instead of the base code? I'm not a coder, best I can do is manipulate it when I understand what some things do :D

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 584
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Oct 18, 2020 10:26 pm

Hooks replace game code with new code, generally at the function level (that is, they replace original-game subroutines with new versions). That's why they're .dlls. As such, they can do very nearly anything; the trick is understanding the engine enough to know how to do what you want to do.

I've long thought that while circumventing the craft slot limit outright may be too complex a change to effect, Random's proposal may be tenable. A hook that runs during mission initialization should be able to rewrite the in-memory craft table using a mission-specific craft list, taking craft stats from individual craft text files (probably xml for this kind of data). In addition to that, the info loaded dynamically from the various files (strings.txt, .dat files for ship icons, etc.) would all have to be located and similarly reloaded from craft-specific files. Then there would be various side effects on areas of the game outside the flight engine to address - player stats, the tech room, multiplayer synchronization, maybe others.

By the way, thanks for dropping in, Random! Exciting stuff.

User avatar
AngeI
Cadet 1st Class
Posts: 139
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Sun Oct 18, 2020 10:45 pm

So in theory, if someone had the knowledge, time and patience, they could rewrite the imuse code or at least make it... better? Perhaps even support higher quality sound like mp3s :D

Bman
Lieutenant
Posts: 887
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon Oct 19, 2020 4:11 am

Kieran, that's pretty much what I'm aluding to. Swapping out the strings.txt file with another one temporarily on a per mission basis. No need to change slots stats. For example using corvette slot and substituting with a hammerhead corvette. Crafts that can share reasonable and similar stats already defined in original slot. Just keeping it simple.
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 584
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Mon Oct 19, 2020 6:23 am

I believe that can already be done with the mission objects hook.

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2661
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Oct 20, 2020 4:16 pm

WIP

Hello,
To make testing more easier, I've included the patch in a hook.

xwa_hook_crafts_count_WIP_2010201745.zip
You do not have the required permissions to view the files attached to this post.

Bman
Lieutenant
Posts: 887
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Thu Oct 22, 2020 4:52 am

Thanks Jeremy.
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

Post Reply