Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masks #29

Merged
merged 12 commits into from
Jul 17, 2022
Merged

Masks #29

merged 12 commits into from
Jul 17, 2022

Conversation

yanchith
Copy link
Member

@yanchith yanchith commented Mar 24, 2022

@janper

This adds two things:

  • The masks features we talked about: See wfc_world_state_slot_mask_set and Features::MASKED_SLOTS (0x04). If the mask is true, the slot is ignored.. maybe this is unintuitive?

  • wfc_world_state_init_ex. It is like wfc_world_state_init, but you can set initial values for slots (fully zeroed vs fully unobserved), weights (just a number that will be copied everywhere), and masks. It should simplify your initialization code slightly.

I didn't have time to test this at all, so please do test and let me know if you find any problems. If all goes well, I can make a new release out of this for you.

I still need to benchmark this. It adds a condition to an existing branch in hot code. It should be easily predictable, but who knows.

Fixes:
#28
#18

@yanchith yanchith requested a review from janper March 24, 2022 07:13
@janper
Copy link
Contributor

janper commented Mar 24, 2022

Thank you!
I'll test it but it requires quite some work on my side, too.

If the mask is true, the slot is ignored.. maybe this is unintuitive?

Yes, this is counterintuitive. I'll test it this way but for the release I prefer it the other way around. Or is there any reason/convention to keep it this way?

wfc_world_state_init_ex

Learnt from Microsoft? :)

@janper
Copy link
Contributor

janper commented Mar 24, 2022

Could we have something like uint32_t wfc_feature_masked_slots();?

@yanchith
Copy link
Member Author

Yeah, I forgot to add it. Will do.

@janper
Copy link
Contributor

janper commented Mar 24, 2022

I'm getting an exception.

image

@yanchith
Copy link
Member Author

Does the regular init work? You are sending an integer for a weight.

@janper
Copy link
Contributor

janper commented Mar 24, 2022

Does the regular init work? You are sending an integer for a weight.

I've removed the regular init. i'll try to specify that the numbers are uints each input param's type properly.

EDIT: No difference

image

@janper
Copy link
Contributor

janper commented Mar 24, 2022

The original Monoceros works ok with the new DLL (using only the regular init)

@janper
Copy link
Contributor

janper commented Mar 24, 2022

            [DllImport("monoceros-wfc-0.5.0-debug.dll", CallingConvention = CallingConvention.StdCall)]
            internal static extern unsafe WfcWorldStateInitResult wfc_world_state_init_ex(IntPtr* wfc_world_state_handle_ptr,
                                                                                          AdjacencyRule* adjacency_rules_ptr,
                                                                                          UIntPtr adjacency_rules_len,
                                                                                          ushort world_x,
                                                                                          ushort world_y,
                                                                                          ushort world_z,
                                                                                          uint features,
                                                                                          uint featuresslot_init_value,
                                                                                          float slot_module_weight_init_value,
                                                                                          uint slot_mask_init_value);

@yanchith yanchith marked this pull request as ready for review July 17, 2022 11:36
@yanchith
Copy link
Member Author

Hopefully brought it up to speed. Merging.

@yanchith yanchith merged commit ee81946 into master Jul 17, 2022
@yanchith yanchith deleted the masks branch July 17, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants