-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Engine API for Mobs #2291
Comments
As for the fork: It already happend, it is called “Voxelands” now (formerly “Minetest-Classic”). It is based on the 0.3 codebase of Minetest-c55. |
👍 I too would like to see faster mob processing at some point in the future. |
Well, there are a lot of open questions: What should the “mob API” from Minetest do? Which capabilities do you wish (both of the API and the mobs themselves)? What features? How should/would mobs differ from entities? What Lua functions should be available? Which would be the limits? Do you want a more generic approach to mobs or a more specific one? What kinds of mobs should exist (mob “classes”)? How should mobs relate to the groups system? What kind of attacks would be possible? What could modders do if they find shortcomings in the mob API? And, and, and … |
Indeed. Tons of feedback required. |
i also agree that the engine must have a little mob/pnj processor with high lua extensibility. But it needs to be discussed with other devs |
The problem is making it extendable. Let's design it from the top down. It needs to support these types of mobs: Must do
Could do
Why C++?Client side prediction would be required to make it seamless on servers. C++ runs faster than Lua, less switching between C++ and Lua. |
It's not the priority, because there are many things to do in the engine before adding new huge features for game, but we need to discuss on it together to find a good implementation |
The priorities should be:
I agree that we should talk about possible architecture. |
agree |
Man rubenwardy you go all in with everything you do don't you? I love it. No slackin' round here. |
It's only because I am on the computer and can type quickly. The thing is that it is all well and good suggesting a feature, but it would need to be implemented and methods of writing it needs to be discussed as well. EDIT: It also interests me. XD I'd suggest a modular design that Lua mods can extend. That way mods can add new behaviour to the basic framework without needing to edit C++. By this, I mean that:
I imagine you'd need to derive a MobEntity from Entity like LuaEntity is derived from it. (OOP-wise) |
@rubenwardy agree |
Wow, so many comments in one day! I like @rubenwardy 's ideas, and I think they would do nicely for an engine. See, what I'm thinking is we could have MobEntity already have some things made in C++ that LuaEntities must have in lua. |
I think Minetest shouldn't contain any mobs by default. |
That is what we are saying.
|
Providing that mobs don't lag much on miltiplayer, I think they should be part of minetest_game, although they should be able to be disabled from a setting. Explicitly disable subgame mods could be good for this. |
"Mod" is the word you are looking for here. |
No, because mods aren't counted as part of Minetest. They're mods. |
The whole "you can just install a mod" argument is damaging the gameplay experience. Minetest should be customisable, but it should already be shipped with a fully working and fun game. While I don't particularly care for monsters, animals add to the 'immersion' of the game. |
I agree with rubenwardy. We can't just make this game for developers. It turns out we've all been under the proggramming sun too long. There are those who hide in the gamer caves and... Did I ever mention I write books for NaNoWriMo? (National Novel Writing Month). Anyway, we can't assume everybody wants to get tons of mods. I know people who download and sometimes make mods for minecraft, but I'm sure there is a distinct amount of people who use vannila entirely. Meanwhile, you can't play minetest without mods. (Or using V7 and attempting a very explorative survival, but that uses lots of CPU.) |
Please stay on topic, I thought we are just talking about the mobs API. DIscussion about minetest_game should go here: Other Minetest-related stuff goes here: Not that I am a moderator, I'm just saying … Anyways, back to topic:
Examples for basic movement patterns:
I also would like to invite BlockMen into the discussion, because BlockMen authored the Creatures mod. I think we could get some good input from there. |
@C1ffisme agree, it's not only a developper playground it's a serious game used by players. |
Yes, it is offtopic. Minetest_game stuff should be worried about later.
The movement patterns would need to support any monster/animal you could
think of. I'm not sure about plants. They could be cool, but they would be
better as interactive nodes in my opinion, but that's a different feature.
Unless they are in plant pots and can jump. Birds can walk and can fly.
It would be useful to find some PDFs of papers that describe existing
algorithms, and look at how other projects do it. I can't search very well
on my phone.
|
Movement patterns may be added through Lua with C++ speed if there would be some algorithm we can pass as a table and there will be a "decipher" which will interpret the passed table as a patterns for every case: idle, running away, following smth/someone, getting punched, attacking, jumping, swimming, flying, etc Those tables may even contain several concurrent patterns chosen pseudo-randomly (for client prediction to work seamless). It would be also wise to add the ability to override C++ methods through Lua, but that is smth we already have. Can it be optimized by itself? (E.g. not because network proto became faster). |
Mobs are needed in the game, without them even in multiplayer is boring. |
Is anyone willing to work on a usable mob engine? If we start a simple one, we could work up to something decent. |
I'm not making any promises, but I have started work on a mob engine/framework/whatever. I will share design goals and implementation later, when there is something to share. I'm using the time to teach myself the various skill that I need to make this successful, as well as do the design work without being encumbered by people telling me to make a pixel darker. If you follow my youtube channel you can monitor progress. I'm regularly posting videos of what the current state is of the engine, although I'm explicitly not giving any details yet at this point in time. I will not go into discussion about technical details in this thread. I have collected my requirements by looking at feedback from players on the forums and github, and am considering all the opinions already, so there's very little to be added. Needless to say that I have my standards set very high and I'm not making something simple (even though it may appear simple at first sight). |
@sofar Well, I hope something good comes out. I think this issue should be closed, and a discussion on the forum opened. |
This is an often requested and important (imo) feature. This is a good place to discuss it |
The first thing to do is to have a base class between all lifen SAO (PlayerSAO and LuaEntitySAO) which have common features, i propose UnitSAO as an intermediate which have some common features. I could provide a PR backported from my fork for this. |
I guess the most problems with the performance of different mobs mods is not C++ vs. Lua speed, but lacking architecture. The same optimizations/algorithms may be done in Lua as a mod as a proof-of-concept and only later, when there is a lot of good feedback from users and server owners, moved into the core and implemented in C++. This guarantees faster reaction on users request due to dynamic nature of Lua and independence of engine's development process, which leads to better understanding of what kind of API would be useful. Then, periodically, parts of that API may be moved into the core. |
Then there should be an official public poll or else any new mobs API would end like "yet another mobs API". I'd suggest making a new poll for every major release and add to C++ whichever API would be the most popular. |
Minetest development (just like any OSS project) isn't a democracy. I don't think the mob API should be in C++ ever. @neoascetic 's comment that likely this is best coded in Lua, and then optimized where needed in C++, is far more realistic and the right approach. Make it in Lua, optimize in C++ where needed. If you look at my nodeupdate optimization, you can see that with well-written solutions, you really don't have to grab for C++ that quickly. |
I'm going to have to agree with @sofar. Doing mobs in the engine would mean that a large chunk of the mob API would be hard-coded, and that wouldn't be very good for an engine like Minetest, where you can create anything you want. |
I agree that the problem is not about C++ vs Lua. However, I believe it's more of a client vs server issue. Mobs (and other entities like mounts, cars, boats and other transports) work flawlessly in singleplayer, where server-client latency is barely present. The problem is that Lua is only server-side, so it's not possible to code movement patterns in Lua to be performed directly in the client. Also, even if the patterns were coded in the engine, having client-side logic might bring other problems like players getting out of sync between each other (so they see the entities in different states) and cheaters using modded clients if this logic is not monitored server-side as well periodically (which might end up resulting in latency issues anyway unless a certain margin of error was allowed). It would be awesome to find a simple solution that didn't require any messing around with prediction or syncing states... but I'm not sure if it exists. Not if you have entities that need low latency. Maybe the situation could be improved by at least calculating some of the movement patterns in the engine. |
#3440 is related. As I've said, having client-side Lua scripting would be a great improvement. |
I will start my own engine, but with a different approach than the others. I will write it in lua, but with C++ in mind. Each function, that should be written in C++ will be separated from the other parts I don't think, there is really a need for a huge mob api, because the common functions for all mobs can be reduced to a hand full of functions. Register, create, delete and move. And they already exist But there are functions like a collision callback, which are totally missing yet and which should be implemented in C++. Also different kind of "sensors" with callbacks would be helpful to make mobs more complex and give them more abilities. But these sensors must be written in C++ because the necessary informations are not available for mods or only at a high cost and because of possible lacks of more than a second in functions like on_step or register_globalstep. The behaviour should be done server side, but in a script, because each mob can have different behaviours. Instead of putting different fixed behaviours into the api it would make more sense to provide some basic behaviours as templates which can be modified (or not) I don't think, client side scripting solves the problem. It will open new issues with collision detection, out of sync problems between players and more. There should be other improvements in the client/server communication to solve this. |
I think there's a MTG issue about this, and I feel like this issue is kind of pointless now, since the issue discusses the implementation of mobs at all, which most definitely includes engine support. Does anyone care if I close this? |
don't close it as it's an issue we will solve, maybe in next release (0.5) |
Ok. |
See MTGame issue luanti-org/minetest_game#1667 especially sofar's comment luanti-org/minetest_game#1667 (comment) |
Agree with @MarkuBu. At the time the whole mob logic is allways in on_step, called unreasonable multiple times each second. In each call the method gets environment data and entity data, check if anything is happens and react on them. That is the main impact at the time from my point of view. The entity should pass more events from c++ world to the lua callbacks:
|
👍 so much. This will also be incredibly useful for non-mob entities. Using Fun fact: Currently, falling node entities query |
can be improved in "blind way" by on_collision callback, if implemented :D |
Why closing this while other duplicate have been also closed ? i.e. where the entity/mob feature is tracked ?
If minetest doesn't want to provide any entity support, would be happy to have it written... |
Games and mods can already implement mobs, I don't see any specific need for an engine API here. This issue has also been open for a long time with no real conclusion What would be good is more engine support for features that makes mobs mods easier/better, that's something that should be created as new issues. Examples include pathfinding improvement, animations, and sensing utilities |
I think this issue should be reopened and renamed into "Enhance entity API to support mobs mods development". In my last steps in mobs development attempts I missed the next entity methods:
But now I scrolled up and see I wrote the same in 2017 |
|
Please open new tickets for those features |
You've seen the mods. Just download one and see the bugs or lag. If we could have the engine running the behavior of mobs, I think that they would go faster. We could make a function like minetest.register_mob(), then all you would have to do for an animals mod is use the (hopefully many) features in the function, and make models and textures (and maybe some sounds). I know many laggiful server owners will run in terror at the word "mobs", but I think that minetest can't say it's for old computers anymore. It's just too filled with features. If we wanna leave a version for older computers, someone better fork minetest before this gets added (if it does).
The text was updated successfully, but these errors were encountered: