Ideas about map and track laying
Posted: 02 Oct 2004 03:26
The first thing that is said in the design doc is that this game is going to be 3D. However, from what I see, the rest of the concept is still tile-based. Since it works in 3D, the map doesn't really need to be grid-based. both horisontally and vertically. We could use new ways (comparing to TTD and Loco) of laying tracks and road. Let me explain:
The map is probably the biggest object to store and render. Rendering nowadays is "simple" if the scene is setup properly in the graphic card and if the polygon count is low enough. But how to keep a reasonable polygon count for the map and still have the zooming feature? My suggestion is to use Bezier Maps. Please check this little demo (not mine) : http://www.cse.ogi.edu/~andy/applets/bezier.htm
With Bezier maps, you only need to store the skeleton in memory. When rendering, polygons need to be computed before the actual image render is made but only for the current viewport . But you need to do that only when the viewport (point-of-view) changes. As demonstrated in the applet, it is easy to vary the subdivisions as we like. When zoomed closely, we can increase the number of divisions for more detail. When zoomed far away, we can reduce the number of divisions to keep an acceptable number of polygons. Anyway, when away, you don't need as much detail.
The next question is: what about landscaping made by the user? For that I will borrow another idea from 3D packages such as Softimage, which is deformations (see http://www.softimage.com/community/exp/ ... mation.pdf) for an example of what I mean, its the part where they explain how to draw the roots of the plant). These objects don't add anything to the scene. They just modify existing objects. So with these operators, you can lower or raise the existing polygons. Normally, players will lower or raise the land to make room for tracks, roads, stations or airports. When one object of this type is put on the map, we can simply apply a transformation operator with it to level the terrain automatically, without having to prepare the terrain beforehand. You'll see how this blands well with the next topic, track laying.
For track laying (or road laying), I'd like to propose we use bezier curves and B-Splines. Please see examples of this here: http://www.idi.ntnu.no/~mlh/codebase/grafisk2/
A bezier curve is defined with 4 points (or actually 2 pairs). The starting pair define the starting point and the tangent at the start point. The end pair does the same thing at the end. By joining multiple segments like this and keeping the tangents locked between the segements, you can define a path (a B-Spline). This is very far in my head so I don't remember the details. But I know it can be done.
Using this the player can simply click and draw a series of segments and the curvature of the track would be automatically adjusted (of course the handles to adjust the curvature would need to be available so the player can increase/decrease the radius). For slopes, I suggest having a system like locomotion where you have a button to force flat building and buttons to force a slope (could be a slider as well). For exemple, if the player is building in "flat" mode, we apply proper deformation operators to the map surface to dig or raise the land so the track says level. Same for slopes. However, at a certain height or depth, the track need to become either a bridge or a tunnel. At the end, just click a big "build this" button to actually put the track down. This way the player can build and review his track before spending the money.
If we think about algorithms and structures for this, it is easy to imagine that each segment point is a "node" in a big network. Having such a network redily available is very usefull for pathfinding using Djikstra shortest path algorithm.
This overall system has the following features:
- Relatively low memory footprint for the map
- Infinite zoom level with appropriate performance adjustment
- You can lay long stretches of track with 2 clicks (like in TTD)
- You can lay curves of *any*curvature in 2 to 4 clicks
- You can have undeground tracks or high bridges (like in Loco)
- Tracks can be in *any* direction, not only the 8 standard ones.
- Can apply to roads as well
- UI model matches conceptual model (segments linking nodes together)
- Track/road information takes less space than in a tile-based model (each tile need to keep the info).
- Takes advantage of the 3D world, not only for display.
Drawbacks:
- Generating the polygons might take time (need prototyping)
- Bezier based method is probably new to many players.
- ???
Ouf... Ok this was long and I threw lots of things at you so I'll stop here. Sorry if it is not clear, I'm not sure how to explain it. I'll try to find time cook some screenshots to illustrate this during the weekend. Don't hesitate to shoot these ideas to pieces
The map is probably the biggest object to store and render. Rendering nowadays is "simple" if the scene is setup properly in the graphic card and if the polygon count is low enough. But how to keep a reasonable polygon count for the map and still have the zooming feature? My suggestion is to use Bezier Maps. Please check this little demo (not mine) : http://www.cse.ogi.edu/~andy/applets/bezier.htm
With Bezier maps, you only need to store the skeleton in memory. When rendering, polygons need to be computed before the actual image render is made but only for the current viewport . But you need to do that only when the viewport (point-of-view) changes. As demonstrated in the applet, it is easy to vary the subdivisions as we like. When zoomed closely, we can increase the number of divisions for more detail. When zoomed far away, we can reduce the number of divisions to keep an acceptable number of polygons. Anyway, when away, you don't need as much detail.
The next question is: what about landscaping made by the user? For that I will borrow another idea from 3D packages such as Softimage, which is deformations (see http://www.softimage.com/community/exp/ ... mation.pdf) for an example of what I mean, its the part where they explain how to draw the roots of the plant). These objects don't add anything to the scene. They just modify existing objects. So with these operators, you can lower or raise the existing polygons. Normally, players will lower or raise the land to make room for tracks, roads, stations or airports. When one object of this type is put on the map, we can simply apply a transformation operator with it to level the terrain automatically, without having to prepare the terrain beforehand. You'll see how this blands well with the next topic, track laying.
For track laying (or road laying), I'd like to propose we use bezier curves and B-Splines. Please see examples of this here: http://www.idi.ntnu.no/~mlh/codebase/grafisk2/
A bezier curve is defined with 4 points (or actually 2 pairs). The starting pair define the starting point and the tangent at the start point. The end pair does the same thing at the end. By joining multiple segments like this and keeping the tangents locked between the segements, you can define a path (a B-Spline). This is very far in my head so I don't remember the details. But I know it can be done.
Using this the player can simply click and draw a series of segments and the curvature of the track would be automatically adjusted (of course the handles to adjust the curvature would need to be available so the player can increase/decrease the radius). For slopes, I suggest having a system like locomotion where you have a button to force flat building and buttons to force a slope (could be a slider as well). For exemple, if the player is building in "flat" mode, we apply proper deformation operators to the map surface to dig or raise the land so the track says level. Same for slopes. However, at a certain height or depth, the track need to become either a bridge or a tunnel. At the end, just click a big "build this" button to actually put the track down. This way the player can build and review his track before spending the money.
If we think about algorithms and structures for this, it is easy to imagine that each segment point is a "node" in a big network. Having such a network redily available is very usefull for pathfinding using Djikstra shortest path algorithm.
This overall system has the following features:
- Relatively low memory footprint for the map
- Infinite zoom level with appropriate performance adjustment
- You can lay long stretches of track with 2 clicks (like in TTD)
- You can lay curves of *any*curvature in 2 to 4 clicks
- You can have undeground tracks or high bridges (like in Loco)
- Tracks can be in *any* direction, not only the 8 standard ones.
- Can apply to roads as well
- UI model matches conceptual model (segments linking nodes together)
- Track/road information takes less space than in a tile-based model (each tile need to keep the info).
- Takes advantage of the 3D world, not only for display.
Drawbacks:
- Generating the polygons might take time (need prototyping)
- Bezier based method is probably new to many players.
- ???
Ouf... Ok this was long and I threw lots of things at you so I'll stop here. Sorry if it is not clear, I'm not sure how to explain it. I'll try to find time cook some screenshots to illustrate this during the weekend. Don't hesitate to shoot these ideas to pieces