Hi everyone! I have been working for a year or so on outlines for a transport game - the eventual idea is something like OpenTTD but without a grid (so more freeflow) but I thought I would start out with a 3d/2.5d model railway game.
I'm actually a software engineer by trade (though more high-integrity/,embedded). I have some prototype code for working out how tracks ought to be shaped, and how to simulate train positions over time. But obviously I need to visualise it.
Since the game starts out blank canvas and the player introduces most elements (playing the tracks, buildings, etc.) it seems I will need a lot of procedural generation. Is godot suited for this type of game, or am I going to be fighting against the engine a lot?
This should work well in Godot IMHO. Naturally, you'll always have to get used to the game engine. (As with every engine)
Your game might need some GUI elements. As Godot uses the same UI Elements in its own editor as are available for the games you can select of quite a big list.
You can also let run code inside the editor (including generating meshes) using tool scripts and Plugins. This isn't directly meant for players though more but to assist in the development process / testing.
If your track-models can be assembled in a certain grid then it might be helpful to use a gridmap (although my knowledge is limited there).
Godot also supports storing data in JSON format so you can easily store data structures like Arrays/Dictionaries. (Just a hint: store them in user:// not in res://).
If your track-models can be assembled in a certain grid then it might be helpful to use a gridmap (although my knowledge is limited there).
Thanks for your post, which is encouraging - I expect a bit of a lead in to getting this all to work. I was hoping to avoid building the tracks with a grid, as this is quite common. The pattern I have in mind breaks all the possible track layouts into either straight lines or arcs, but with no restriction on things like angle or radius of curvature.
Those two things are enough to make a 'realistic' track layout. Not sure how I go about doing this, nor dealing with tracks changing elevations (eventually - I'm happy just to draw in a single plane to start with), but I guess that's what I'll need to work out.
Speaking of 3D:
You can generate meshes (those are typically stored in a MeshInstance node) completely in script. Or you can "assemble" your layout from ready made/imported meshes of arbitrary size.
SurfaceTool allows to create surfaces (typically a mesh contains at least one surface for each material). Or to import surfaces from other meshes (if you want to use other meshes as "template").
You will then typically add those surface to a Mesh (ArrayMesh) of a MeshInstance node to display it. You'll also need to create and assign materials to the surfaces if you want the mesh to be shown in any other texture/color than white.
Ok, so I could use SurfaceTool to generate the meshes I need for the tracks procedurally, and then I'd have control over their placement. I shall begin to do some more fundamental learnign of Godot first, but this looks like the way forward!
One simple approach to keep the code relatively simple and easier to maintain and extend, is to to use a grid approach, where your algorithm determines the tiles, and each tile is a separate mesh. You can see the tile approach used in this train game below:
The tile based approach also works in procedural dungeon crawlers such as Diablo III (and previous versions):
It can work for hills having a variety of train tracks with slopes, and curves. This may be more or less fun depending on what you like to do. I've had a lot of fun with more complex algorithms, but simpler sometimes gives you more time to create a wider variety of content.
Toy train tracks are made of a variety of pieces that click together, for possible shapes you can take a look at some of the shapes in toy train tracks.
Now... really complex train tracks for adults that go through mountains, and over bridges are still made of a fixed set of parts that click together. Each part could be created as a 'scene' in Godot where you add and move around two spatial nodes that represent the two ends the track (or more if it's a spliter track), then the code could use the position of those connecting nodes for each of the tracks to procedurally piece them all together.
For this approach you could do the ground as a height map, and a tunnel entry and exit point map. Where the tunnels are just tunnel pieces that click together, and in your vertex shader for your height map, you just don't draw the tunnel entry and exit points, allowing those to be the pre-made meshes.
For simpler mountains, you could completely use the tile based approach, with tile rotation in code so you can re-use, for example, "ground-slope" tile, "ground-flat" tile, and "ground-sloped-angle" tile for all the land, then various texture maps and 3D decals put on them for variety.
Anyways, just some more ideas. Definitely you can make the train simulation in Godot, lot's of ways to get it done.
Hi. I'm actually making a similar game in Godot, sorry for bumping this old thread though, you can use Paths for the railway tracks with the help of Textures.
@sairam134 said:
Hi. I'm actually making a similar game in Godot, sorry for bumping this old thread though, you can use Paths for the railway tracks with the help of Textures.
Cool, any chance of sharing some results? =)
Loading...
Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error.