22 Oct, 2010, kiasyn wrote in the 21st comment:
Votes: 0
KaVir said:
Scandum said:
What seems the most logical to me is to have a player socket, and replace the player socket with an AI module for mobs, as the mud shouldn't care if commands come from human input or some AI module.

That is what I do - the Brain provides the common interface, so that the Thing can send and receive data to and from the Brain, regardless of whether it's using a socket or an AI module.


I would love to see some more in depth examples of this; eg how you handle input from ai opposed to players etc ;)
25 Oct, 2010, Mudder wrote in the 22nd comment:
Votes: 0
kiasyn said:
I would love to see some more in depth examples of this; eg how you handle input from ai opposed to players etc ;)


OooO, yeah!
26 Oct, 2010, balakoth wrote in the 23rd comment:
Votes: 0
I think mostly curious about how the information is stored.

I mean do you simply hold multiple pointers for stuff in say a "Things class" and have a type id.. such as you would have a Creature * cthing, Object * othing inside of a thing… etc

You said you are keeping a list of brains, but if brain is just a natural derived class, arent you needing to make a list of each type of brain? (as HUmanbrain and mobilebrain would just derive all the standards from brain, but as of course two diff classes which yo uare unable to keep in a list together?)

Just from your explination it seems like there is alot of cross referencing pointer association? (Creature can point to HumanBrain instance, and the Humanbrain instance points back to the Creature) and you are using overloading to allow you to write almost of a wrapper ( should i say) to access the elements as you need them with one function?
26 Oct, 2010, David Haley wrote in the 24th comment:
Votes: 0
balakoth said:
I mean do you simply hold multiple pointers for stuff in say a "Things class" and have a type id.. such as you would have a Creature * cthing, Object * othing inside of a thing… etc

It might help if you drew out a situation that required you to store this kind of data. It seems to me that your question might be due to a lack of clarity on which responsibilities exist and how they interact with each other.

For example, if a 'brain' can control a 'thing', then you need merely have pointers between them. Inheritance will take care of a human brain and an NPC brain looking the same as far as the 'thing' is concerned.
26 Oct, 2010, balakoth wrote in the 25th comment:
Votes: 0
This is kind of my way of thinking.. just using brain for the fact it was kind of a keynote in the conversation :).

Its most likely my misunderstanding of how to use base and derived classes.


Thing –|—————————–|
(id, uid, name, description, location, contents, movement, lua, command interp)
| |
Creature Object
(Attributes, Other stats) |
| (object stats)
Brain Item —– House —— Terrain —– Other
(Handler, Saving)
|
Human Brain —————- MonsterBrain
| |
Socket Combat Routines
| |
Player Only Data Monster Only Data
26 Oct, 2010, David Haley wrote in the 26th comment:
Votes: 0
Is that an inheritance diagram, such that Creature and Object derive from Thing, and then Brain derives from Creature? I view the Brain hierarchy as a separate chain from the Thing hierarchy; Things and Brains interact with each other, but a Brain is not a Thing (nor vice-versa).
26 Oct, 2010, Runter wrote in the 27th comment:
Votes: 0
I sort of think the cutesy name is misleading. Brain in this context isn't something that needs modeled in the game space. Certainly not inheriting from characters. What you can actually consider this as is an interface. Ie anything implementing it agrees to certain definitions. I mean were not talking about the physical brain here. When the mind is swapped the physical brain would remain. I think DH was alluding to this earlier in the thread.
26 Oct, 2010, balakoth wrote in the 28th comment:
Votes: 0
Yeah while I was looking at it.. Id see how brain would be a separate base.

Now with polymorphism and the use of templates, Id assume one could make a list of "brains", I guess Im just a bit confused on how youd decipher the two as individual different types in the same list.

This may be more of my issue.

The same thing would go for a list of things, you have your list, of Thing, but any of the things could be object, or a creature. Without keeping a list of Things, Objects and Creatures; is it possible to access the list of Things and operate an individual instance of a Thing as what its main function is (an object or a creature)
26 Oct, 2010, jurdendurden wrote in the 29th comment:
Votes: 0
There's no real need for seperate lists unless you're just trying to save on cpu cycles. Each thing could have a set of flags, with some of them being IS_OBJECT, IS_CREATURE, IS_ORGANIC, whatever you want to do with it. When you need to loop through them, make your appropriate if checks, and go from there.


Edit: The whole idea behind this though is to not have to worry about that. The idea is so that objects, creatures, plants, scenery can all be interacted with the same exact way. You could talk to a wall (it may or may not respond), destroy a statue (or creature), etc…
27 Oct, 2010, KaVir wrote in the 30th comment:
Votes: 0
Delayed response, as I'm on vacation and have limited internet access (and none at all for the last 3 days).

kiasyn said:
I would love to see some more in depth examples of this; eg how you handle input from ai opposed to players etc ;)

They're handled by the parser in the same way, the only difference is that the Socket sends its data to the HumanBrain, while the MobileBrain generates the data itself.

balakoth said:
I mean do you simply hold multiple pointers for stuff in say a "Things class" and have a type id.. such as you would have a Creature * cthing, Object * othing inside of a thing… etc

No, I only ever store pointers to Thing and Brain.

balakoth said:
You said you are keeping a list of brains, but if brain is just a natural derived class, arent you needing to make a list of each type of brain? (as HUmanbrain and mobilebrain would just derive all the standards from brain, but as of course two diff classes which yo uare unable to keep in a list together?)

I maintain one list of Things, and one list of Brains - there's no need to maintain individual lists of Creatures, MobileBrains, etc. However I do have a GetType() method I can use if I need to know the precise type, and I can then cast if necessary, eg:

void CmdMssp( IBrain *apBrain, std::string &arCommand, std::string &arArgument )
{
if ( apBrain != NULL && apBrain->GetType() == IBrain::eHUMAN )
{
// Send the request for MSSP variable/s to the HumanBrain.
(dynamic_cast<IHumanBrain*>(apBrain))->PutMssp(arArgument);
}
}
In most cases I don't care what type of Brain or Thing it is though.
20.0/30