How to start?

Stenzl
New member
 
Posts: 2
Joined: Sun Dec 04, 2016 12:44

How to start?

by Stenzl » Sun Dec 04, 2016 13:11

Hi!

After playing the tutorial subgame, I got the idea to use Minetest as an engine for a 3D point&click adventure. So I started reading about subgame development, but I got stuck right at the beginning and maybe you can shed some light on it.

First, is there a tutorial on how to create own subgames? I already looked into the Minetest WIKI, but the one I found was the Minetest Modding Online Tutorial Book.

However, my main problems seem to be more basic ones, so this wasn't of much help. So here come my questions:

1) First I would like to model the world. The only way I know of is to play minetest in the creative mode. But isn't there an easier way?

2) Then I would like to specify and place the objects, the player will be able to interact with. How to place them (in principle similar question as in 1)?

3) It seems that after this point, LUA is needed. Is it correct that I have to register my objects using minetest.register_craftitem but? How is this registration linked to a specific object I placed in the world?

4) I understand how to specify recipes and smelting. But how can I specify the behavior of such an object when it is used? In classic adventures, when using an object without success, the protagonist is saying something, maybe giving a hint.

5) Is there a way to implement a "look at" function?

Thanx!
 

User avatar
firefox
Member
 
Posts: 1341
Joined: Wed Jan 14, 2015 07:34
Location: Hidden Ninja Village
In-game: Red_Fox

Re: How to start?

by firefox » Sun Dec 04, 2016 16:28

Stenzl wrote:1) First I would like to model the world. The only way I know of is to play minetest in the creative mode. But isn't there an easier way?

the mapgens v5, v7 and valleys have a biome API which allows you add/replace the default biomes with custom ones.
it will still be a random world though, if you want a specific set-up you have to build it yourself and then use that map file for the game. (like the tutorial does)
Stenzl wrote:2) Then I would like to specify and place the objects, the player will be able to interact with. How to place them (in principle similar question as in 1)?

same answer as 1 - you can use the API to add decorations (blocks or shematics)
Stenzl wrote:3) It seems that after this point, LUA is needed. Is it correct that I have to register my objects using minetest.register_craftitem but? How is this registration linked to a specific object I placed in the world?

craftitems are usable items. they cannot be placed in the world, unless you use a function to place chests and store them inside.
minetest.register_node is used to register blocks. (and there are more)
the registration just adds the item to the game, placing blocks and objects on the map is done by the mapgen.
if you register a block, but don't register a craft recipe for it and don't include it in the mapgen or any event to generate/drop it, then the block will exist in the game, but is unobtainable by normal means. it would still appear in the creative inventory or could be given by the /giveme command.
Stenzl wrote:4) I understand how to specify recipes and smelting. But how can I specify the behavior of such an object when it is used? In classic adventures, when using an object without success, the protagonist is saying something, maybe giving a hint.

items can have an "on use" function that defines what happens when the item is used. you could make this function do anything and even set different events for using the item when targeting certain nodes.
Stenzl wrote:5) Is there a way to implement a "look at" function?

that depends on what that function should do...
if you want to implement identifying unknown items, you could register an "unknown item" with a "on use" function that turns it into another item when used. you can make the function check for specific conditions to be met in order to resolve. for example only changing the item if the light is above a certain level, so that the player cannot identify items in dark places.
 

hajo
Member
 
Posts: 372
Joined: Thu Oct 13, 2016 10:45
Location: DE

Re: How to start?

by hajo » Sun Dec 04, 2016 16:54

Stenzl wrote:After playing the tutorial subgame, I got the idea to use Minetest as an engine for a 3D point&click adventure.

That would be a major change to the game, and most likely a lot of work.
So I started reading about subgame development, but I got stuck right at the beginning ..
First, is there a tutorial on how to create own subgames?
I already looked into the Minetest WIKI, but the one I found was the Minetest Modding Online Tutorial Book.

Most subgames consist of a set of mods, and a bunch of settings in some config-files.
These mods bring extra blocks/items/tools/armor/plants/monsters etc. into the game,
as well as extra mechanics (such as hunger, or ctf).

So here come my questions:
1) First I would like to model the world.
The only way I know of is to play minetest in the creative mode.
But isn't there an easier way?

If you enter a game in creative mode, the world = map/landscape
has already been created by the mapgenerator.

There are several map-generators, and mods like mg_villages.
But it depends on how much detail you want.
In a tiny, static world like the tutorial (128x128x128), you can specify everything yourself.
Not so much in a random, normal sized world (61840 blocks in any direction).

2) Then I would like to specify and place the objects, the player will be able to interact with.
How to place them (in principle similar question as in 1)?

How do you know where to place objects, after the mapgenerator has made a map ?

3) It seems that after this point, LUA is needed.
Is it correct that I have to register my objects using minetest.register_craftitem but?
How is this registration linked to a specific object I placed in the world?

4) I understand how to specify recipes and smelting.
But how can I specify the behavior of such an object when it is used?

That would be part of the code that defines the object of a mod.

In classic adventures, when using an object without success, the protagonist is saying something, maybe giving a hint.

Have a look at Lua Modding API Reference,
* Global callback registration functions
* minetest.register_on_dignode()
* minetest.register_on_punchnode()
etc.

5) Is there a way to implement a "look at" function?

Function exists - you just point at things with the crosshair.
See "Node Metadata" - infotext: Text shown on the screen when the node is pointed at
 

User avatar
Wuzzy
Member
 
Posts: 2770
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: How to start?

by Wuzzy » Sun Dec 04, 2016 22:02

After playing the tutorial subgame

Feedback about the Tutorial will be very much appreciated. There's also a German thread. I am especially interested what 8y has to say. This feedback will be invaluable for the quality of the tutorial.

3D point&click adventure.

Interesting idea. But it is not exactly what Minetest is built for. But I think with some trickery here and there it might be possible. But you definiately should gain more modding experience first.
The main problem with this idea would be that Minetest lacks native (!) support for static predefined worlds which are tied to a subgame, as opposed to procedurally generated worlds.

But I think the general idea seems possible, even if it breaks with a lot of Minetest's core assumptions. Hell, if the Tutorial would be a game, it is kinda like a prototype of an adventure.

If you would give more information about your general conceptual ideas of the gameplay of your planned game, I might tell you to what extent this idea is possible with Minetest.

Stenzl wrote:First, is there a tutorial on how to create own subgames? I already looked into the Minetest WIKI, but the one I found was the Minetest Modding Online Tutorial Book.


As far I know, there is no tutorial and I doubt there is a need for it.

Subgames are technically very simple:
Technically, a subgame is almost just a collection of mods which the subgame author decided they belong together to form a finished game/sandbox/whatever. What makes subgames special is that they can be launched from the main menu.
Theoretically, if you would just start with the plain Minetest without any mods, and then start to enable mods from the main menu, and then attempt to launch the world with these worlds, you have pretty much the same result as if you launched a subgame with these mods.

Subgames also have some metadata files for configuration, subgame name and the main menu imagery. A subgame is practically nothing but mods.
And that's basically it. Mods in a subgame are no different than any other mods, which means you can theoretically collect mods from these forums and put them into the subgame.

Since the lion's share of a subgame is using mods with it, you first should definitely gain some experience with modding. Especially getting the mod dependencis right is very important. You might also want play some existing subgames, just to get a feel for what is possible. ;-)
Starting a subgame from scratch might be a bit too hard for newcomers, so I strongly suggest you first write some standalone mods to get a “feel” for the Lua API.

The file lua_api.txt contains some information about subgames in the section named “Games”.

Some hints for getting started with modding (and, to an extension, building subgames):
  • Look in the forums for mods. Mods without any dependencies are an invaluable resource, since chances are high you can just blindly add them to your subgame and they work out of the box.
  • http://dev.minetest.net/Mod_interoperability contains a list of mods with APIs
  • The minimal possible subgame is just a directory with the file game.conf inside. Which means you can start with a literally empty subgame (no mods) and add more and more mods over time
  • Some mods you might find useful: Player Model (adds a 3D model for the player. Without this you just have an ugly 2D sprite. If you included the mod “default” from Minetest Game, you don't need this). And basic_hud (starter pack of very basic default textures. For a proper game, you might want to replace or remove them later)

1) First I would like to model the world. The only way I know of is to play minetest in the creative mode. But isn't there an easier way?

I think you want to create a mostly static predefined world just like the tutorial. The sad news is, it is actually pretty hard to do so with the Minetest's core tools. At least when you want to strongly tie the world to your subgame. The tutorial uses a lot of dirty non-standard tricks to generate the world from a saved file. And the world generation code seems to be buggy, so I can't recommend it to re-use it at the moment. Maybe it is time to create a feature request to request native Minetest support for static worlds. Currently, Minetest is heavily focused on procedurally generated worlds practically no natice support for static worlds.

(Technically, Creative Mode is a very awkward thing in Minetest. Most of Creative Mode's changes actually come only from the subgame. There is only one change which comes from the engine, and that is that tools don't wear. I guess even this exception might be phased out sooner or later. Honestly, I don't like how Creative Mode works and some people have proposed ideas to change it.)

However, there is another way which definitely works, but it may not be so pretty to use:
First, force the singlenode mapgen in one of your mods. This leads to a world full of air. Then use the WorldEdit mod to place the first block, and then either build everything by hand or continue to use the WorldEdit tools to build your awesome world. This of course assumes that your subgame is already far enough to have some nodes (blocks) registered you can place.

Then, when your world/game is finished, you MUST backup your world. And then just share the world with the subgame and tell the players to use the subgame only with this world. Keep a copy of the original world in the initial stage (=before the game starts) at all costs, and keep it out of the worlds directory, since every time you visit it again, Minetest will immediately change the stage of the world (the world state is automatically saved all the time). Also, you should not include WorldEdit with the finished subgame (players can always install the mod themselves, if they really want to).

Sharing the subgame + world was the original approach of how I distributed the Tutorial. It worked, but it has downsides: First, it is flimsy to use. There is no easy way to “reset” the world. The user has to delete the world and obtain the original (unattended) world again. This is inconvenient since this can't be done in the main menu and the user is required to fiddle around with the file system. However, I definitely recommend for you to start off with this first approach because it is much simpler to get started with.

And maybe, just maybe, Minetest might inttroduce much better support for static worlds. Since this is a totally legit use case and would open the door for new genres.

2) Then I would like to specify and place the objects, the player will be able to interact with. How to place them (in principle similar question as in 1)?

I don't know what you mean by “object”. Dropped items? Then read answer to 3)
For other objects, you might want to look up the documentation on entities.

3) It seems that after this point, LUA is needed. Is it correct that I have to register my objects using minetest.register_craftitem but? How is this registration linked to a specific object I placed in the world?

Do you mean dropped items? Those are technically entities with the entity identifier __builtin:item. There's a function in the Lua API somewhere to spawn dropped items, but I am too lazy to look it up.

4) I understand how to specify recipes and smelting. But how can I specify the behavior of such an object when it is used? In classic adventures, when using an object without success, the protagonist is saying something, maybe giving a hint.

Already answered.

5) Is there a way to implement a "look at" function?

I don't know exactly what you mean. There are functions to set the viewing direction, something about pitch and yaw.
If you mean “look at” like “examine” like in many adventures, it is a bit tricky, but I guess it is probably possible. You probably want to overwrite the “on_rightclick” event on nodes and entities. When the player then points and rightclicks on a node or entity, the on_rightclick event is triggered which you can then use to call the examination-related functions. This is just one possible strategy I came up with ad hoc. It would be better if you gain more experience with modding yourselves so you can judge for yourselves which strategy would best fit your needs. Don't trust my word for it.



Oh, and before I forget: Obtain some modding skills, then most of your problems may solve themselves. ;-)
I'm creating MineClone 2, a Minecraft clone for Minetest. I made the Help modpack, adding in-game help to Minetest.
 

Stenzl
New member
 
Posts: 2
Joined: Sun Dec 04, 2016 12:44

Re: How to start?

by Stenzl » Mon Dec 05, 2016 20:25

Wow!

Thank you so much for all this detailed information. I now have a better idea of how thinks work in Minetest. It is a different concept than I thought of. So I first will have a closer look into modding. Then I'll see.

Wishes,

Stenzl
 

User avatar
Lone_Wolf
Member
 
Posts: 1612
Joined: Sun Apr 09, 2017 05:50
Location: Hometown server
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf or Somebody

Re: How to start?

by Lone_Wolf » Tue May 23, 2017 05:38

If I started minetest_game with some mods added, what do I do to make it a subgame?
I set it so that I get a copy of every world I play in. If it requires lua I won't be able to do...
 


Return to Subgame Discussion



Who is online

Users browsing this forum: No registered users and 1 guest