More Awesome Than You!
Welcome, Guest. Please login or register.
2024 March 28, 23:31:30

Login with username, password and session length
Search:     Advanced search
540270 Posts in 18066 Topics by 6511 Members
Latest Member: zheng
* Home Help Search Login Register
+  More Awesome Than You!
|-+  TS2: Burnination
| |-+  The Podium
| | |-+  Check Tree (in)efficiency
0 Members and 1 Chinese Bot are viewing this topic. « previous next »
Pages: [1] THANKS THIS IS GREAT Print
Author Topic: Check Tree (in)efficiency  (Read 6097 times)
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Check Tree (in)efficiency
« on: 2009 April 26, 00:35:02 »
THANKS THIS IS GREAT

I am having some problems with "Too Many Iterations" errors from wants check trees with my extented family hack - the hack is here, but if you don't feel like wading through simantics, I have attached a pseudocode summary of the four extended family BHAVs to this post.  The problem check tree is CT - Family Reunion, which runs through the neighborhood looking for 5 sims that are related to the want-roller.  Naturally, I have set it up to check for extended family relationships using the BHAVs detailed in the pseudocode.  Formerly, I was only having this problem when the want-roller was a certain dead sim who I suspect may be somewhat borked, so I put in a check to prevent the loop in CT - Family Reunion from starting when the want-roller was dead.  But now, I have two grandkids born to a pair of (alive, non-borky) family sims, and every time I reroll their wants it's "Too Many Iterations" and empty want slots.  One of these sims is a former townie with no parents, and thus most of the code blocks should have been skipped anyway. 

I don't think my algorithms are too involved; they don't call themselves, they don't call each other, and they don't call any BHAVs except the Verify - Neighbor ID BHAV and global 0x0337; everything else is primitives.  Am I wrong?  Is there a better way to do it?  Is global 0x0337 some kind of inefficient waste of space and I just had no idea?  I did try to call 0x0337 beforehand and simply pass the parent NIDS to the four functions, but that would mean I need 6 arguments, and SimPE doesn't seem to want to let me use more than 4.

Help?

Incidentally, I don't understand the first part of some of these error messages - something to do with Object Scripts and display cases?  I've attached an example.

* pseudocode.txt (2.15 KB - downloaded 245 times.)
Logged

I was thinking about these things and I am a feminist.

tunaisafish
Axe Murderer
Exasperating Eyesore
*
Posts: 245



View Profile
Re: Check Tree (in)efficiency
« Reply #1 on: 2009 April 26, 01:52:18 »
THANKS THIS IS GREAT

The Script Errors are LUA errors.
I've posted the LUA source in Trogdor so you can search those function names an hopefully get a better idea of what is going on there.

As for passing more than 4 args;  You can store the arguments in Temps, and use the 'Pass Temps' button on the wizard.
This copies the necessary temp values into param for the called bhav (Temp0 -> Param 0, etc...)
So if that global bhav already uses more than 4, then you can supply them without having to edit it.

Logged

rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: Check Tree (in)efficiency
« Reply #2 on: 2009 April 26, 02:03:56 »
THANKS THIS IS GREAT

Ah, thanks, I forgot about Temps.  Why is there a limit on four arguments, though?  Four arguments is only 8 operands, but in the editor you get 16.
Logged

I was thinking about these things and I am a feminist.

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26281



View Profile
Re: Check Tree (in)efficiency
« Reply #3 on: 2009 April 26, 02:17:51 »
THANKS THIS IS GREAT

Interesting, there is a horrible bug which occurs if a function seems to use more than 8 arguments. This is what causes the Apartment Door Bug, that more than 8 arguments will not pass successfully...and it seems this bug is shared, either by intent or accident, with SimPE. Weird.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: Check Tree (in)efficiency
« Reply #4 on: 2009 April 26, 02:34:32 »
THANKS THIS IS GREAT

Tuna, I looked at your most recent thread in BoT, but it does not make much more sense to me than opening the Object Scripts/ObjectScripts.package in SimPE did, and I have no idea what display cases have to do with family relationships or the wants controller, especially since the only actual display cases in my game are in a community lot which I have placed but never used, including never having had any sims visit it.
Logged

I was thinking about these things and I am a feminist.

tunaisafish
Axe Murderer
Exasperating Eyesore
*
Posts: 245



View Profile
Re: Check Tree (in)efficiency
« Reply #5 on: 2009 April 26, 02:50:24 »
THANKS THIS IS GREAT

Ah, thanks, I forgot about Temps.  Why is there a limit on four arguments, though?  Four arguments is only 8 operands, but in the editor you get 16.

The 16 Operands (bytes) are used by the 'node'.  They vary depending whether you ar calling a primitive or calling a function.  Some bytes will be used as flags, and some will be data.
When calling another bhav.  If the flags are set to pass 4 args, then 4*3bytes are needed as data.  Each arg is described with one byte showing the 'owner' (local, temp, param, literal, const, etc.), and 2 bytes for the offset (or value).

The '4 arg' and 'use temps' methods are the most common ones used in the game.  There is a way to pass 8 constants though in one node using only the operands - though it's not that useful.  There's an old thread on MTS2 you can use if you ever need that ability.  If you set the operands manually SimPE will tell you what you are actuallly passing.

Most of those 16 Operands have been worked out over the years by dozens of people, and there are still some unknowns.

Interesting, there is a horrible bug which occurs if a function seems to use more than 8 arguments. This is what causes the Apartment Door Bug, that more than 8 arguments will not pass successfully...and it seems this bug is shared, either by intent or accident, with SimPE. Weird.

The only BHAV I've seen that use more than 8 args are called from Entry Points, (using the FFFF... Ops (aka pass temps)).
The args above param7 are consistent, but I couldn't figure out where they come from.

@Rufio, yeah I took a quick look at that lua, and wondered what the hell it had to do with relationships too.

ETA: Link to the 'more than 8 args' discussion at MTS2. http://www.modthesims2.com/showthread.php?t=306923
« Last Edit: 2009 April 26, 03:07:44 by tunaisafish » Logged

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26281



View Profile
Re: Check Tree (in)efficiency
« Reply #6 on: 2009 April 26, 03:06:19 »
THANKS THIS IS GREAT

I haven't seen it. If you want to look at one that is broken, look at 208A in DoorGlobals. You know of one that passes more than 8 and actually works?
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: Check Tree (in)efficiency
« Reply #7 on: 2009 April 26, 03:31:14 »
THANKS THIS IS GREAT

If the flags are set to pass 4 args, then 4*3bytes are needed as data.  Each arg is described with one byte showing the 'owner' (local, temp, param, literal, const, etc.), and 2 bytes for the offset (or value).

Oh right... duh.

Quote
@Rufio, yeah I took a quick look at that lua, and wondered what the hell it had to do with relationships too.

I had thought before that they might be something to do with the NIDs being misinterpreted as Object IDs, like the SOs that don't have anything to do with anything, but yeah.  Undecided
Logged

I was thinking about these things and I am a feminist.

tunaisafish
Axe Murderer
Exasperating Eyesore
*
Posts: 245



View Profile
Re: Check Tree (in)efficiency
« Reply #8 on: 2009 April 26, 04:17:52 »
THANKS THIS IS GREAT

@Pes, I don't know of any offhand.

The one you fixed is passing more than 8.  If it was passing zero's instead of the args then SimPE is doing a better job than Edith Smiley
If not, then something has changed since NL ~ it was about then that the flags causing "all zeros" to be passed was found.

That might be the Numenor was talking about.  Param 8 is labelled as 'moving foot' somewhere, then gets labelled in another (and used) as a boolean '[FBA/FFO?]'.
I think that param 8 is something to do with "Find Best Action/Find Functional O???", and it's only used to decide whether to display a thought bubble.  So if param 8 is still broke then it's not a biggie.
Logged

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26281



View Profile
Re: Check Tree (in)efficiency
« Reply #9 on: 2009 April 26, 05:11:33 »
THANKS THIS IS GREAT

The one you fixed is passing more than 8.  If it was passing zero's instead of the args then SimPE is doing a better job than Edith Smiley
If not, then something has changed since NL ~ it was about then that the flags causing "all zeros" to be passed was found.
It was passing zeroes. SimPE 68, the one I'm still using, also claims that this particular call is "passing zeroes". In fact, it will pass zeroes even if called using explicit 4-arg format, and 68 will still interpret this as "passing zeroes", which actually happens in the game, too, meaning the bug is shared between them. Since only the first arguments are even USED for anything, I changed the pass-format so that the relevant arguments would be properly passed.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: Check Tree (in)efficiency
« Reply #10 on: 2009 April 26, 14:50:48 »
THANKS THIS IS GREAT

Ok, I tried rewriting my hack so that it calls 0x0337 before the four other BHAVs and then passes the results via temps, but it still complains of "Too Many Iterations".  What exactly counts as "Too Many Iterations" in check trees?  Is there any way to change it to something more reasonable?
Logged

I was thinking about these things and I am a feminist.

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.083 seconds with 20 queries.