English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 07 January 2019, 10:54   #1
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
3D games - drawing the landscape

I'm trying to write a 3D game (which I've talked about here before, http://eab.abime.net/showthread.php?t=93740&page=7) - I thought I'd start a new thread as I have more general questions not so related to the topics in that thread)

Does anyone have any bright ideas on how to create the landscape for a 3D game? I'm starting to lean more towards an F/A-18 Interceptor semi-realistic style thing rather than a StarGlider 2 sci-fi style thing. I'm at the point where I'd like to draw the ground / land / sea / major roads below, but I've found myself going round in circles a bit trying to decide how to start.

I think I want some sort of tile / layer system. Something very low poly for when I'm up high and something just low poly for when I'm near the ground, and with zoom levels that work out so that I only ever draw a handful of tiles. On top of that I think I might want separate layers for more details, built up areas as grey polygons, forests as dark green, etc., and major motorways in their own layer. I don't think I want any height data - flat will do.

I'd like something based on reality, so I've been looking at how to generate OSM vector tiles, but I haven't got very far yet. Has anyone ever looked at that? Would it even be possible to generate low enough poly count tiles to use in an old school game? Or is this some kind of pipe dream? Is there a better way? Maybe a bit of software specifically for doing this kind of thing, that can work at an old school low poly count and output in a format that I can write a converter for? I really don't want to do it by hand with graph paper.

Any ideas or suggestions, anything that could help brain storm, would be welcome.
deimos is offline  
Old 08 January 2019, 10:36   #2
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
You can use single pixel dots to reduce the amount of drawing you need to do while also conveying more sense of motion. For example a "field" with a grid of dots doesn't need a full fill pass, and the dots move with the view port so the player sees more motion.

Many flight simulators did use tiles. Very useful for managing things like airbases.
zero is offline  
Old 08 January 2019, 13:42   #3
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
I want a realistic result (for 1985 technology), so I'm looking at stuff like this:

https://github.com/systemed/tilemaker

Followed by something like this:

https://github.com/rastapasta/tileshrink

Followed by something I'd write myself to do further processing.

At the moment I don't know if this is even a realistic approach.
deimos is offline  
Old 09 January 2019, 11:05   #4
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
If you look at various games for the A500, things like Wings and Gunship 2000, you can see the level of detail possible. F/A-18 Interceptor was probably one of the fastest 3D engines of that era, or No Second Prize.

What is your goal here? Impressive graphics or something more practical, like being able to navigate or recognize the real world in the game? And what is your target for frame rate etc?
zero is offline  
Old 09 January 2019, 12:39   #5
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by zero View Post
If you look at various games for the A500, things like Wings and Gunship 2000, you can see the level of detail possible. F/A-18 Interceptor was probably one of the fastest 3D engines of that era, or No Second Prize.

What is your goal here? Impressive graphics or something more practical, like being able to navigate or recognize the real world in the game? And what is your target for frame rate etc?
My goal would be to display as much scenery detail as possible within the frame rate that the player finds acceptable, covering an area of, say, 500 km radius centred around London, so that's most of the UK and a good chunk of northern France.

I'd hope to use the combination of zoom levels and enabling / disabling of tile layers to manage the amount of detail shown appropriately. As an example I might have four zoom levels giving 4x4, 8x8 16x16 and 32x32 tiles, with all zoom levels including land / sea polygons, 8x8 and higher adding extra polygons to colour forests and cities, 16x16 might add major motorways like the M1, M25, etc., and 32x32 might add enough extra roads so that I can add the bridges over the Thames and any buildings that would be recognisable as polygons.

To me, this all sounds achievable, assuming the right level of detail is chosen for each zoom level, but I don't want to create the data by hand, particularly as I can only make educated guesses around what a good level of detail will be.

So I'd rather start with existing data, strip out everything I don't want to show and simplify the polygons as much as possible. The data is out there (https://download.geofabrik.de), but it's impractically big.
deimos is offline  
Old 15 January 2019, 11:55   #6
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Cities are always difficult to display with any realism because in reality they are densely packed complex buildings. London in particular was not built on a grid system and is highly irregular.

On the other hand if you are happy to represent the city with just a few major roads, rivers and a large grey area then yeah, you could do it.

Main thing is to figure out what area tiles are going to cover. If each tile is 1km square you would need 250,000 of them for the area you want. That would give you a 30m resolution at 32x32 which might be a bit high. You can reduce the number of tiles by having different tile sizes in different areas. No need to have 30m resolution over mostly featureless countryside.

I'd think about using procedural generation for some areas. Map out major features and then fill in the gaps with generic countryside/city tiles, with some irregular shapes generated using the lat/long coordinates.
zero is offline  
Old 15 January 2019, 20:05   #7
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by zero View Post
Cities are always difficult to display with any realism because in reality they are densely packed complex buildings. London in particular was not built on a grid system and is highly irregular.

On the other hand if you are happy to represent the city with just a few major roads, rivers and a large grey area then yeah, you could do it.

Main thing is to figure out what area tiles are going to cover. If each tile is 1km square you would need 250,000 of them for the area you want. That would give you a 30m resolution at 32x32 which might be a bit high. You can reduce the number of tiles by having different tile sizes in different areas. No need to have 30m resolution over mostly featureless countryside.

I'd think about using procedural generation for some areas. Map out major features and then fill in the gaps with generic countryside/city tiles, with some irregular shapes generated using the lat/long coordinates.
I'll be representing cities as a few major roads, rivers and a large grey area as you say, but with a handful of buildings as well. It will never be possible to make London look realistic to a local, but if I throw in some of the buildings that a tourist would recognise, then I reckon I might have a winner.

Building on what you're saying about tile areas, if I want to build a map of around 1000km x 1000km, then once tiled into 32 x 32 = 1024 tiles, each tile would cover 32km x 32km. If I need to keep the coordinates in those tiles within a 16 bit word, then I get a resolution of around half a metre. I think.

Your idea of procedural generation is an interesting one. The idea of filling in the gaps and creating more detail than has to be stored on disk is obviously appealing.

In other news, I've spent the last few days trying to get OSM data into my machine so that I can extra the bits I want to put into my tiles. I've come to the conclusion that this isn't going to happen - the data is just too big.

But, today I stumbled across mapshaper, which looks like it can do the manipulation of map data that I need, and can work with shapefiles, which I've also found at Natural Earth. It's not perfect - it needs work, roads, for instance, are just lines, and include ferry routes. I don't think it's as flexible as generating from OSM data, but it's more achievable.

Edit:

This morning I found this mapshaper tutorial: https://simplemaps.com/resources/guide-to-mapshaper I think this pretty much covers the first half of what I need to do.

Last edited by deimos; 16 January 2019 at 10:20.
deimos is offline  
Old 16 January 2019, 11:00   #8
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Ah, right, I misunderstood what you meant by 32x32 tiles. That does sound like quite a practical system.

I wonder if you could add some terrain height data? Low resolution of course. If you are going to be rendering the ground as polygons anyway for things like cities there isn't a huge benefit to making it all flat. Even if it's only 4 points at the corners of the tile.

Actually that's another interesting question. Square or triangular tiles? Or even arbitrary numbers of edges. With software rendering using spans more edges can be more efficient.
zero is offline  
Old 16 January 2019, 14:53   #9
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by zero View Post
Ah, right, I misunderstood what you meant by 32x32 tiles. That does sound like quite a practical system.

I wonder if you could add some terrain height data? Low resolution of course. If you are going to be rendering the ground as polygons anyway for things like cities there isn't a huge benefit to making it all flat. Even if it's only 4 points at the corners of the tile.

Actually that's another interesting question. Square or triangular tiles? Or even arbitrary numbers of edges. With software rendering using spans more edges can be more efficient.
Terrain height and non-square tiles are probably too hard at the moment, mostly because I want to get through this phase of the project quickly using things I can find around the house and script together. Terrain height to create a more Zarch / Virus style game but with a flight simulator angle would be interesting though. Maybe next time.

I've attached some images of the export of my first real attempt with MapShaper and the data I have. I'm not sure whether the data I've found to use so far is going to be good enough without massaging it after the export, but I think the approach shows promise.

I've added the colours in InkScape. I have no data for forest / woodland areas, only urban areas, which is a pity.

I've not applied any simplification in MapShaper yet. I have to see what I can do to decrease the vertex count while keeping all the layers lining up nicely.

Last edited by deimos; 21 November 2021 at 12:01.
deimos is offline  
Old 16 January 2019, 17:05   #10
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Things fall apart when I try to simplify the polygons in mapshaper - it seems to be limited to simplifying layers individually, so areas on different layers generally won't line up after simplification. I need something smarter.

Last edited by deimos; 21 November 2021 at 12:01.
deimos is offline  
Old 16 January 2019, 19:25   #11
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,519
You might need to resort to some GIS software or program to create 3d models for games i feel
saimon69 is offline  
Old 16 January 2019, 19:39   #12
Gorf
Registered User
 
Gorf's Avatar
 
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,294
How about using voxels?

nice and very simple algorithm:

https://github.com/s-macke/VoxelSpace
Gorf is offline  
Old 16 January 2019, 19:52   #13
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by Gorf View Post
How about using voxels?

nice and very simple algorithm:

https://github.com/s-macke/VoxelSpace

That is neat. But it's not general enough for me.
deimos is offline  
Old 16 January 2019, 19:54   #14
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by saimon69 View Post
You might need to resort to some GIS software or program to create 3d models for games i feel

But which? And how?
deimos is offline  
Old 17 January 2019, 09:27   #15
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by zero View Post
I wonder if you could add some terrain height data? Low resolution of course. If you are going to be rendering the ground as polygons anyway for things like cities there isn't a huge benefit to making it all flat. Even if it's only 4 points at the corners of the tile.
It's actually a big benefit having it all flat, because you don't have to worry about features of the landscape hiding others during rendering.
hooverphonique is offline  
Old 17 January 2019, 12:01   #16
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Quote:
Originally Posted by Gorf View Post
How about using voxels?

nice and very simple algorithm:

https://github.com/s-macke/VoxelSpace
That reminds me of a fast variation used in Sanity's Roots demo (or might have been Roots 2.0). Rather than do the entire landscape from voxels they did grid lines only. Obviously there was a lot less detail but it was super fast, only requiring a single colour vertical fill and some dot drawing.
zero is offline  
Old 17 January 2019, 12:20   #17
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Quote:
Originally Posted by deimos View Post
But which? And how?
How about starting with bitmaps?

Using MapTiler I was able to make a bitmap with detail reduced and some colour reduction. You have to turn off all the layers you don't want, and make the ones you do want have opacity 1.

Maperitive looks like it can do it too. Some example styles here: https://openmaptiles.org/styles/

I don't know if you can export a vector, but I exported a bitmap and loaded it into Inkscape. I used Path->Trace Bitmap to convert it to paths which with a bit of fiddling you should be able to use directly.

zero is offline  
Old 17 January 2019, 15:42   #18
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by zero View Post
How about starting with bitmaps?

Using MapTiler I was able to make a bitmap with detail reduced and some colour reduction. You have to turn off all the layers you don't want, and make the ones you do want have opacity 1.

Maperitive looks like it can do it too. Some example styles here: https://openmaptiles.org/styles/

I don't know if you can export a vector, but I exported a bitmap and loaded it into Inkscape. I used Path->Trace Bitmap to convert it to paths which with a bit of fiddling you should be able to use directly.
I've been trying to import the OSM data locally so that I can run my own tileserver here and use mapnik or other tools to generate the vector maps, but that import has been running for three days so far.

MapTiler looks to be a tileserver with OSM data and extra bits. Looking at the developer pane in Chrome it looks like it's using protocol buffer tiles, just like OSM. Maybe I can get the vectors out of them and skip the conversion... I'll spend some time with it.

One issue with tracing bitmaps is that I need a good fit with straight lines only, no splines, and the lowest number of vertices possible. I'm not sure if potrace / InkScape can do that for me.

I looked into Maperitive, but it seems to be only suitable for small data sets, not for country sized maps.

MapShaper has some advanced options I need to explore further as well. It was doing so well with the Natural Eath Data files I fed it, if I can get it to operate on multiple layers or to merge layers it might work.
deimos is offline  
Old 18 January 2019, 11:02   #19
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Inkscape can do detail reduction and spline to line conversion. The other advantage is that you can easily manually edit it to correct any small flaws.
zero is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Optimised support for non-landscape monitor orientations mark_k support.WinUAE 4 10 May 2018 20:10
[Found: Fractal Mountains] landscape generation honx Looking for a game name ? 5 22 September 2017 16:21
landscape generator twizzle MarketPlace 0 04 May 2006 22:47
Landscape generator DDNI request.Apps 30 04 May 2006 18:18
REQ : Vistapro (Landscape Renderer) Djay request.Apps 22 01 May 2002 22:47

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:51.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09166 seconds with 15 queries