Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.

K.A.

Sergeant at Arms
WBWF&SVC
Hi. Some questions about function performance.
Given a scene prop instance, which is faster:
- retrieving and checking the var id ?
- retrieving a value from scene prop slot ?

And, generally, what is the impact on performance of slots ?
Thanks.
 
Ahm, does anyone know if too many mission triggers firing every few seconds same scene affect FPS? Right now, I have over 15-16 triggers running for several actions (Troop-specific AI mostly, I will eventually pile them together on one trigger but I also heard seperate triggers are more healthy for FPS.)

Would FPS be affected too much when it comes to running 30-35 triggers? Some would go loop for every agent to get troop IDs, some would check other stuff and so on.
 

Ramaraunt

Efe Karacar said:
Ahm, does anyone know if too many mission triggers firing every few seconds same scene affect FPS? Right now, I have over 15-16 triggers running for several actions (Troop-specific AI mostly, I will eventually pile them together on one trigger but I also heard seperate triggers are more healthy for FPS.)

Would FPS be affected too much when it comes to running 30-35 triggers? Some would go loop for every agent to get troop IDs, some would check other stuff and so on.

My experience with triggers so far is that they are super nice, but don't make that many of them or it will laggggggg.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Efe Karacar said:
Would FPS be affected too much when it comes to running 30-35 triggers? Some would go loop for every agent to get troop IDs, some would check other stuff and so on.

its not the amount of triggers, but what each one is doing and how optimized your code is. So test EACH one in separated and measure the FPS impact, and improve the ones that are causing a drop.



DarkNord said:
I "fixed" last problem but now i cant edit factions and parties and i need that do change SP...

Read the tutorials/guides (see sticky threads), its quite easy to do so using the .py files

(Tools are for the weak, real devs work with Notepad! jk! They use a decent editor, like SublimeText)



Ramaraunt said:
Is there a reason why troops aren't being added to this ferry station i'm working on, I'm using this pretty basic simple trigger, and even this doesn't work.

debug your code and check if the slot is correct (bound center), which faction it is using and if the operations are being called to reinforce the ferries

keep in mind the template may add few troops, so you may need to add a secondary loop there (keep adding more until garrison is at least 50 would be a example)
 
I already knew that, what I was asking was if anyone tried such tests and his results afterwards. I guess I will just see as I progress. Thanks anyway.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Efe Karacar said:
I already knew that, what I was asking was if anyone tried such tests and his results afterwards.

any mod with triggers did this in a way or another. As is a very particular problem that only affects your mod (because your code is unique), the only answer is: you need to test it yourself.

check VC code if you want to see a modsys with many triggers (that had to be optimized)
 

DarkNord

Sergeant
:grin:
Well if outcome is easier everyone should choose easier option xD.At least my opinion.And how do i edit scenes?I know to do it in edit mode but again:It gets overwritten after compiling.?
 

Nate

Knight at Arms
M&BWB
If it's possible, how would one create a new type of tuple? (like how troop and item are tuple types). I'd like to create a new type of tuple so that I can use it for slot functionality. I'm assuming I'd be able to create slots for it, but that's another thing which I'm not sure is possible.

Or does a slot not need a tuple to be possible? There are agent slots, for example, but I don't think of agents as tuples. Yet jik said in some tutorial that "Slots can be assigned to any tuple object (troops, factions, parties, quest, etc.) and can store a specific value that is used by all in that object type."
 
Use troop slots. Superfluous or "dummy" troops don't affect anything else, so you can use them as much as you want (within reason since too many can affect save file size). Unlike the other tuple types, troops are never cycled through in their entirety.

trp_temp_troop gets used a lot in native, so look at how and where that is used if you need inspiration.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
DarkNord said:
how do i edit scenes?

read the guides and see videos in the first post
https://forums.taleworlds.com/index.php/topic,163368.0.html



Nate said:
tuple so that I can use it for slot functionality.
Tuple is Python. Slots are MBScript. If you don't know how to code in a language like Python your best bet is to use a OSP solution for arrays. Check the OSP section.

not the only solution, but my favourite by far:
https://forums.taleworlds.com/index.php/topic,335511.msg7953775.html#msg7953775
 

Nate

Knight at Arms
M&BWB
Thanks hinds and kalarhan. I'll probably try the dummy troop solution out, since my Python coding proficiency is very low, but I'll give WARP a look too.



kalarhan said:
its not the amount of triggers, but what each one is doing and how optimized your code is. So test EACH one in separated and measure the FPS impact, and improve the ones that are causing a drop.

Like many of your advisory statements, kalarhan, this one went into my modding knowledge database--you and hinds have proven to be frequent contributors! Obviously your point here is that the number of triggers is not as impactful as what the triggers themselves are doing. But to confirm, are you saying that multiple triggers literally have no additional stress impact at all compared to a single trigger? (or something so negligible as to never need consideration). Like if I created 20 separate triggers w/ the same content (and check interval and whatnot) as a single trigger, would the former cause more lag or the same amount?



 

DarkNord

Sergeant
Guys i created new troop (not really troop she's meant to be NPC)And gave her entry(60).compiled and all that but when in edit mode i add entry point 60 she is not there.Do i need to create dialogs so then she will be visible?.(And no im not stupid i would made dialogs i just wanted to see how she look in game).and i didn't found solution for my last problem abou scenes gets overwritten and if someone can tell me what to do dont give me these link as i already read them all.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
DarkNord said:
Guys i created new troop (not really troop she's meant to be NPC)And gave her entry(60).compiled and all that but when in edit mode i add entry point 60 she is not there.Do i need to create dialogs so then she will be visible?.(And no im not stupid i would made dialogs i just wanted to see how she look in game).and i didn't found solution for my last problem abou scenes gets overwritten and if someone can tell me what to do dont give me these link as i already read them all.

You posted on the Guild thread. Did you read the tutorials/faqs? There are a few Youtube videos there that teach you all you need to know to start working on scenes :XD

Scene 3D object is one thingy, and goes on your /scenesObj folder.

module_scenes.py / scenes.txt is just the hook for the engine. It just says: tavern ABC is object 123.

To add troops to a scene you can check the game code (.py, not .txt) for the (set_visitor, ...) operation.
 

DarkNord

Sergeant
Ok everything so far is good.And what about World Map?Will it get overwritten when i compile because i dont want to make it in vain
 

kalarhan

Python Saint
Count
WBNWVCWF&S
DarkNord said:
Ok everything so far is good.And what about World Map?Will it get overwritten when i compile because i dont want to make it in vain

if you mean the map as the 3D object: different things. Answer is no

module_parties.py /  parties.txt is just the hook (this town goes here), has nothing to do with the object

worldmap is saved on maps.txt which has nothing to do with modsys
 

Nate

Knight at Arms
M&BWB
I've been doing some research on slots. Here's something that prompted a question: (couldn't get the regular quote stuff to work so I improvised)

[quote author=domipoppe]
slots are like "saved" variables. They are saved until the server/client shuts down. Depends on serverside/clientside slots. If you start the server all slots will have "0" as the standard input.
[/quote]
[quote author=domipoppe]
Player slots exist as long as the player is on the server/game.
Agent slot exist as long as the agent is actually existing.
[/quote]

Does this mean that by default a slot's value is retained even when a server changes the mission and scene? (assuming the slot is tied to an entity type whose existence is not treated as temporary)

Also, where's the best place in module_constants to add troop slots? The following are making me wary:

Code:
slot_troop_will_join_prison_break      = 161

troop_slots_reserved_for_relations_start        = 165 #this is based on id_troops, and might change

slot_troop_relations_begin				= 0 #this creates an array for relations between troops
#Right now, lords start at 165 and run to around 290, including pretenders

In my ID_troops file the last pretender is trp_kingdom_6_pretender = 362. I'm assuming that concludes the list of lords and pretenders. Does this mean I need to number my added troop slots 363+?
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Nate said:
I've been doing some research on slots.

don't mix SP with MP concepts.

SP data goes to your savegame, so stuff like values on a troop are stored. Troops/parties can be used as a fake array. And so on.

Are you working with a SP or MP mod?
 
Status
Not open for further replies.
Top Bottom