Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 55 56 [57] 58 59 ... 61

Author Topic: [SUGGESTIONS] for DFhack plugins  (Read 143399 times)

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #840 on: October 27, 2016, 07:41:38 pm »

int_32t is a type defined in the C standard and does not have any emotion system defined within it. Your entire issue seems to be based on a fundamental misunderstanding of what enums are.

https://github.com/DFHack/df-structures/blob/0e8313dc86617796b7145a306df274a882474175/df.unit-thoughts.xml.

I thought (no pun intended) that i might have forgotten to add this. Thoughts are emotions pretty much. To my observable knowledge it is impossible to have a 'high emotion' without a relevant 'high' thought taking place or being staged internally (pre 42.01 animals had none of these features bar perhaps fear for benign creatures in avoiding combat, now they express desires to pray and weep, get anxious and and distracted)

> I've expressed before im not the MOST technical person around on the matter but im pretty certain in most uncertainty that this is what i am describing when i express a emotional system in ('int_32t'). Some more elaboration on what precisely im misunderstanding would be great as im reading though and learning a little bit from that guide you linked including tidbits on scoping rules which are interesting adding on what i gleamed from the syntax . I've definitely cruised github before and got familiar with looking at C++ code (and only a little bit proficient at writing it, but DF code is in language to what i've seen and usually familiar with)

> creature_raw is defined as int_32t's core function on the syntax, and the enum type is used simultaneously between the animal functions too (as far as i see there is nothing to differentiate them into a group) so it seems to be a unintended effect in trying to apply the emotion system via enum fields without actually distinguishing intelligents as the recipient and throwing it on all life with unintented consequences that we see now.

Spoiler (click to show/hide)

Again i quote from the same field...

Code: [Select]
        <enum-item name='NeedsUnfulfilled'>
            <item-attr name='caption' value='after [varying]'/>
        </enum-item>
        <enum-item name='Prayer'>
            <item-attr name='caption' value='after communing with [deity]'/>
</enum-item>

I know witness death thoughts happen, because you can spill any aggressive creatures brains out and over time their morale will break and they will eventually become fearful of the race/entity or perpetrators who have commited the crime. And locally nearly all creatures who go off and back on the map again will express the same fear (which is a methodically replicatable experiment with chains & troggs, in selectively killing troggs in sight on chains until they are terrified and let them loose to contaminate the collective behavior of the rest of the troggs)
« Last Edit: October 27, 2016, 07:50:10 pm by FantasticDorf »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #841 on: October 27, 2016, 08:10:00 pm »

Trust me, if any problem you have is related to int_32t in particular then you're barking up the wrong tree. I'll try to address some grievances:

1. Emotions are felt due to thoughts. This is simply how the game works.

2. Needs (desire for prayer) are not thoughts. Thoughts can happen due to lack of need fulfillment, but being focused or distracted is not related to the thoughts system.

3. Animals and sentient beings feel emotions and needs identically, yes, but you're overcomplicating things heavily with all this talk of "enums". the problem is that animals and intelligent beings act the same as regards to thoughts. This has nothing to do with any types being used or anything, it's a problem with function logic. We can work around the issues by manually changing distractedness and stress.

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #842 on: October 27, 2016, 08:36:23 pm »

Trust me, if any problem you have is related to int_32t in particular then you're barking up the wrong tree. I'll try to address some grievances:

1. Emotions are felt due to thoughts. This is simply how the game works.

2. Needs (desire for prayer) are not thoughts. Thoughts can happen due to lack of need fulfillment, but being focused or distracted is not related to the thoughts system.

Perfectly reasonable i guess, i never precisely found the 'core' of the thought system though i definitely rooted around for it. Perhaps it's squirreled away somewhere i haven't thought to look, but this emotional system is the largest common link towards the behaviors. In my own mind it must be running through some kind of process in order to execute the behaviour we're seeing and the mind facilitiates that (given that when you die, from being turned into a corpse and not a unit your thoughts stop even though you experience body health trauma) even though its non-interfacable, applications like dwarf therapist shows that in lesser beings thoughts still go through on subjects like nakedness.

3. Animals and sentient beings feel emotions and needs identically, yes, but you're overcomplicating things heavily with all this talk of "enums". the problem is that animals and intelligent beings act the same as regards to thoughts. This has nothing to do with any types being used or anything, it's a problem with function logic. We can work around the issues by manually changing distractedness and stress.

Immediate problem here is that even on the guide you described to me, all of the problem areas of location features, animal training and emotions are not properly scoped out and are sorted into the base type. [EDIT - Hang on every new name creates a new bitfield in 'int32_t' for reference after looking though primitives, which is interesting but definitely pokes some holes in my arguement unless it is somehow processing it wrong]
« Last Edit: October 27, 2016, 08:39:46 pm by FantasticDorf »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #843 on: October 27, 2016, 08:38:47 pm »

They're not "sorted into the base type"--you're misunderstanding something pretty fundamental here and I'm not sure what. Location features and animal training have absolutely nothing to do with this.

By the "core" of the thought system, do you mean the structure that defines thoughts? That would be unit.status.current_soul.emotions. See add-thought for a bit more detail.
« Last Edit: October 27, 2016, 08:41:24 pm by Putnam »
Logged

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #844 on: October 27, 2016, 08:49:01 pm »

They're not "sorted into the base type"--you're misunderstanding something pretty fundamental here and I'm not sure what. Location features and animal training have absolutely nothing to do with this.

By the "core" of the thought system, do you mean the structure that defines thoughts? That would be unit.status.current_soul.emotions.

I only recently learned in my edit that 'int32_t' creates new fields from names, what i seemed to be misunderstanding was seeing all these same entries of 'int32_t' being put into the same space without anything definitively setting them apart implying that they were all 'in the same basket' interacting with each other in a round about way (going back to the point on scoping that you helped enlighten me about, as its required to differentiate)

Code: [Select]
sub render_enum_core($$) {
    my ($name,$tag) = @_;

    my $base = 0;
    my $count = 0;

my $base_type = get_primitive_base($tag, 'int32_t');

Yes. Thats useful thank you. Im combing through it now, there are a lot of unknowns but some traces of (the bitfield in name=type doesn't appear to be closed off properly and/or a bit precarious interspersed there, seems a bit sensitive calling it 'type' and also structuring it that way but i might well be wrong)
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #845 on: October 27, 2016, 08:59:48 pm »

int_32t is merely a type. Two structures that both happen to be vectors of int_32t numbers will be independent of one another. There's no relationship between them just because they're both a vector of type int_32t. For example:

Code: [Select]
int main() {
    int_32t array_size; //a new int_32t
    array_size=5; //defines array_size to equal 5
    int_32t[array_size] array1; //makes a new array made up of 5 int_32t numbers (well, pointers to 5 int_32t numbers, but that's overcomplicating things)
    int_32t[array_size] array2; //completely independent of array1! will point to an entirely new data structure, despite being defined in an identical way
}

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #846 on: October 28, 2016, 07:23:31 pm »

I do respect your input as you know more than myself on the matter. And i know more about where i went wrong from your information to drop that lead of inquiry, I can accept its the wrong place to look. So i followed the grapevine from what i found out elsewhere and pottered around looking at this.


Again always feel free to point out if im wrong, it's troublesome to be sent back to the drawing board but i enjoy the input.
« Last Edit: October 28, 2016, 07:46:29 pm by FantasticDorf »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #847 on: October 29, 2016, 12:14:05 am »

enum items aren't "shared between" anything. df.world_population_type.Animal==0, that's literally all it is, it's more a code helper than something altogether meaningful, useful for forwards compatibility and compile checking but not actually something with special logic attached AFAIK.

I don't know why you seem to think that the emotion system is supposed to only apply to intelligent races. I don't think that was ever a stated goal. Emotions are not part of the [INTELLIGENT] or [CAN_LEARN] or [CAN_SPEAK] tokens, it's something all creatures without [NOEMOTION] will have.
« Last Edit: October 29, 2016, 02:59:56 am by Putnam »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #848 on: October 29, 2016, 03:15:02 am »

Another thing I think you might be misunderstanding is that the code you have referenced is not DF code but is simply the structures that DFHack has access to and the names that have been given to them. Each of those structures represent a unique memory reference that can be accessed by DFHack. Some of those memory address expect an integer, some of those integers are expected to be 32 bit integers. That is all the int_32t is representing. And the only thing the enum items are doing is providing easier DFHack coding abilities. Reading the structures can be a bit daunting, but just remember that each entry in the structure is a unique memory address.

That aside, you seem to be saying that you don't want creatures without the [INTELLIGENT] flag to experience emotions, is that correct? Or do you simply not want them to experience certain emotions?
Logged

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #849 on: October 29, 2016, 12:04:59 pm »

Another thing I think you might be misunderstanding is that the code you have referenced is not DF code but is simply the structures that DFHack has access to and the names that have been given to them. Each of those structures represent a unique memory reference that can be accessed by DFHack. Some of those memory address expect an integer, some of those integers are expected to be 32 bit integers. That is all the int_32t is representing. And the only thing the enum items are doing is providing easier DFHack coding abilities. Reading the structures can be a bit daunting, but just remember that each entry in the structure is a unique memory address.

That aside, you seem to be saying that you don't want creatures without the [INTELLIGENT] flag to experience emotions, is that correct? Or do you simply not want them to experience certain emotions?

Its anomalous (/badly implemented) behavior for the system, i understand that this is a memory repository for DFhack and imperfect to the final DF product (which dfhack draws and applies code from in order to get effects) but its as close to looking at the memory/code guts as we can get of the game.

The games memory seems to set out that it was accepted for release because it affected all intelligent creatures (to which the GUI was created for, that was a the intention) globally as intended but instead it affects every animal defined anyway despite how entity populations already exist alternatively. Therefore they would need to be seperated in order to keep the mind system (which keeps one aspect of animals learning skills etc as they are in df.unit.soul) and have animals properly execute behaviours (Intelligent large predators for example and other [large predator] stop being aggressive etc once exposed to these emotional changes.) because flags are phased out in favour of unit emotion or dont work together thanks to overlaps.

The mind system was a one size fits all for all units defined as animals in creature raws across the board against the flags designed to simulate behavior.

enum items aren't "shared between" anything. df.world_population_type.Animal==0, that's literally all it is, it's more a code helper than something altogether meaningful, useful for forwards compatibility and compile checking but not actually something with special logic attached AFAIK.

I don't know why you seem to think that the emotion system is supposed to only apply to intelligent races. I don't think that was ever a stated goal. Emotions are not part of the [INTELLIGENT] or [CAN_LEARN] or [CAN_SPEAK] tokens, it's something all creatures without [NOEMOTION] will have.

Having intelligent units with the GUI and UI created for them (health screen, thought screen, posession screen etc) with the thought and personality system was a goal for intelligent creatures by Toady, the rest of the animal kingdom wasn't initially defined or expanded on, so you could reasonably say it was initially a low level concern (at the moment its not game breaking but pretty instrumental to lots of bugs/petty grievances) or Toady simply wasn't aware about it.

Spoiler (click to show/hide)
« Last Edit: October 29, 2016, 12:06:31 pm by FantasticDorf »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #850 on: October 29, 2016, 12:46:04 pm »

Reading the structures can be a bit daunting, but just remember that each entry in the structure is a unique memory address.
They're not unique, really. Most of them describe the layout of certain types of things in memory, and many instances of those things could exist. About the only "unique addresses" are the globals in symbols.xml.

Its anomalous (/badly implemented) behavior for the system, i understand that this is a memory repository for DFhack and imperfect to the final DF product (which dfhack draws and applies code from in order to get effects) but its as close to looking at the memory/code guts as we can get of the game.
Memory, sure, but it's hard to infer much about the code just by looking at the memory layout.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #851 on: October 29, 2016, 02:46:57 pm »

Having intelligent units with the GUI and UI created for them (health screen, thought screen, posession screen etc) with the thought and personality system was a goal for intelligent creatures by Toady, the rest of the animal kingdom wasn't initially defined or expanded on, so you could reasonably say it was initially a low level concern (at the moment its not game breaking but pretty instrumental to lots of bugs/petty grievances) or Toady simply wasn't aware about it.

GUI does not dictate behavior. There are many, many, many cases in DF where stuff is happening that you have absolutely no way of seeing.

Spoiler (click to show/hide)

Feature means terrain feature, not game feature. Stuff like magma pools and lakes. Features are not "counted into world population". the most you can really say is that they're adjacent.

In fact... you're reading the XMLs completely wrong. A line ending with /> means that the next line is independent of that one.

Also, naming variables the same between two independent data structures does not cause any issues with code. Please try to understand basic scoping before making grand suggestions, it relieves a lot of frustration on every side.

And what we do with the structures XML has absolutely nothing to do with what the game itself does. It's descriptive, not prescriptive. Changing around structures will make DFHack wrong, not make DF right.
« Last Edit: October 29, 2016, 02:51:51 pm by Putnam »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: [SUGGESTIONS] for DFhack plugins
« Reply #852 on: October 29, 2016, 04:56:53 pm »

Also keep in mind that some of the structures in the XML may be wrong - most of the names, whether type names (structs/classes), variable names (struct/class members), or value names (enum members), are our guesses, and some of those guesses are more accurate than others.

A very small number of things (such as all of the bits in unit_flags1 and unit_flags2) are named 100% accurately because Toady told us what they were named, and all classes that have virtual methods are also named accurately because they're visible within memory (via RTTI). Everything else is our best guess, and some of those guesses are already known to be wrong but we haven't gone back to change them because it'd be a pain (e.g. "timed_event" is almost definitely "world_event" based on the messages that appear during load/save, "manager_order" is likely "work_quota" for the same reason, and "ui" is probably "plot_info" based on an error message that never happens during gameplay but is visible in a disassembly).
« Last Edit: October 29, 2016, 05:02:14 pm by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #853 on: October 29, 2016, 05:48:21 pm »

Having intelligent units with the GUI and UI created for them (health screen, thought screen, posession screen etc) with the thought and personality system was a goal for intelligent creatures by Toady, the rest of the animal kingdom wasn't initially defined or expanded on, so you could reasonably say it was initially a low level concern (at the moment its not game breaking but pretty instrumental to lots of bugs/petty grievances) or Toady simply wasn't aware about it.

GUI does not dictate behavior. There are many, many, many cases in DF where stuff is happening that you have absolutely no way of seeing.

Feature means terrain feature, not game feature. Stuff like magma pools and lakes. Features are not "counted into world population". the most you can really say is that they're adjacent.

In fact... you're reading the XMLs completely wrong. A line ending with /> means that the next line is independent of that one.

Also, naming variables the same between two independent data structures does not cause any issues with code. Please try to understand basic scoping before making grand suggestions, it relieves a lot of frustration on every side.

And what we do with the structures XML has absolutely nothing to do with what the game itself does. It's descriptive, not prescriptive. Changing around structures will make DFHack wrong, not make DF right.

Describing the nature of the game and loosely interpreting and trying to make sense of it all is a good place to start, my own approach is to find a value and keep referencing where it eventually pools into in order to learn the relations it has. Shake the chain and see what rattles. In all cases even i'd agree my 'solution' is flimsy and non-practical but there's no harm in trying. In hindsight of your constructive criticism i won't be posting any more XML code here but i will keep looking through it privately for connections and read up a bit more about the C++ system, which i was doing anyway.

The GUI (game user interface when player are involved) or UI (menus etc) is what the player interfaces with, i am aware its a feature whether it's background or not, but toady in his initial release of the mind system he'd be working only only tailored it for the intended audiences of intelligent creatures that  benefited from it without making code to discriminate or only affect that class. Nothing was really mentioned about the fact since but bug reports like http://www.bay12games.com/dwarves/mantisbt/view.php?id=7369 started turning up regardless. There is a bug in our midst somewhere or some permeating issue.

I argue that animals & plants are 'map features' because they are referenced in population ID in relation to the biome sites they are represented in are part of features. You cannot generate a jungle map feature or a underground global feature without also having animals/plants relevant, and the population id reads off the features and its co-ordinate to find all the animals/plants within it as part of a background tally of existing units in the feature to the best of my applicative knowledge (feature defined jungle = jungle creatures & plants are put in = gets population numbers from raws and uses that)available for that site if they aren't in it already (plants being always present)

Also keep in mind that some of the structures in the XML may be wrong - most of the names, whether type names (structs/classes), variable names (struct/class members), or value names (enum members), are our guesses, and some of those guesses are more accurate than others.

A very small number of things (such as all of the bits in unit_flags1 and unit_flags2) are named 100% accurately because Toady told us what they were named, and all classes that have virtual methods are also named accurately because they're visible within memory (via RTTI). Everything else is our best guess, and some of those guesses are already known to be wrong but we haven't gone back to change them because it'd be a pain (e.g. "timed_event" is almost definitely "world_event" based on the messages that appear during load/save, "manager_order" is likely "work_quota" for the same reason, and "ui" is probably "plot_info" based on an error message that never happens during gameplay but is visible in a disassembly).

This is very true, and i have kept this in mind, and as i've mentioned before, its a imperfect community effort for DFhack but a generally trustworthy one for looking into. You could also take a pinch of salt in saying that some of the things that i've mentioned (like entity_population/various population references using atleast 3 different names for the same value/little inconsistency in proper identification) could be typos.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #854 on: October 29, 2016, 06:13:55 pm »

They're not the same value. Why do you think they're the same value?

Also, intelligent creatures don't show emotions in dwarf mode unless they're citizens, not just intelligent, so the GUI argument sort of falls flat there, too.

Also, "where it pools into" isn't quite right; these structures are part of larger structures but that doesn't mean their behavior is inextricably linked with said larger structures. Just because unit.status.current_soul.emotions[0] is an emotion contained within unit doesn't mean that unit.animal.vanish_countdown is going to do anything to said emotion.
« Last Edit: October 29, 2016, 06:16:44 pm by Putnam »
Logged
Pages: 1 ... 55 56 [57] 58 59 ... 61