[Mod] Creatures [git] [minetest_mods_creatures]

User avatar
RajMahal
Member
Posts: 10
Joined: Wed Jan 16, 2019 20:56

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by RajMahal » Post

Image
_ _ _(Testing for #t.bugs)
There are #t.depricated #t.code.script (functions)
in #t.mod.non.default...creatures&

There are #t.bugs
in #t.non.default....creatures

inprocess

ingredients:
#t.mod.non.default...creatures
#t.mtengine.modbase.mtgame...
#t.program...minetest.5.1.0.win64
#t.mod.default
#t.player.in.game...creature

sources:
#t.forum.minetest

_ _ _....more to be added
+ Spoiler
Last edited by RajMahal on Fri May 01, 2020 17:40, edited 26 times in total.

User avatar
Lone_Wolf
Member
Posts: 2326
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Lone_Wolf » Post

RajMahal wrote:#t.re:...#t.strange...#t.minetestguru...Tcll_#t.modification...#t.non.default...creatures_

*#t.inprocess*
+ Spoiler
Would it be possible for you to speak in regular english?

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

@RajMahal: your posts hurt to read...
judging by Lone_Wolf's quote it seems you're misguided to believe I actually drop projects
I promise you (and everyone else) I do no such thing

to add to your context, I don't intend to work on this modification for 2 years as I have other projects to work on
but that doesn't mean I'm going to drop it.

get off your high horse and have some patience.

EDIT:
btw, I'm not a guru, I'm no more a noob than you are
I have more experience with LUA in Minecraft-OpenComputers than I do with Minetest
really this is the first mod I'm actually working on, so it's quite a learning experience...

but hey, once I'm done with this, I might start working on a mod I'd initially planned for OpenComputers
being the ability to write your own physical models in LUA with supplied event callbacks
(though this was intended to use OpenGL through Java using the source from OpenGlasses, so I'm not sure how I can do that through LUA in Minetest)

I'm more of a guru writing games in python with GLFW(glfw3.dll)+OpenGL(opengl32.dll) than anything else.
let me have my fun ;)

EDIT2:
@RajMahal: would you please speak in english and not some butchered code dialect

I understand you're upset Mircea's code is buggy
and that it's been some time the code hasn't been fixed


all I can say is please be patient and understand

first off Mircea has numerous other projects to work on, and this one isn't too high on their priority list compared to other more demanded projects.
(though who knows, that may change a bit with me getting involved)

secondly, I too have projects I'm more demanded to work on, but that's not my excuse for not working on this as of current...
currently I'm dealing with life smearing my face in the mud and have to work to get back to where I was to be able to work on this again...
but to add, I'm going through and overhauling the entire code-base (following whatever standards Mircea wants of course), which isn't something that's gonna be quick...
I'm not sure if I'll be able to get around to fixing the bounds bug with the ladder you're posting about, but that'll be after I finish with my ideas.

I've written my own physics engine in python before, so if it's something I can fix, I certainly will
but it depends on what the minetest API allows me to play with
I'm still a noob (at both minetest and LUA), so I'll need time to look at everything and figure out how it works.

if you wanna be cocky, you're welcome to fork Mircea's work and attempt to fix things yourself...
(that's the purpose of FOSS after all)
programming ain't that difficult, I'm sure you can do something. ;)

EDIT3:
btw, something I can tell you is I do know what causes the issue with mobs and ladders
in order to make mobs and players equal, there's some inconsistency with mobs having bounds Y - 1 to match players.
if you look at the ladder position, it's exactly 1 block lower, matching the consistency issue.

I'm still running version 4 of minetest, so idk if this was resolved in version 5+
if so, you should be able to undo the check and apply the bounds as is.

EDIT4:
can I just kindly say
I hate this:

Code: Select all

                                            
                                       SIdeNote: What many call #t.bug                                              
                                       others call it  #t.feature
if you wanna find a really good way to trigger me, it's stupid statements like that
there is a clear difference between a bug and a feature
unless that feature in question is 100% absolutely meant to raise the error to prevent corruption
though I call this bad design
a good design effectively handles all data that can be passed efficiently with at most a notification in effort to maintain the program run cycle.
(for example, Minetest returns to the menu on a mod crash, instead of halting execution and closing)

in any case, I'd be surprised if Mircea actually picks up on what you caught
I'll probably work on removing deprecated functions in my overhaul however

also:
I am attempting here to clearly document #t.default #t.bug
your cryptic code speak is not clear documentation
it actually hurts to read

clear documentation does not require a full page of text
if you can describe a bug in a paragraph without having to scroll the page, you've just provided clear documentation.

clear == easy to read/understand in full detail.

I kindly ask, would you PLEASE break from your cryptic code speak.

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

sorry for a double post if that's disliked on here, it's been a good while so I figured it was just.

anyways, now that life isn't dragging me about too much anymore, I figured I'd hit this project up again and wanted to make an update on things.

Mircea, you're probably gonna dislike this, but I've removed most of the stuff having to do with creatures.player_settings as that section is rather unmaintainable, and most of the functions involving it are abstract wrappers around simple things like obtaining entity names.

it was also getting in the way of my overhaul on player/mob textures that was much needed.

but I also wanted to mention a minor change that would allow clothing changes, as well as improved readability.
this is done with a new property in the creature def:

Code: Select all

detail = {
    skin = {}, -- textures for the naked body
    outfit = {}, -- textures for the clothing overlay
    portrait = {}, -- textures for the icon (should replicate skin+outfit as a singular table)
}
the formatting for the texture entries is this:

Code: Select all

skin = { -- or outfit or portrait
    {
        textures = {{"image.png", ... }, ... }, -- { layer_group: { image, ... }, ... }
        colors = { "#FFFFFF", ... },
        colors_ratio = 128
    }
^ this was the reason load time drastically increased when enabling this mod

more info on color ratios here:
https://minetest.org/modbook/lua_api.ht ... -modifiers
Ctrl+F: colorize

so yeah Mercia, sorry about changing core functionality like you didn't want, but in this case it's for improved usability
it also improves performance and maintainability, since we don't need a pointless table.
keep things simple and appropriately relative ;)

EDIT:
actually I'm gonna change up those 3 tables to make them more easily manageable by a single custom function
where portrait can be built more dynamically and outfit can be managed with skin

this is userland after all, it should be simple to manage

EDIT2:
updated with the changes
the 3 properties are now part of def.detail = {} rather than associated directly
this allows better customization through a custom function defined for a race

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by MirceaKitsune » Post

I'll have to look at the changes someday when I have time for this as well. It's okay that you removed some things, though I might not approve a PR that removes core functionality in my version. None the less it's perfectly fine to fork this and see where that goes for now!

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

I understand
really the only "core" bit it affects is ./worlds/world/races.txt
which is kinda a bit pointless now since the rehaul should move that to static data

I haven't actually gotten things working yet so currently it's untested
I'll make use of it again though if need be
but yeah the old skins functionality is completely changed

what happens now is a random skin is calculated for each mob, and the texture string itself is stored whenever the entity goes static
rather than operating on a full list/table of calculated skins with a stored index

the only thing I'll be adding when I get to it, is a list/table of default IDs for clothing
or rather it'll be { default, { user: preferred, ... } }
idk, I'm still planning things out here tbh for how you can set your own clothes
(multiplayer management is a branch in the way here)

EDIT:
yeah the rehaul moves it to player:get_attribute("creatures_race") or for 5.0.0+ meta:get_string("creatures_race")

meaning the whole player_settings variable and file-save timer section can be removed without issue :)
the only thing that might need to be done is to read from the old races.txt and set existing races accordingly

you could probably work on an extension mod for that :)
since I kinda butchered the old code and don't feel like digging into it again XD

EDIT2:
btw, I wanna note, I think it's possible I could remove the creatures.player_def variable and integrate that closer with the mob def
rather than managing everything individually like it is currently
or in other words, removing copied code

doing so may require breaking the table for minetest.register_entity() out to it's own database

all in all, I'd likely just be re-purposing creatures.player_def as "entity_def" and making everything around it more maintainable.

but that might be later on...
... or maybe not...
I understand most of the mod, it shouldn't be too difficult to overhaul if that's fine with you :)

one thing throwing me off about it is the inconsistent referencing going on with player_def[ name/race ], both of which should be "cname" for creature name (entity name)

code revisioning can be painful yes, but you need to keep things consistent if you intend to keep your project alive ;)
I learned that lesson VERY well XD
every time I get a better understanding of my work, I always go back now and rename variables properly so nothing gets confusing for anyone :)

EDIT3:
idk why I'm asking if that's fine when I'm overhauling the entire thing and previously noted as such anyways XD

don't worry though, I'm keeping the original intended functionality ;)
or maybe even improving it a bit ;D

- creatures: base mod with only basic creature mechanics (including posession ability)
- creatures_races: extension mod adding race group bias and tribal behaviors
- creatures_items: extension mod adding item spawn ability to creatures

note though I'm still working from a version 4 client, so version 5 bugs may still be there
I'm doing what I can though to make things work appropriately ;)

EDIT4:
hooo boy, just wanna say Mircea, you're gonna be impressed at how much code I've removed while maintaining the same (with added) functionality

I actually haven't messed with any major core functions, just all the abstract stuff that shouldn't be used too often
(or for the stuff that is used, it's been simplified and ties cut before the abstract stuff was removed)

but for the most major thing I've done so far, creatures:register_creature() is now the root function for handling entity definitions
rather than falling back to 2 separate functions for players vs mobs
the data that was stored in player_def in api_players.lua is now stored in entity_def in creatures/init.lua, but also reflects the full entity definition from the mob registration function.
the table still functions the same though, holding the ename for the definition, and yes I went back and renamed every variable that references from it appropriately: ;)
local def = creatures.entity_def[ename]
or in the case of getting the player definition, I had to write a function that references the attribute/meta value for the ename:
local def = get_player_def(player)

the only last hurdle I have to jump for this section involves player_data, which configure_player() looks a bit overwhelming to understand for that...
I'm sure I can also integrate that stuff into player attributes just like I did with player_settings
and yes I did test to make sure that replacement worked ;)

anyways, I'm sure you'll like everything when it's done
it'll be so much smaller and easier to wrap your head around and maintain :)
the last thing I overhauled like this was a Discord client mod installer for Enhanced Discord, and the original dev loved my work. ;)

but yeah, I just want to let you know, I'm not changing anything that's there already, only improving and extending it.
sectioning off what's proper and organizing and cleaning things up.
even adding a bit of documentation to help explain things that aren't so obvious in the code.

random overseer: but you just said you changed up a bunch of stuff, so how can you say you're not changing anything?
response: just because the code is being overhauled and completely changed about, doesn't mean the overall functionality and idea of the mod won't be roughly exactly the same ;)
yeah you can rest easy there Mircea XD

EDIT5:
just a quick progress update showing the updated simplicity of creature definitions:
Image
namely the new spawn_definitions entry
if there's anything I'm stepping on here with this, let me know ;)
adding back the register_spawn() function isn't difficult at all from here if it's really needed.
(it'll actually benefit from the same added simplifications shown if I do add it back)

also, I should note, I've removed the api modules, and have currently merged the logic modules.
I do intend to work with the more standardized api methods to support both internal and external extension mods
so currently there's just init.lua and logic.lua for the creatures mod

oh and one more thing, or a few more things actually...
this is actually intended to be simplified even further, removing the individual male/female creature definitions for just a single definition, as well as the removal of my own new_creature() function.
since I'm overhauling the entire mod creatures_races_default will be an internal extension mod, where the function will be reimplemented, and called by register_creature, assigning the races traits for tribal behavior to the internal definition assigned to entity_def

I'm sure there's a few things with this design that'll run Mircea the wrong way, but I feel this new design will be better overall for interfacing with extensions more cleanly with much less abstraction. ;)


oh and also @rubenwardy
if you stumble across this, please improve your documentation :)
overhauling this mod means learning 3 different interfaces to get this thing working properly:
- the default Minetest API
- Mircea's API
- my own added interface
notably the registered properties for Object, Entity, and Player
since I've gotten stuck numerous times needing to know which properties were from Minetest vs Creatures, and wasn't able to run the mod to hack my own documentation.

your documentation is the best out of everything out there, but not one doc lists everything needed to be known to work on a mod without bashing your head on your keyboard out of annoyance over a lack of resource on all fronts.

for example I had to dig in some poorly constructed github documentation to figure out a "handle" from minetest.sound_play() was a traditional int value like that from the windows API, and not some custom class instance representing a handle-descriptor (common python practice, especially among files).

these details may seem stupid to document, but may be beneficial among differing terminologies. ;)
(or as I always say: better to have and not need, than need and not have)

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

figured I'd split posts here since this is kinda more of a contribution than an update...

for those who've read I'd planned on having traits be biased allowing falloff from stereotype behavior...
here's a bias RNG modified (pretty much copied) from python's random module:

Code: Select all

triangular = function(low, high, mode)
    low = low or 0; high = high or 1
    return low + ( high - low ) * ( math.random() * ( mode and ( mode - low ) / ( high - low ) or 0.5 ) ) ^ 0.5
end
basically what this does:
triangular( 0, 1, 0.5 ) is unbiased between 0 and 1
triangular( 0, 1, 0.85 ) is highly bias towards 1, but will still return a value extremely close to 0
triangular( 0, 1, 0.15 ) exact opposite favoring results close to 0

more info here: https://en.wikipedia.org/wiki/Triangular_distribution

I hope others find this just as useful for their mods as I do for Mircea's :)

NOTE: just be sure to keep the arguments in line with low <= mode <= high and low < high or you'll have issues here ;)
python's implementation allows low >= high, but at a performance cost.

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

final update on this showing the just about final size of creature definitions you can expect to work with:
Image
all that's really left to do is remove individual gender functionality and add gender extensions, which I won't be updating on for a good while ;)
(basically that'll allow gender-dependent biases and settings like I know Mircea wants, but also allow custom genders and default definitions without too much work)

also @Mircea
this is melting my brain, how tf does this work in Blender and not Minetest:
Image
what I'm referring to here is the eye lashes shown in the female icon

first of all, the image alpha is 0 for those pixels
secondly, none of the other textures have them, it only shows up for the hair layer

I got a bit overwhelmed in code and wanted to work on some extra hair styles for a moment :P
but I wasn't expecting to find this... lol

EDIT:
figured it out with MS Paint (yes it works on Linux... at least the XP version anyways...)

apparently the hair image actually has it, and something's acting up with multi-texturing in Blender materials
basically the hair texture is overriding the other overlays and somehow displaying the hidden pixels
(ah the joys of broken implementations)
the rest of the images don't have the eye lashes at all, not even in the clear pixels

I'm using Blender 2.79b btw because I can't run 2.8 due to a broken library (no idea what) in Void Linux causing it to run at 0.5 FPS
and the blender devs haven't been very helpful in solving the issue
(I requested to know the name of the suspected library, or for the devs to wrap it in an appimage)
^ yes they fought with me calling appimage a package format
so I'm stuck on 2.79b for the moment

how I'm displaying them is through the material textures tab:
Image
pretty sure it's just some sort of priority issue because Blender's implementation somehow sucks at mimicking OpenGL :P
Last edited by Tcll on Mon Feb 03, 2020 16:53, edited 1 time in total.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by MirceaKitsune » Post

I made those models many years ago. I remember it was pretty simple though: A simplistic rig with a small animation set, achieving something similar to the Minecraft player model. Note that they're meant to support Minecraft skins as well.

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

MirceaKitsune wrote:Note that they're meant to support Minecraft skins as well.
haha I can tell ;)
only 1.7.10 based though =3=
skinsdb is what I'm using which also supports the added layer

but yeah I think I figured out what I need to do to get it working, and it seems to be only with the hair and eyes
just re-export and remove the color data on alpha 0 with GIMP :)
(think I might do that with all images though)
then for the hair, just apply blend Add instead of blend Mix (unless the eyes darken everything else)

I may need to modify the details image where the eyes overlay at, but we'll see ;)
EDIT: uhhh huh, just as I suspected, the eyes are extra bright when added
welp, that's an easy enough fix

not sure why multitexturing isn't working properly here, but at least it can be worked around :P

I fixed the original issue at least :)
I should also note stencil kinda helped as well, but took priority down the line, so only the first texture displayed
looks like Blender's a little busted XD
hopefully soon I'll be able to use 2.8

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

hey Mircea, I think I may have found something that might help you out with basic object properties
since a few of these properties (eg breath_max or selectionbox) aren't documented in rubenwardy's docs (or anywhere else I can find for that matter) :)
https://github.com/minetest/minetest/bl ... ontent.cpp
line 190 is where minetest starts reading the basic general object properties
as for entity and player extensions, I haven't looked there yet :P

but now that I've found this, I'll definitely be reorganizing things more appropriately :D

why am I looking at the minetest source code for object properties?
well for 1, not all properties are documented
but for 2, I'm actually trying to figure something out for a little surprise I'm working on ;)

if anyone knows exactly where the full texture string with modifiers is deconstructed, it would really help me out working on this thing :)

EDIT:
well, figured that one out finally
typical handlers in unintuitive locations 9_9
gets really tiring seeing this stuff in literally every source I hack... ykno
it's very counteractive towards self-documentation >.<

anyways, it looks like the handler for handling texture modifiers on object textures is located at TextureSource::generateImage on line 905 in:
https://github.com/minetest/minetest/bl ... t/tile.cpp

does this mean mobs count as tiles? :D
no wonder it took me the whole day to find this
would've expected this to be in src/client/imagefilters.cpp because that's what's managed. >.<

if I keep running into stuff like this, I might end up forking Minetest on GitLab
good lord, at least it's not as unintuitive as irrlicht where you can't even make out what function manages what.
*insert 1000 line rant here*

when you've built your own Blender replacement, I think ranting on bad sources can be excused :)
(truthfully I'm only building it, but still, an extremely simple universal scene graph is no small feat)

EDIT2:
well I can't do it through the API, there's no texture modifier for what I need...
but if I can apply GLSL shaders to entity defs (similar to Minecraft's CustomSteve mod), I might be able to apply the effects I'm trying to achieve.

User avatar
Tcll
Member
Posts: 22
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by Tcll » Post

sorry for over a month's delay and no update...
life dragging me about, and had other agendas for me involving money and stuff with extreme security.

but anyways, I'm back now and have started work on perfecting creature traits,
whiiiiich lead me down a rabbit hole leading to a discovery of needing to overhaul my own code...
apparently Mircea was onto something after all with the entity def having separate static and dynamic definitions
where I was an idiot and undid everything to have just 1 easy definition... YEAAAAAAH! :thumbsup:
... ah well, at least I improved everything, so it shouldn't be too difficult to add back... lol

at least I have a solid method for having multiple genders, rather than just male and female
who says a tree monster can't come in 5 genders ;D

on that note though, as a standard, genders['none'] is the default definition, and is required.

the reason it's been changed to none from default is because of aesthetics.
or to explain that better, Gender: none will be appearing in the UI.
you'll also be able to turn genders off if you wish with a selection mod, where Gender: none will be a rarety if genders are enabled,
at least depending on the creature (a tree monster could commonly appear without a gender)

once this is coded I should be able to post screenshots again ;)

EDIT:
traits are now defined separately within static_def[entity_name][gender] and configured within mob.traits in on_spawn()
or rather, the function configure_mob() has been removed as the only time it actually did anything was in my added function on_spawn()
the functions logic_mob_activate() and player_to_mob() call it, but the variables it manages are already created, so it basically does nothing but waste CPU cycles checking if variables exist.

I still need to go through the logic functions yet and port everything using traits_set over, but that shouldn't be difficult ;)

man if this progress keeps up, I might be able to post screenshots by tomorrow :D
but I'm not holding my breath yet, I can't even access my cloud yet due to technical difficulties XD
at least it still works or all the previous images wouldn't be displaying currently ;D

yeah when life drags me about, it's pretty much by a chain on the back of a truck
doesn't matter which way I turn, there's always another rock to hit me hard
ah well, I'll be back up eventually ;)

EDIT2:
haha yep, I'm glad I didn't hold my breath
I hit a snag within the logic partly from my autistic OCD, and am building a better system for logic callbacks

what I'm improving is the callback inheritance and removing needless overhead
basically you won't need to wrap logic_mob_punch() when defining on_punch()

the step functions are the worst :P

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests