It's been very quiet in the forum lately. Things are not much different with technopolies, i dont recall a noticeable thing that was done in the last two months
To give a push, i'd like to share some ideas and code from technopolies (as long as Helge doesnt mind me blogging here
1. Terrain generator.
The common concept for landscapes in technopolies was in
- making it easy to edit (drawing landscape map in photoshop with a couple of brush strokes)
- making it lightweight enough to be transfered via network (~4kb for a 1000 x 1000 meters level)
- make it possible to be divided into regions (to define footstep sounds for different tiles, add effects like sand smokes and animated grass )
- load / render only visible parts of a bigger level
1. Tiles. It seems natural to split big level into smaller rectangular tiles. A 1000x1000m level could be interpreted as a Object3D consisting of 100x100 tiles (10x10 each). The code generates an object consisting of 100x100 rectangles
@todo
2. Relief. The main idea is to adjust tiles' heights according to some "heights map". The "heights map" is a grayscale image, where color corresponds to some height value, e.g. white = 50m height, black = 0m. For a 1000x1000 level consisting of 100x100 tiles the grayscale image should be 100x100 - each pixel corresponds to 1 of 4 single tile vertex.
@todo
3. Textures. The idea is that there could be several terrain types on a single level - like sand, grass, dirt, rocks, roads. Assigning a single huge texture to a whole level might pass for small levels but is not applicable for big ones - due to low detalization and huge texture size.
The solution is to use a "texture map" image that defines texture per each tile.
Let's bind some colors to specific textures, let's say green corresponds to "grass.jpg", yellow - "sand.jpg", brown - "dirt.jpg", etc. Then, paint a 100x100 image in photoshop using green, yellow and brown brushes. For a 100x100 tiles level, assume that 1 tile corresponds to 1 pixel of the "texture map". Pixel's color will define what texture file should be used for this tile
@todo
While textures look detailed, transitions between tiles of different types are still rough. Let's smooth transitions from one tile type to another (jpct107a or newer is required). Let's take several basic texture types and generate "gradient textures" for each combination on tiles.
First, create RGBImageFilter that generates Image from 2 different tile types (let's say something different between dirt and grass) depending on % of each tile (say, 10%dirt 90%grass or 70% dirt 30% grass).
Generate several gradient textures for each combination of tiles.
@todo
Then add some method that will pick closest texture depending on the requested color.
@todo
In photoshop, apply Gaussian Blur to the texture map to smooth transitions between different tiles. Looks much better now.