i have a question about datums! i always have problems in deciding which thing i should make a datum.
right now i have a little game in the making, it has a death_check proc, animals (as mobs), hunger, sleep systems (as procs). I was thinking of making death_check, hunger, and sleep a datum named Systems or something.
but then again i don't know if i should or not. can somebody please tell me which things i should make datums and which not?
with examples (i m not asking for code)
Thanks in advance.
ID:154954
Oct 28 2011, 11:20 pm
|
|
In response to Albro1
|
|
thanks.
|
In response to Albro1
|
|
Albro1 wrote:
> Sleep what does mob/var/Sleep/sleep refers to? can you tell me about it a bit? |
In response to Hashee
|
|
The sleep var is creating a reference to the Sleep datum inside the mob. You can have a sleep datum really easy, but you cant use it unless you reference it in some way.
So, once you create the Sleep datum, you need to reference it so you can call it by creating a variable. With the example I used, you could do this: Sleep Any more questions about datums? |
In response to Albro1
|
|
nope, thanks a lot. :)
|
In response to Albro1
|
|
You have to actually set the variable to something, you know.
mob/var/Sleep/sleep = new() Otherwise you end up with null.Something runtime errors. |
In response to Nadrew
|
|
Yeah. It seems he figured that part out, as he hasn't asked again. But that is a good addition.
|
In response to Albro1
|
|
I personally wouldn't understand why something that could simply be handled via a proc on the mob, is needing a type created just for it? That seems like wasted resources.
|
In response to El Wookie
|
|
In response to El Wookie
|
|
El Wookie wrote:
I personally wouldn't understand why something that could simply be handled via a proc on the mob, is needing a type created just for it? That seems like wasted resources. Using a datum can make things more flexible. For example, you could put a mob's AI in a datum: AI The AI datum contains the logic for how mobs make decisions, plan actions, and execute those actions. You can create different child types of /AI to create different behaviors or difficulty settings: AI To do this using only procs that belong to the mob, you'd have to do something like this: mob Then you'd need if statements or something else to decide which set of procs is called. It's really about organization. You don't have to do it this way, it's just easier to manage. Edit: You can also create child types of /AI to override or extend behavior. If the procs belonged to the mob, you wouldn't be able to do that because that'd make the mob's type bound to specific AI behavior. |
In response to Forum_account
|
|
As always, Forum_Account provides accurate information that helps us all.
<3 |
Unless I'm misunderstanding, I feel like this would be better dealt with by inherited procs.
mob/animal Or something like that. |
In response to Hiead
|
|
Speak(), DeathCheck(), and HungerCheck() all belong to the mob/animal subtype. No normal mob can call those procs(Without using colons, which aren't usually recommended.).
That's why datums make organization easier. Read Forum_account's post thoroughly. Read it again. Then click his name and read his two "programming tips" blog posts. Twice. He gives very useful information. |
Does that help?