[Mod] Creatures [git] [minetest_mods_creatures]

User avatar
Diamond knight
Member
 
Posts: 473
Joined: Sun Apr 19, 2015 19:50
Location: Chilling in Constantinople
GitHub: Diamondknight
In-game: Ferrumprinceps

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

by Diamond knight » Mon Jun 05, 2017 18:45

someone needs to fork this mod and make it actively developing again, it is so outdated, you can't even use 3d armor with this mod yet.
 

User avatar
TumeniNodes
Member
 
Posts: 2837
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

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

by TumeniNodes » Mon Jun 05, 2017 18:58

Diamond knight wrote:someone needs to fork this mod and make it actively developing again, it is so outdated, you can't even use 3d armor with this mod yet.


You better get to work then..., you have lots to do ; )
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

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

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

by MirceaKitsune » Mon Jun 05, 2017 19:56

Diamond knight wrote:someone needs to fork this mod and make it actively developing again, it is so outdated, you can't even use 3d armor with this mod yet.


Actually you can't use 3D armor because my code and models simply aren't compatible with it, intended plans included an armor system originally for the mod. As for forking, I'd rather changes are issued as pull requests first; The more versions of a mod there are, the harder it is to pick and use one.
 

User avatar
Diamond knight
Member
 
Posts: 473
Joined: Sun Apr 19, 2015 19:50
Location: Chilling in Constantinople
GitHub: Diamondknight
In-game: Ferrumprinceps

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

by Diamond knight » Mon Jun 05, 2017 20:50

good, the original dev is back...


and I agree with the previous post about the ghost thing, this is a good framework but ghosts and posessing do not always fit in with every subgame/mod
 

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

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

by MirceaKitsune » Mon Jun 05, 2017 21:42

Diamond knight wrote:and I agree with the previous post about the ghost thing, this is a good framework but ghosts and posessing do not always fit in with every subgame/mod


The issue again is that, there's no better system with the default creatures; The player is given free choice as to which creature to possess, so choosing a default would kind of defeat the purpose. Never the less, the ghost system is not obligatory, and can be avoided with a custom creature set.
 

User avatar
Stix
Member
 
Posts: 1379
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: nil
In-game: Stix [+alts]

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

by Stix » Fri Sep 15, 2017 21:20

this looks very promising, +1
Hey, what can i say? I'm the bad guy.
 

User avatar
thomasthespacefox
Member
 
Posts: 94
Joined: Sun Aug 02, 2015 15:00
GitHub: ThomasTheSpaceFox
IRC: ThomasJaguar1212
In-game: thomasthespacefox

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

by thomasthespacefox » Sat Mar 17, 2018 15:51

Cool concept. wound up with a literal crowd of anthros following me XD

Image



it be cool to see this updated once 0.5 comes around.
A few things i noticed:
  1. beds cause animation-related crashes. (see spoiler) probably related to commenting out player.lua
  2. also, i did notice the odd lone floating item.
  3. The server takes a bit longer to initialize
for the most part though, at least from my experience, this thing still works in 0.4.16. Though having 10 or so anthros following you tends to lag things a little bit. XD

+ Spoiler
 

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

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

by MirceaKitsune » Sat Mar 17, 2018 18:26

Yes: I remember a problem of my mod was that you have to disable player.lua manually. I was going to make a pull request for minetest_game which made it possible to turn off the default player animation system using a variable, but I took my long break from Minetest modding at that time.

Creatures will follow allies with whom they have a high alliance score. If you wish to avoid them you can usually outrun them, or wait for them to spot a foe which will cause them to either attack or flee (based on the fear stat).
 

User avatar
cHyper
Member
 
Posts: 842
Joined: Fri May 06, 2011 08:49
Location: Austria
GitHub: cHyper-0815OL
IRC: cHyper
In-game: cHyper cHyper_0815

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

by cHyper » Sat Mar 17, 2018 20:39

how can i change the spawn rate of the mobs to get more sheeps for instance.
 

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

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

by MirceaKitsune » Sat Mar 17, 2018 22:19

cHyper wrote:how can i change the spawn rate of the mobs to get more sheeps for instance.


Look in creatures_races_default/init.lua at the creatures:register_spawn functions. The parameters there define the overall spawn rate of each creature.
 

User avatar
Stix
Member
 
Posts: 1379
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: nil
In-game: Stix [+alts]

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

by Stix » Fri May 04, 2018 20:18

MirceaKitsune wrote:
cHyper wrote:how can i change the spawn rate of the mobs to get more sheeps for instance.


Look in creatures_races_default/init.lua at the creatures:register_spawn functions. The parameters there define the overall spawn rate of each creature.

what code do i change to use this? ik it was mentioned somewhere but i cant find it, id rlly like to test out this mod, it looks very promising!
Hey, what can i say? I'm the bad guy.
 

User avatar
Diamond knight
Member
 
Posts: 473
Joined: Sun Apr 19, 2015 19:50
Location: Chilling in Constantinople
GitHub: Diamondknight
In-game: Ferrumprinceps

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

by Diamond knight » Sat Jan 05, 2019 01:14

Will this mod be updated once the player API comes in 5.0? It is kinda buggy in modern versions and could use the new functions such as player collision box changes and such.
 

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

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

by MirceaKitsune » Sat Jan 05, 2019 02:35

Diamond knight wrote:Will this mod be updated once the player API comes in 5.0? It is kinda buggy in modern versions and could use the new functions such as player collision box changes and such.


It has been quite a while since I've been active on MineTest. I will have to see about it sometime. For now I'm hoping the mod API remains backwards-compatible enough as to not really break anything.
 

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

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

by MirceaKitsune » Sun Jan 13, 2019 20:22

Alright. I've updated Minetest and am now thinking of taking another look at both Structures and Creatures, to at least bring them up to date with the latest code after 4 years since I last touched them.

I have a small favor I'd like to ask if anyone has a few minutes to spare: Could you please list to me all of the deprecated functions this mod still uses, and ideally also what I need to replace every function with? You can find the code of the core creatures systems over here:

https://github.com/MirceaKitsune/minete ... /creatures
 

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

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

by RajMahal » Sun Feb 24, 2019 02:21

Image

(Creatures.Return.to.My.World)

*#t.raj.inprocess*
#t.mtengine.modbase.mtgame...
#t.version...5.1.0-win64
&& #t.non.default.mod...creatures

+ Spoiler
Last edited by RajMahal on Wed Dec 18, 2019 15:15, edited 52 times in total.
 

User avatar
thomasthespacefox
Member
 
Posts: 94
Joined: Sun Aug 02, 2015 15:00
GitHub: ThomasTheSpaceFox
IRC: ThomasJaguar1212
In-game: thomasthespacefox

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

by thomasthespacefox » Fri Mar 08, 2019 03:28

Just compiled v5 myself. Id really love to play around with this mod with the new custom player collision boxes and such.
 

User avatar
Diamond knight
Member
 
Posts: 473
Joined: Sun Apr 19, 2015 19:50
Location: Chilling in Constantinople
GitHub: Diamondknight
In-game: Ferrumprinceps

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

by Diamond knight » Thu Jun 27, 2019 23:27

If development does not continue I may fork this, this mod is too good to die
 

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

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

by MirceaKitsune » Thu Jun 27, 2019 23:52

Diamond knight wrote:If development does not continue I may fork this, this mod is too good to die


I still have plans for it, but no idea when I might get back to them. Feel free to fork, it might be interesting to see how a different version goes! I might continue development on the main one someday however.
 

Ender3Guy
New member
 
Posts: 7
Joined: Fri May 31, 2019 21:32
GitHub: MisterPrintf

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

by Ender3Guy » Sun Jul 14, 2019 01:58

MirceaKitsue wrote:I still have plans for it, but no idea when I might get back to them. Feel free to fork, it might be interesting to see how a different version goes! I might continue development on the main one someday however.


Just competed my first Minetest mod and I'm now fiddling with the magpen and ading structures. Once that is done I've considered forking Mobs Redo and implementing a similar setup.
@[Diamond knight] if you are interested I can help with development.
 

User avatar
Tcll
Member
 
Posts: 21
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 » Thu Nov 07, 2019 13:42

Hey there Mircea, I just gave your mod a try and I love the abilities and the AI

but at the same time...
MS Sam: thanks I hate it.

already had a posession despawn with an enchanted diamond pick after serious lag caused a timeout
I'm sure you won't mind if I try to figure out what's going on and improve it :)

perhaps you could show me around the code so I'm not going in blind??
I'm still kinda new to modding and don't have an easy offline resource to follow yet
plus I'm still kinda a noob with LUA


but also, would you care if I made the ghost respawn form optional so I could use mods like skinsdb while having my player be optionally posessable?? (100% willing of course)


one thing I might really work on is world pointer definitions for things like farming so the AI doesn't grief everything
or at least I'm not sure if they actually grief stuff yet, or if they just spawn with it


also, one last word of note
after playing with 2 clients running, there seems to be a serious desync between things
like I'd do something on my main client (server), while the updates take place on the connected client 5 minutes later...

what makes things even weirder is whenever I'm watching an NPC on both clients
their movement is synced, like they'll jump at the same time on both clients, while my main client's player is in 2 separate places.

so yeah, something's going on that's slowing things down a ton...

EDIT:
wow this mod needs some serious organization
at least it's not as bad as pyggel, which I'd written my own infrastructure for extendable bots and stages for
but it's still pretty bad

I can't fork right now as the machine I'm editing on has no internet yet...
but how bout I send you a zip to review once I'm done making changes :)

one major change:
- mobs will be separated to individual sub-mods of the races_default sub-mod, with individual configs (and possibly logic, if I can)

I'm gonna try to make the default configs overrideable as well
but yeah, this should make things easier to disable specific mobs, and define custom behavior patterns.

something I'd like to see/do down the line is better AI control, be it defined or configurable
(kinda like CustomNPCs, but better)

EDIT2:
pulling my hair out trying to make a sub-category of a sub-category:

+ modpack
|+ sub-modpack
| | mod

is this even possible?

at least for some good news here, I think I've found the cause of the extreme lag
in [ ./creatures/logic_mobs.lua ], there's a TON going on for mob awareness

of course it'd be what I like that causes me extreme pain, what else would it be :awesomeface:

I'm the type of guy who would build a multi-crafter in Minecraft using nothing but OpenComputers
no pain no gain :awesomeface:

EDIT3:
fixed what was creating the load-time lag
tons of table.insert() commands in [ ./creatures_races_default/init.lua ]

rewrote most of those as this (at least for the critical portions):
Code: Select all
local tbl = {
    {
        key = val
    },
    {
        key = val,
        key2 = val
    }
}
 

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

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

by MirceaKitsune » Fri Nov 08, 2019 13:12

Tcll wrote:...


Hi there! Sure, feel free to make improvements and submit a pull request to my Github repo! I would quite welcome help with coding on this: I haven't had time to work on the mod unfortunately, especially with my other mod (Structures) suffering from an engine issue I had to debug last time I picked up Minetest. MT is a great opportunity to learn Lua and even for beginners to get started with coding, I found it a language that's very easy to get into.

I only ask a few things if you make pull requests: Keep the code and comment formatting exactly the same... I tend to have an obsession with keeping code very clean and consistent looking. Always focus on performance and efficiency, I still want this to be as lightweight as it can. Ideally don't break functionality for existing creature definitions. Also please test every change... as a general rule of programming, even the smallest modification can break functionality if you don't look closely. I'll look at each pull and comment if I see something I'd like changed.

As far as the ghost is concerned, I still like the idea of the player spawning as a ghost by default. The thought was to have a world populated with various factions and races, the players joining whichever they find ideal, by navigating the world and finding a mob to possess... when dying the player then proceeds to look for another mob to take the body of. I'd prefer keeping that functionality intact, as well as other basis of how the mod works.

BTW: One thing I never got to implement due to Minetest limitations at the time is a resizable collision box for players... that works for mobs, but the player always had the same fixed one. Maybe this can finally be added with the latest version of the engine?
 

User avatar
Tcll
Member
 
Posts: 21
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 » Fri Nov 08, 2019 14:50

thanks for the confirmation :)
I do know quite a bit about Lua thanks to OpenComputers, and my stresses trying to build an in-world model renderer (custom Lua structure) with OpenGlasses (did I mention I like pain?) XD

buuut there's certainly a few things you'd likely expect a noob to know that I don't. ;D

MirceaKitsune wrote:Keep the code and comment formatting exactly the same... I tend to have an obsession with keeping code very clean and consistent looking.

hahaha you're a bit late telling me there XD
but don't worry, every comment I've gotten by people who's code I've improved was always something they've liked. ;)

MirceaKitsune wrote:Always focus on performance and efficiency, I still want this to be as lightweight as it can.

lol idk anyone who has a bigger hard-on for this than me ;D
heck my python programming does away with the standard library and relies strictly on builtin C functionality to achieve the fastest possible runtime ;)

MirceaKitsune wrote:Ideally don't break functionality for existing creature definitions. Also please test every change... as a general rule of programming, even the smallest modification can break functionality if you don't look closely.

yeah, I try to focus on this as much as I can, but lets just say my OCD wouldn't leave me alone here...
to put things simply, I've already made things much more extendable (taking pointers from another project of mine you already know about), while also making things much more simple to manage.
basically I'm currently working on making every character inherit from a default spec, and override the inherited base fields withwhatever changes/additions are needed.

but overall, the functionality is still the same ;)


MirceaKitsune wrote:As far as the ghost is concerned, I still like the idea of the player spawning as a ghost by default. The thought was to have a world populated with various factions and races, the players joining whichever they find ideal, by navigating the world and finding a mob to possess... when dying the player then proceeds to look for another mob to take the body of. I'd prefer keeping that functionality intact, as well as other basis of how the mod works.

right, I understand that idea, and do like it for those who would prefer it
that's why I said optional, meaning you can enable or disable it ;)
which btw, it'll be enabled by default because it was intended as your original focus. :)

MirceaKitsune wrote:BTW: One thing I never got to implement due to Minetest limitations at the time is a resizable collision box for players... that works for mobs, but the player always had the same fixed one. Maybe this can finally be added with the latest version of the engine?

yeah you mentioned about this earlier, I think on the first or second page
I didn't read through everything, but I did catch that at least ;)

personally I'm not even running the latest engine at this moment
I run Void Linux on the PC I'm running this mod on, where I had to download and extract the unofficial appimage to add libidn.so.11 to it's local lib directory
(yes I know I can run an appimage without extracting it, that's why I love them, but I had a missing library issue with it I fixed)
I'm not sure if the appimage has an update though, but it's annoying to download it to a flash drive to transfer it to my Games directory on that machine...
+ rambling

but yeah I'd like to keep this mod compatible with both engines if I can ;)

but anyways, I'm not gonna bother making a PR, because again, all changes are being done offline (my subnet DNS is down as I've been too busy to figure out how to integrate XFCE with xenodm on it's OpenBSD installation), so yeah, I'll just send you a zip to decide what you want to do with my changes :)

here's a sneak peek to calm your nerves if I've made you tense:
+ creatures_races_default/ghost.lua

there was a little bit of functionality that threw me off balance, and that was the thing I mentioned before regarding load time.

the outfit functions were both a major performance issue, as well as a headache figuring out how to make them conveniently extendable, which was solved by adding them to core modules for common human and anthro definitions in races_default ;)

I did keep the male and female functionality
but I'd like to also add genderless while giving male a hair-style as well
really I'd like to make gender bunk off the male object, since the only addition is really just a hair style
but there are some alert defs I'll need to wrap if I want to make that happen.

hey, at least I'll give an option to enable gender as well :)
(I actually prefer genderless characters, but I leave all to their own prefs)

though really, default configs within mod sources rubs me the wrong way...
maybe this is just a minecraft thing rubbing off on me, but I find it better to have a config file for this stuff...

is there a way to add to the in-game config where I can just use that??
(I'll look it up if unknown, I still got work to do currently, and configs aren't too important atm)

EDIT:
I'm stupid, I know how I can add in-game configs for gender and ghost/player spawn...
and it's something you're already doing for items

just enable the mod if you want it

btw, also an idea I had earlier I forgot to mention
being able to change/add/remove clothes on the fly
this might not be something I'll get around to quickly though

EDIT2:
oh and btw, yes I'm testing constantly
there's 1 issue I'm having I can't seem to figure out...
for some reason, it keeps searching for mobs_anthro_fox.png and can't find it
buuut:
1: can't find that string anywhere in the sources
2: copied the image (renamed from the easter egg) to every possible ./textures/ directory, including ones I created just to test.

there's no reason this error should be warned, and I can't seem to fix it

oh and btw, don't worry about me getting spoilers just by looking at the source XD
just looking at the source and seeing everything that goes on doesn't spoil it for me ;)
I need to actually experience it in game, which I haven't yet :)
(nor am I modifying the rules to experience it, cause that ruins the fun of it)

EDIT3:
hahahah, something I just noticed now that I'm looking into it XD

my behavior goes against every male trait bias you have
a notable mention of which being agressivity
you know I'm male, and my agressivity level is 0.0 :)

some men can be below 0.5, and some women (*cough* my mother) can be above 0.5
(lol my mother wasn't abusive, but she had her moments)

miiiiight wanna reconsider a few things there ;)
perhaps a weight ratio as to more likely averages :)

eg:
trait = {min, avg, max}
trait = {0, 0.5, 1} -- full range, no bias
trait = {0.25, 0.75, 1} -- anything above 0.25 favoring results closer to 1

hope that presents a plausible solution that makes sense for realistic possibilities XD
can even modify the bias if male vs female :)

EDIT4:
btw, if you ever get around to it (if I don't do it first)
"care" would probably be a good trait to add

basically for example if an NPC notices an ally is low on health, they'll share food with them.

EDIT5:
adding to that, a reputation score could determine which NPCs are likely to add another NPC as an ally, or attack/avoid them depending on their traits (it won't be random like it is currently)

yes I'm talking about the alert_all bit :P

EDIT6:
or even better, allow the manipulation of traits to allow NPCs to determine if they want to be good or bad and who they want to help

...
I need to stop my autism before my imagination takes me too far XD
I'll probably work on that as an expansion, while keeping the core functionality about as aimless as Minecraft villagers.

nothing's ever enough for me and there's always a way something can be improved :)

EDIT7:
oh yeah
how can I prevent previously posessed mobs from despawning, and have the persist between logins??

EDIT8:
just to ease your mind a bit more about code style and keeping things clean, I'm sure you'll like this :)
here's how I'm making creatures simpler to create/manage:
Image
yes that's the entire default, human_male, and anthro_fox_male creature fields fitting on my 1600x1200 screen :)
each creature only needs to provide changes to the default fields
how this works is merging the creature table into the default table before returning it

default fields are selected by how likely they are to be used for most creatures
so all you have to do is override them ;)

for anyone interested, the IDE I'm using is IntelliJ IDEA community edition
could be using a better LUA plugin though :P
thankfully this project is tiny :)

EDIT9:
just started on the modules in ./creatures/
hooooo boy there's quite a bit to optimize

hey Mircea, you won't care if I merge some core functions will you??
for example register_creature with register_spawn

after looking everything over here, I kinda wanna merge the spawn data with the creature data:
Code: Select all
register_creature('name', {
    spawn = {},
    ...
})

this should simplify registration even further while also allowing defaults to be more easily configurable (once I go through other registration functions)

yes I'm setting things up to make things like traits more configurable per world.


again though, all I'm doing here is optimizing, I'm not removing any functionality without prior discussion and validation ;)
only adding optional functionality without your say-so XD
(for example, ability to disable clothing on anthros)

EDIT10:
hey Mircea, here's a good optimization tactic for ya to get rid of further table.insert() calls ;D
Code: Select all
local tbl = {
    expression and { items } or nil,
}

tested on outfit_anthro() for female, and everything works perfectly ;D

EDIT11:
oh yeah, now I remember what I really hated about lua...

not it's disgusting:
Code: Select all
end
end
end
end

not the fact arrays start at 1 instead of 0

not it's execution treating ints as floats

what I personally hate the most about Lua
is it's inequality operator ~= instead of !=
since ~ means varying while ! almost always associates with "not"

irl to say i ~= j means i may or may not be equal to j
meaning 0 ~= 1 is True while 1 ~= 1 is also True (though we know it's not because Lua is a special snowflake)

it always confuses the heck out of me XD

EDIT12:
hmm...
here's something that tripped me up
your teams logic has a flaw that requires a new creature race to make changes to every creature...

not quite sure how I can work around it though as the only thing I can think of is to add race bias traits and a global config to make things more dynamic...

I'm sure I'll figure something out in time after staring at it long enough though :)
 

User avatar
Tcll
Member
 
Posts: 21
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 » Mon Nov 11, 2019 23:18

well it's been a few days, so I'm sure a 2nd post won't hurt
my previous post is getting a bit hard to manage

I've overhauled most of the stuff as of current, and almost fully understand the entire mod
(at this rate, I may as well have it be my own fork... lol)
^ I don't need it and don't want to go through the extra git repo work for something this small ;)

but I'm still waiting for the ok to do a restructure (merge data-tables and functions)
(I'm only posting the code in 1 state, and I don't wanna go back to change it)

but for a few extra plans
I'm likely going to go through with adding an on_spawn event to the creature
(I'm sure you'll like this Mircea for spawn effects on your easter egg, or any other creature) ;D
while renaming the current on_spawn function to can_spawn
since all that does is verify the lookup node meets the spawn spec of the particular creature, if supplied

also, logic_mob_step is the absolute reason for all the lag
the function is almost 700 lines in size, making it the largest function in the entire mod

I'm not sure how often this code is called per mob
but it could certainly benefit from being asynchronous
whenever this function hangs, all mobs freeze (similar to minecraft server lag), so the way this works is a for loop on the same execution thread.

I'm not sure how to properly do co-routines yet in lua
I tried it in OpenComputers, but the implementation was broken (single thread)
if I can get it to work though, this mod should run SIGNIFICANTLY better
for example, animations should update properly

in essence, the more virtual threads your CPU is able to handle, the more mobs you can have on screen
virtual threads are different from CPU threads, for example, 4 physical threads may be able to handle ~32 virtual threads depending on IPC
(no, not Inter-Process Communication related to multi-processing, I'm talking about Instructions Per Cycle)

for my cruddy 2 thread Pentium4 I'm running this on, I can only run about 8 v-threads per process before it starts to choke.


Q: if this mod is so small as you say, why is it taking you longer than a week just to optimize?
A: I'm not just optimizing, I'm adding new functionality, and restructuring (defaults only) while still being a noob who's only learning how it works.
(I'd like to restructure even further, making a creature be represented by only 1 table, but I'm waiting for Mircea's feedback)
^ I'm respecting the original structure here, and if that's what Mircea wants, the only way around that is my own fork, which I'm not doing.

EDIT:
well, I've figured out how to make your favorite mobs persist after posession
but now I'd like to make persistence optional where you can leave the mob and disable persistence
killing them seems a bit cruel imo :P

I'm not sure of a method you'd particularly like...
if it's up to me, I'm thinking to r-click the inventory icon to change a persistence state
having the icon framed in purple to show the state.

would like to get your thoughts on this if your preferences differ. :)

also, while I'm on the topic of the icon
I've done something else I'm sure you'll love :D
although this one I'm not gonna spoil ;)
could probably guess it on your first try though XD

EDIT2:
finally figured out what was ACTUALLY causing the load lag
the creatures:outfit method uses a whopping 8 for loops and does double iteration at the base level over all textures with an inner product function call. x.x

first iteration builds layers with each colorized image (string)
second iteration builds skins from layers, each entry being a string grouping the colorized images:
Image
(if I had clothes enabled, this would be exponentially larger)

originally the product function was also defined every time creatures:outfit was called...

Mircea cOmE On, Y U do dis :/
you're better than this.

gonna try and make this single iteration with only 3 or 4 for loops, and pull dot operators to the root level of each loop.

this will still be an exponential performance hit depending on what texture entries you pass to creatures:outfit
but at least it won't be as bad as it was:
O(n^n) instead of O((n^n)*2)

I'll probably rework this later to allow random outfit selection where the texture is built on spawn:
O(n) at best

EDIT3:
yeah I've shifted focus
figured it was stupid to try to follow minetest's above textures spec, when I can literally have far more control with an on_spawn event callback

Mircea already has the api function creatures:configure_mob (I know that's a method because self, but whatever), which seems to be called whenever the mob spawns, as well as randomly throughout the mob's life.

this function configures the mob's textures if textures[1] is a table
so I figure I can have a default spawn event do the same with a definition field (maybe a separate outfit field as well for clothing changes)

all this will do is iterate through def (which should be the same as the current outfit def) and build the textures = {"image.png^..."} image group on spawn.

while the string itself will be continually recalculated, O(n(+n)) is far better performance than a huge lag spike from O(n^n) per mob.

if you don't understand Big-O notation, basically it's a way to measure Operation performance.
for key, item in pairs(tbl) do whatever end is O(n) and local var = tbl['key'] is O(1)

so anyways, I'm going through with my decision to make a texture calculation spawn event...

hey Mircea, should I make on_texture_change an event as well, or just have creatures:change_texture be a separate function??
I could add a custom callback to an event if you want to change your outfit which is why I'm asking. ;)

EDIT4:
spoilers over, it works!
only just though :P
Image
for some reason, whenever the data goes static, both the texture and icon are lost
same whenever posession is done

I forgot about the creatures.player_def var that's set whenever a creature is registered
so I threw texture_defs and icon_defs in that and referenced them in on_spawn

still needs a buttload of work done though
still need to build the change_texture function as well as add outfit_def for clothing
so yeah, I ain't done yet ;)
 

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

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

by MirceaKitsune » Thu Nov 28, 2019 12:32

Sorry for the delay: For some reason I'm not getting email notifications for replies to this thread, despite being subscribed to it! You mentioned a lot of things which I don't have time to read right now, but I looked through your replies quickly and I'm glad to hear things are going well! When you can make a pull request I'll take a look at it in more detail and let you know if there's anything I would like changed.
 

User avatar
Tcll
Member
 
Posts: 21
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 » Thu Nov 28, 2019 13:08

oof, might need to use something like PageProbe to get around that email issue
though on that note, email's working for me. ;)

I'm just glad you got to see the image before my friend's service went down XD
(they'll have it fixed eventually)

but anyways, yeah, again, I won't be doing a PR for this
I'll just be sending you a zip through Mega (or secure email if you use that whenever I finish) ;)

I'm actually more sorry for my inactivity as I've had too many things dragging my face in the dirt as of recent
like my Dec 10 pending google account deletion because of possible YT account termination
(honestly I kinda hope they do it because google will break their last handle on me if they do)

but anyways, I will get back to it when I have more freedom ;)

hope you have a happy thanksgiving ;D
 

PreviousNext

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 4 guests