For Minetest 5.2.0 and later. Return to 2 road networks with smooth-blended junctions. Add information to README. Add description and screenshot

master
paramat 2020-07-29 21:52:01 +01:00
parent 34d3d6eb45
commit f9f9458048
7 changed files with 54 additions and 66 deletions

View File

@ -1,4 +1,4 @@
driftgame 0.1.2 by paramat
driftgame 0.1.3 by paramat
A game for Minetest Engine 5.2.0 and later
Built on the 'minipeli' game by paramat
@ -8,18 +8,38 @@ paramat (CC BY-SA 3.0):
header.png
icon.png
Description
-----------
This game uses a simple road generating mapgen to provide a suitable demonstration environment for my vehicle mod 'driftcar'.
The vehicle uses some physics modelling to create semi-realistic skidding and drifting behaviour.
Many existing games are not suitable for 'driftcar' as they use intensive ABMs or other intensive code that interferes with the control response of the vehicle.
Earlier versions of 'driftcar' mod
----------------------------------
'Driftcar' mod was previously released as a mod for 'Minetest Game' game.
The version in 'driftgame' game is an improved version and development of 'driftcar' will now continue in 'driftgame'.
My GitHub repository for the 'Minetest Game' mod version will soon be deleted.
Using 'driftcar' mod outside this game
--------------------------------------
This mod can be used in other Minetest games.
Keep in mind that the vehicle's tyre grip is reduced on nodes with the 'crumbly' group, so it is a good idea for road nodes to belong to the 'cracky' group.
As mentioned earlier, the vehicle responds best when used in games that do not run intensive code while the vehicle is being driven. If a non-lightweght Lua mapgen is used it is best to pre-generate an area before driving in that area.
Using this game
---------------
Due to client->server->client control delay it is recommended that this game is used in singleplayer or in local multiplayer.
Generation of new areas of world may slightly affect the control response of the vehicle, the best control response will occur in previously generated areas.
Third-person camera mode is recommended when driving for a better view.
Arrow blocks are provided to mark out courses if desired.
How to start playing this game
------------------------------
Decoration placement must be disabled, this can be done in the 'All Settings' menu (Settings tab -> All Settings -> Mapgen -> Mapgen flags) or by adding the line below to your minetet.conf file:
Core mapgen decoration placement must be disabled (because the registered decorations are placed by Lua code in the 'track' mod instead). This can be done in the 'All Settings' menu (Settings tab -> All Settings -> Mapgen -> Mapgen flags) or by adding the line below to your minetet.conf file:
mg_flags = caves,dungeons,light,nodecorations,biomes
Start a new world, the game will only allow 'Mapgen Flat' to be selected.
The optional features of Mapgen Flat: lakes and hills, should be left disabled.
When you enter the world, if the screen is black you are probably inside a tree, walk in various directions to exit the tree.
@ -27,7 +47,7 @@ Type '/grantme all' to obtain all privileges.
Press 'K' to enable fly mode, and 'J' to enable fast mode.
Fly fast to find some track, it might take a minute or more to find it.
Fly fast to find some track.
Place the car on the track, enter it. Press 'F7' to use third-person camera mode.

View File

@ -1,3 +1,4 @@
name = Driftgame
author = paramat
description = This game uses a simple road generating mapgen to provide a suitable demonstration environment for my vehicle mod 'driftcar'. The vehicle uses some physics modelling to create semi-realistic skidding and drifting behaviour.
disallowed_mapgens = v5, v6, v7, valleys, carpathian, fractal, singlenode

View File

@ -2,4 +2,4 @@ Minipeli mod: light
===================
Source code by paramat (MIT).
Textures by paramat (CC BY-SA 3.0).
Media by paramat (CC BY-SA 3.0).

View File

@ -2,7 +2,4 @@ driftgame mod: mapgen
=====================
Source code by paramat (MIT).
Authors of media
----------------
All textures by paramat (CC BY-SA 3.0).
Media by paramat (CC BY-SA 3.0).

View File

@ -2,7 +2,4 @@ driftgame mod: track
====================
Source code by paramat (MIT).
Authors of media
----------------
All textures by paramat (CC BY-SA 3.0).
Media by paramat (CC BY-SA 3.0).

View File

@ -3,29 +3,20 @@
local pathy = 8
local np_patha = {
offset = -0.2,
offset = 0,
scale = 1,
spread = {x = 384, y = 384, z = 384},
spread = {x = 256, y = 256, z = 256},
seed = 11711,
octaves = 4,
persist = 0.6
}
local np_pathb = {
offset = -0.2,
scale = 1,
spread = {x = 384, y = 384, z = 384},
seed = 303,
octaves = 1,
octaves = 3,
persist = 0.5
}
local np_blend = {
offset = 0.0,
scale = 6.0,
spread = {x = 192, y = 192, z = 192},
seed = 95059,
octaves = 1,
local np_pathb = {
offset = 0,
scale = 1,
spread = {x = 256, y = 256, z = 256},
seed = 303,
octaves = 3,
persist = 0.5
}
@ -90,10 +81,8 @@ local c_roadwhite = minetest.get_content_id("track:road_white")
local nobj_patha = nil
local nobj_pathb = nil
local nobj_blend = nil
local nvals_patha = {}
local nvals_pathb = {}
local nvals_blend = {}
local data = {}
@ -123,10 +112,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
nobj_patha = nobj_patha or minetest.get_perlin_map(np_patha, pmapdims)
nobj_pathb = nobj_pathb or minetest.get_perlin_map(np_pathb, pmapdims)
nobj_blend = nobj_blend or minetest.get_perlin_map(np_blend, pmapdims)
nobj_patha:get2dMap_flat(pmapminp, nvals_patha)
nobj_pathb:get2dMap_flat(pmapminp, nvals_pathb)
nobj_blend:get2dMap_flat(pmapminp, nvals_blend)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
@ -136,39 +123,26 @@ minetest.register_on_generated(function(minp, maxp, seed)
for z = z0 - 4, z1 + 4 do
-- Initial noise index at x0 - 4 for this z
local ni = 1 + (z - (z0 - 5)) * pmapdim + 1
local xpreblend = (math.tanh(nvals_blend[(ni - 1)]) + 1) / 2
local n_xprepath = (1 - xpreblend) * nvals_patha[(ni - 1)] +
xpreblend * nvals_pathb[(ni - 1)]
--local n_xprepatha = nvals_patha[(ni - 1)]
--local n_xprepathb = nvals_pathb[(ni - 1)]
local n_xprepatha = nvals_patha[(ni - 1)]
local n_xprepathb = nvals_pathb[(ni - 1)]
for x = x0 - 4, x1 + 4 do
local blend = (math.tanh(nvals_blend[ni]) + 1) / 2
local n_path = (1 - blend) * nvals_patha[ni] + blend * nvals_pathb[ni]
--local n_patha = nvals_patha[ni]
--local n_pathb = nvals_pathb[ni]
local zpreblend = (math.tanh(nvals_blend[(ni - pmapdim)]) + 1) / 2
local n_zprepath = (1 - zpreblend) * nvals_patha[(ni - pmapdim)] +
zpreblend * nvals_pathb[(ni - pmapdim)]
--local n_zprepatha = nvals_patha[(ni - pmapdim)]
--local n_zprepathb = nvals_pathb[(ni - pmapdim)]
local n_patha = nvals_patha[ni]
local n_pathb = nvals_pathb[ni]
local n_zprepatha = nvals_patha[(ni - pmapdim)]
local n_zprepathb = nvals_pathb[(ni - pmapdim)]
-- Detect sign change of noise
if (n_path >= 0 and n_xprepath < 0)
or (n_path < 0 and n_xprepath >= 0)
or (n_path >= 0 and n_zprepath < 0)
or (n_path < 0 and n_zprepath >= 0) then
if (n_patha >= 0 and n_xprepatha < 0)
or (n_patha < 0 and n_xprepatha >= 0)
or (n_patha >= 0 and n_zprepatha < 0)
or (n_patha < 0 and n_zprepatha >= 0)
--(n_patha >= 0 and n_xprepatha < 0)
--or (n_patha < 0 and n_xprepatha >= 0)
--or (n_patha >= 0 and n_zprepatha < 0)
--or (n_patha < 0 and n_zprepatha >= 0)
--or (n_pathb >= 0 and n_xprepathb < 0)
--or (n_pathb < 0 and n_xprepathb >= 0)
--or (n_pathb >= 0 and n_zprepathb < 0)
--or (n_pathb < 0 and n_zprepathb >= 0)
or (n_pathb >= 0 and n_xprepathb < 0)
or (n_pathb < 0 and n_xprepathb >= 0)
or (n_pathb >= 0 and n_zprepathb < 0)
or (n_pathb < 0 and n_zprepathb >= 0)
-- Smooth corners of junctions
--or math.pow(math.abs(n_patha), 0.1) *
--math.pow(math.abs(n_pathb), 0.1) < 0.5 then
or math.pow(math.abs(n_patha), 0.1) *
math.pow(math.abs(n_pathb), 0.1) < 0.5 then
-- Place track brush of radius 4
for k = -4, 4 do
local vi = area:index(x - 4, pathy, z + k)
@ -188,9 +162,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
ni = ni + 1
n_xprepath = n_path
--n_xprepatha = n_patha
--n_xprepathb = n_pathb
n_xprepatha = n_patha
n_xprepathb = n_pathb
end
end

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB