Jump to content

Home

Limitations


Recommended Posts

The mod I'm working on now adds sort of a new turn on Kotor:TSL. It kind of puts you into a Generals perspective of the game, and allows you, through dialog, to command troops around an area.

 

Right now, I have this small little vision in my head and basic idea on how im going to do it. Im going to have a module, don't know which on yet, where the PC stands attop a high perch and watches down on a battlefield below. The PC, can command a group of NPC's around this battlefield.

 

I have this idea, that I can get sort of an "everlasting" battle by adding a small spawn script to the combatents OnDeath script, making it spawn another of the same Charecter, and keep the chain going as charecters die, more charecters appear, the same amount of course. Now, I currently have NO knowledge of those OnDeath scripts, so would that work? Or would I have the PC staring at a normal corpse filled battlefield and fighting against a dead foe?

 

And for my main question that deals with this same subject, How many NPC could Possible be in one module, without making Kotor Explode? I know alot of it depends on Precessing Power and Ram, But is they're an actuall limit to how many NPC can be running in the TSL engine?

Link to comment
Share on other sites

(snip)

And for my main question that deals with this same subject, How many NPC could Possible be in one module, without making Kotor Explode? I know alot of it depends on Precessing Power and Ram, But is they're an actuall limit to how many NPC can be running in the TSL engine?

 

I suppose it depends to a large degree how powerful the player's machine is. On my computer (AMD Athlon XP 2600+ processor) I found the "pain threshold" to be around 12 NPCs simultaneously fighting when I made a mod enabling pit fights between two teams of NPCs, above which the slowdowns were very noticable. It also depends on what kind of battle the NPCs do though. NPCs with a lot of force power and grenade use slow things down more than plain melee brawlers.

 

There are some things that can be done to push the limit further upwards though. Combat AI and pathfinding can be quite resource intensive when a large amount of NPCs are present.

 

You can try to minimize pathfinding by using open areas with no obstacles to navigate around, and use the ActionMoveToLocation() functions rather than ActionMoveToObject() to make NPCs move about since the former tries to walk to the target pretty much in a straight line no matter what's in between, while the latter tries to pathfind around obstacles.

 

More impotantly, Combat AI can be quite resource intensive when many NPCs are actively fighting. You can reduce this by removing the combat AI alltogether from the individual combatant NPCs, and "remote control" them from a single AI script that controls all NPCs on the battle field (or one for each team at least). In larger battles with many participants "dumb" AI won't be as noticable as when fighting fewer opponents. The controller AI (which you can stick on an invisible placeable or something) would be tailor made for your battle and remove all unnessecary checks and actions that the generic AI has. The controller AI could also keep check on how many NPCs are alive, and respawn dead ones as needed.

 

This could free up enough resources to add more NPCs on each team. To be sure, assign scripts with an empty main method to all the AI event slots on the NPCs, since it's possible the game defaults to standard scripts if the slots are empty.

 

(This is pretty much what Bioware had to do in the invasion scene in NWN:Hordes of the Underdark, since the Aurora/Odyssey engines aren't really designed with large scale battles in mind. That battle was still a bit slow, but at least playable. :))

Link to comment
Share on other sites

I have found that a module is quite capable of handeling more than 12 NPC's provided that your UTC files are loaded with the module. The more creatures and NPC's that are loaded after module load by scripts the more a module bogs down and begins to lag. Also it's dependant upon if you are spawning 30 creatures at once or if you are spawning them intermitentely. Such as 5 here 8 there and so on. Also another cool module object that I would recomend using for multiple creatures attacking or approaching a character would be a "UTE" file. This is actually a Encounter object that is capable of managing multiple creatures and can be quite handy. With the UTE you could have multiple units on screen and command each unit seperately with the proper scripting.

Link to comment
Share on other sites

I have found that a module is quite capable of handeling more than 12 NPC's provided that your UTC files are loaded with the module.

 

As said, it depends on the computer running the game, and what the NPCs are doing. If they are just standing around, doing nothing the game can handle a fair number of them in the same area. If some are moving around the number drops somewhat, since pathfinding can be very resource intensive in this game engine. (The Citadel Station plaza in TSL is one example of this, where the game can slow down to a crawl just by having 6 NPCs walk around the area simultaneously.)

 

If they are all fighting, (as I believe was intended in this case) the number of NPCs you can have without heavy slowdown drops quite drastically. AI scripts can be very resource intensive when multiple NPCs run them at once in a combat situation.

 

But it depends on what target hardware you aim for. If you have a new computer I'm sure you can manage to squeeze in more of them before it becomes unplayable. On an AMD Athlon XP 2600+ powered machine about 12 NPCs fighting (plus three NPCs standing around doing nothing in other rooms, +3 party members standing around watching) seems to be the threshold for when the slowdowns become annoyingly noticable.

 

As for encounters, I suppose they may be used in such a situation but I doubt they'll make any difference in the number of creatures you can have at a time. Encounters are essentially just special purpose Triggers that simplify spawning groups of leveled creatures depending on the level of the player when someone trips them. Saves you the trouble to write scripts doing it, but they work pretty much the same. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...