Thursday, 24 March 2011

A comparison of Vanilla and Aurora's (broken) implementation of NPCs

So I browsed the aurora rexbot code and here's what I came up with so far.
All the versions of the bots seem to use the IClientAPI interface so the aurora bot ought to be similar to the vanilla version in terms of reasons why it's bust..

So... some speculation....

Since the Aurora code is using more or less the same scene code as from the original opensim 0.7 codebase and then subsequently modifying it, combined with the fact that it was mods to the larger codebase that broke the Aurora version of the NPC bot I could hypothesize that the rexbot code (which was left alone) may have some clues as to why the code in the original vanilla 0.7 isn't working.

So I went and looked and there is indeed a chunk load of differences between how to instantiate a bot in the vanilla NPCModule class which is the wrapper for the NPCAvatar class which is the bot itself and the Aurora version (rexbot).

In the Aurora version version, a fast eyeball of the code it looks like Aurora.BotManager.RexBotManager.cs is the wrapper class i.e. the equivalent of NPCModule.cs and Rexbot.cs is the equivalent of NPCAvatar. There are differences of course since Rexbot is way more complicated and implements a bunch more interfaces than just the IClientAPI which is implemented in the vanilla code. The vanilla code is way simpler with many less moving parts.

So... moving onwards... I looked at the relevant code sections to instantiate a bot (the vanilla code is void m_timer_Elapsed) and the aurora code is RexBotManager.CreaterAvatar

The flow is more or less the same but with some differences.

The Aurora code passes in a full AgentCircuitData whereas the vanilla builds up an AgentCircuitData after the fact by using only a randomly generated CircuitCode. Maybe more research is needed on all the other associated crap such as how to generate valid endpoints etc in order to get a valid AgentCircuitData.... (Subsequently Rev Smythe says endpoints can be left as null because an NPC shouldn't really case about networks - but we'll leave that out there in case the code actually *does* care even though it *shouldn't*).

The Aurora code also runs m_scene.AuthenticateHandler (whereas the vanilla code doesn't).
then they both run m_scene.AddNewClient.

Vanilla does a conditional check to return the scenepresence back from the scene by doing scene.TryGetScenePresence and Aurora is just a direct call (no if statement) to m_scene.GetScenePresence.

Then Aurora does a scenepresence.appearance.setappearance which some texture stuff and visual params stuff
whereas Vanilla does a settextureentries then a separate setvisualparams.

Next Aurora does a sp.SendAppearanceToAllOtherAgents and so does vanilla.

Then Aurora has a line of code Vanilla doesn't have which is sp.sendavatardatatoallagents.

Then Aurora does some wrapper class crap which is functionally the same as vanilla does.

So... speculation.... I suspect that the missing feedback stuff *might* be in sp.sendavatardatatoallagents, so that piece might be worth adding in.

Certainly does sound like it because I know we're missing the bake-on-local-machine-and-then-upload-to-server piece which I've been trying to piece together out of radegast et cetera.

I'n going to do a bit more digging and I'll let you know what I find.

No comments:

Post a Comment