Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → FYI: There appears to be a limit of nested messages used in cog
FYI: There appears to be a limit of nested messages used in cog
2004-09-29, 7:10 PM #1
This might be in the JK Specs or DataMaster...but I didn't see it and this is the first I've found of it so I'm posting here.

While writing my AI cog, which I've been trying to compartmentalize into tons of small 'functions' (message calls) to avoid redundant code...I appear to have run into a limit for nested message calls. After debugging my code excessively, I finally tracked it down. It was mind numbing because I didn't know about this and the 'function' was working fine in all other parts of code so therefore I did not suspect it.

pulse calls a message I created called offense. Offense calls movetotarget which in turn calls checkmove which in certain conditions calls strafe. Strafe then attempts to call a generic pathfinding message, checkdepth and fails to do so.

Pulse -> offense -> movetotarget -> checkmove -> strafe -> (fail 6)checkdepth

Thus the limit appears to be 5 message call depth...well, that is if you count the inital message. I don't know if this applies differently when using game messages or made up messages like I have, but I suspect there is no difference.

This is only mildly annoying now that I know about it since I'll just have to rework things a bit. But I was going insane because I couldn't see why it was failing!

Just an FYI in case you didn't know.
-El Scorcho

"Its dodgeball time!" -Stormy Waters
2004-09-29, 8:43 PM #2
I remember something like this. You want to avoid things like this, because JK has a stack for the message nestingness thing
Code:
firebullet:
FireProjectile(...);
call firebullet;
return;

You also cannot have more than 5 sleeps running at any one time in a single cog, or it will mess up quite badly.
May the mass times acceleration be with you.
2004-09-29, 9:10 PM #3
The nested message limit is described in the DataMaster (v0.6.2) in its Tutorials, Chapter 3, Threads section.

El Scorcho's description seems to match with the DM, but check out the DM just to make sure.

BTW, good job and thanks, El Scorcho; I (and I am sure others) appreciate your effort and your thoughtfulness in posting (potentially) new editing information.

(On a related note: I am trying to make a better way of providing JK editing information to all editors, so none of us will have to go through what El Scorcho just did. My current projects include: JK/MotS Editing Hub and JKTechReference {a consolidated, updated, concise, more detailed JKSpecs and DataMaster}. Anyone have any other ideas? Email or PM me; don't hijack this thread.)

:)
2004-09-29, 9:10 PM #4
Quote:
Originally posted by Darth Slaw

You also cannot have more than 5 sleeps running at any one time in a single cog, or it will mess up quite badly.


Yeah, I learned that the hard way.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-09-30, 1:09 AM #5
Yep - I'm pretty much convinced that Zeq's right with the nested limit mention; I was trying to recall where I had seen that odd bit of information (knew the problem sounded familiar) but Zeq beat me to to it with the DataMaster reference ;)

If you can possibly reduce/regroup some of the call functions, you should be ok, but I can imagine that without this piece of information, you could spend countless hours trying to debug code that technically works but wouldn't actually work because of the call stack limit... :o ;)

Hope this info helps :D

-Jackpot
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-09-30, 6:26 AM #6
You know, to tell you the truth I think I probably even read that tutorial awhile back. But for some reason I remembered it as a limit on nested for loops or something...

Z is correct. I was going quite insane before I finally figured it out. Luckily, I only spend maybe 2 hours on it before via heavy use of fired bryar bolts and print statements I determined what was up.

I had written the code right into the original message the night before, but had decided I may want to use the strafe code again in another area. So I moved it out into its own message and called it....then I ate dinner and forgot what I had just done. That's where the trouble started. I went through the code over and over and just couldn't see anything wrong with it at all! Then I pasted the whole damn function back in where the call message was and it worked.

Its no big deal now that I found it, I'll probably just dump a specialized version for checkdepth right into strafe.
-El Scorcho

"Its dodgeball time!" -Stormy Waters

↑ Up to the top!