Minetest for Scientific Research

Minetest for Scientific Research

Postby jeg » Thu Apr 18, 2019 5:48 pm

Hello,

I have a question about configuring Minetest as a modeling and simulation platform that can be used with machine learning algorithms. I'm motivated by research in reinforcement learning whereby a machine teaches itself how to play video games. While training, a machine needs to run many, many, many instances of the simulation to eventually determine the correct actions to take. Is it possible to configure minetest to do the same? Can I execute many, headless instances of a world that run faster than real time? Can I save the complete gamestate when needed? If so, how would this be done?

Thanks!
jeg
New member
 
Posts: 2
Joined: Thu Apr 18, 2019 12:45 am

Re: Minetest for Scientific Research

Postby bhree » Thu Apr 18, 2019 7:17 pm

This is interesting although I'm not sure either how this will be done. There are some mod which can make certain parts of map always active like this viewtopic.php?t=10006 and bot client which always connect and put non real player viewtopic.php?id=4964.
For saving state of the game, everytime when we stop game instance some mods will serialize their specific data to disk. I'm still new and I hope to see more MT experienced devs to say something.
I will be happy for any update since this is related to science.
bhree
Member
 
Posts: 156
Joined: Tue Jun 19, 2018 7:45 am
GitHub: bhree
In-game: bhree

Re: Minetest for Scientific Research

Postby parasite » Thu Apr 18, 2019 7:20 pm

jeg wrote:I have a question about configuring Minetest as a modeling and simulation platform that can be used with machine learning algorithms.


Hello!
Great idea! I hope you will establish that project! Perhaps this experience will also help to enrich the minetest itself (can you imagine npi and mobs based on learning algorithms?).

Well, I am not sure how you need to link minetest to your learning app, but you can run as many minetest games in the same time as your machine can handle. For example, in Windows you need just to click on minetest.exe more times than one ;) There are some players who log in to one server with few nick names in the same time lol And if I am correct, administrators of network servers are also able to run them in console mode, so that they do not have to have that minetest visual window with the first-person view mode at all.

But I am afraid, however, that playing the minetest game faster than normal, as you can play chess with a computer faster than normal, is probably impossible. And there is no "save" button you need or you can to click on during the game. However, every time you come back to the game after you left it, you do not start all over again. What you have done before is automatically saved in database. Therefore, there is no need to manage any additional files that keep the state of the game. Everything is stored in the "worlds" folder, and you simply start the game (the server) or leave it (log out of the server).

But I am no expert. I I am sure, or at least I hope that someone from devs will answer your questions right away in much more details.

How much time would your learning algorithm need to develop to self-extract different metal ores and throw away unnecessary cobbles, if it could only play one minetest application at a time and at a normal time? Just a question...
parasite
Member
 
Posts: 141
Joined: Sat May 06, 2017 5:45 pm
GitHub: Parasitoid

Re: Minetest for Scientific Research

Postby jeg » Thu Apr 18, 2019 8:18 pm

Thanks, bhree and parasite.

I was poring over the server code to see how timing and synchronization is handled and it looks like the environment has a constant(ish) heartbeat and the server steps time forward in units of dtime (line 450 in server.cpp). This same interval is sent to all the clients (around line 540). dtime is capped at 2.0 and this logic is mirrored on the clients.

One trick to speed up the execution would be increasing dtime, so more time elapses for each tick. I'd be interested in knowing why the 2.0 limit was set. Is this due to an animation, interaction, or synchronization constraint? Hopefully someone on this discussion board knows the answer.
jeg
New member
 
Posts: 2
Joined: Thu Apr 18, 2019 12:45 am

Re: Minetest for Scientific Research

Postby bhree » Fri Apr 19, 2019 3:49 am

Since it is open source we can do experiment to modify to suit our need. Inside the game itself we can set timespeed which affect day and nighttime span. So, there are some option, depend on requirement. I also want to know about this.
bhree
Member
 
Posts: 156
Joined: Tue Jun 19, 2018 7:45 am
GitHub: bhree
In-game: bhree

Re: Minetest for Scientific Research

Postby sofar » Fri Apr 19, 2019 4:47 am

While training, a machine needs to run many, many, many instances of the simulation to eventually determine the correct actions to take.


There are no such rules, so any AI will have a really hard time. You probably want to consider making several different goals and define them:

- a PvP goal: slay as many player opponents as possible
- a hoarder goal: fill boxes with valuable ores and gemstones
- a survival goal: happy little camper that fishes, grows some food, builds a small house
- a traveler goal: explores the world

and of course:

- a troll goal: just spams chat begging for help

Joking aside, without a goal statement you're likely never going to have any succcess, most AI projects don't work like that. They do things like "recognize a car in a photograph" and get rewards for getting it right and guessing based on visual attempts to recognize the target.

You can do as many server ticks as your CPU can manage. If you go too fast they are just skipped. Your clients also need to process them, and ideally you probably should make a custom client that speaks the proper protocol and knows what an inventory is, and can read the map. All of this is doable, all of this is gobs of work, though.
sofar
Developer
 
Posts: 2080
Joined: Fri Jan 16, 2015 7:31 am
GitHub: sofar
In-game: sofar

Re: Minetest for Scientific Research

Postby twoelk » Fri Apr 19, 2019 6:26 am

nah, no slaying please
- make the sheep less dumb maybe. Let it search for grass and attempting to not die might be difficult enough. It might find out where to look best for grass by wandering around and analysing the terrain for biom clues and it might be able to learn from falling of cliffs or venturing into water ... it might learn to run away when a wolf is in sight and run if it sees a sword or hold still if it detects shears. All this is allready possible in a hardcoded way but maybe a sheep that learns becomes better at surviving. Actually I always thought that a mob should be able to run as connected bot with all the decision making done in the client and not by the server.
We did have surveying bots but their movement was rather crude and annoyed by triggering mapgen and thus bloating the map-database-size. So any acceptable bot should try and keep to explored area.

The traveller goal might be indeed rather interesting. I could imagine a donkey bot that connects two market places and tries to find the most efficient path between those two spots. Each bot could have slightly different prefferences and when they meet they could exchange data about good paths and places to avoid. I wonder if, after they have established a well trodden path and after some time some player builts a new road that uses a different route but by using tunnels and bridges constructs a better connection, these hopefully intelligent seasoned travellers explore this new option and switch to the better route.
twoelk
Member
 
Posts: 1311
Joined: Fri Apr 19, 2013 4:19 pm
GitHub: twoelk
In-game: twoelk

Re: Minetest for Scientific Research

Postby Hybrid Dog » Fri Apr 19, 2019 11:56 am

Minetest is a game where people have decide themselves what they do, for example build a house or explore the technic mod. Nonetheless, there are some mods or games which add (usually optional) goals, for example skyblock. I think you can learn how to play skyblock, but you need to use the interface which a usual player has, i.e. interpret what is shown on the screen, otherwise you'd only behave like a cheater (e.g. seeing through walls).
Hybrid Dog
Member
 
Posts: 2725
Joined: Thu Nov 01, 2012 12:46 pm

Re: Minetest for Scientific Research

Postby sofar » Fri Apr 19, 2019 8:27 pm

twoelk wrote:- make the sheep less dumb maybe. Let it search for grass and attempting to not die might be difficult enough. It might find out where to look best for grass by wandering around and analysing the terrain for biom clues and it might be able to learn from falling of cliffs or venturing into water ... it might learn to run away when a wolf is in sight and run if it sees a sword or hold still if it detects shears. All this is allready possible in a hardcoded way but maybe a sheep that learns becomes better at surviving.


This is what AI is supposed to learn itself. You need to give it a goal and let itself decide to try random things, and then you tell it how well it did. If you start giving it hints, it will find stuff you already know (gotta eat grass to survive), but what you want is for it to find out things that you didn't know (if one of the herd sacrifices itself to a wolf the herd has a better chance of survival).
sofar
Developer
 
Posts: 2080
Joined: Fri Jan 16, 2015 7:31 am
GitHub: sofar
In-game: sofar



Return to General Discussion



Who is online

Users browsing this forum: Yandex Bot [Bot] and 0 guests