Terrain Prototype

Archived discussions related to Transport Empire. Read-only access only.

Moderator: Transport Empire Moderators

User avatar
Paranoid Android
Tycoon
Tycoon
Posts: 2002
Joined: 15 Jun 2002 12:27
Location: lo:kay:shun - The site and/or situation of a settlement
Contact:

Post by Paranoid Android »

This is really good, uzurpator.

I'm sure we can get round the lack of perfectly flat land. Such as, if you build a piece of track it will automatically level the tile it's on to the right level.
r is a c***


will frequently check credit at (moral) bank (hole in wall)
RIP THE BETA BAND 1997-2004
Transport Empire's music-er.


So now I've closed my eyes, closing seconds of our time

My music
Shrimp
Engineer
Engineer
Posts: 22
Joined: 02 Oct 2004 01:14
Location: Montreal, Canada

Post by Shrimp »

Wow, that's really good Usurpator. I really like this. I haven't played with it (still too much work, that's why I was away for the last months) but does it have variable zoom that would increase/decrease the polygon count accordingly? And generate only the portion of the map you need for the point of view?

I'm asking because if this is fast enough, the map doesn't need to be actually stored as tiled information, thus saving LOTS of memory. Of course the polygons take space in the videocard memory, but the program can access directly the height information from the function you use to generate the map so the main memory isn't bogged down with that (also meaning that map size is not limited by memory). But of course, it depends on the speed of generation (the usual tradeoff).

Am I making any sense?
User avatar
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

Well - For now I can display any patch from a map up to 3500*3500 tiles. But I'm using a very wasteful storing method (each tile has 4 vertices stored as float value - thus 24 bytes per tile for geometry alone) - thus lots of memory can be reclaimed.

If we dropped the requirement for cliffs then I could reduce the amout of memory by about 75%. If I stored the vertives as (short int) I could reduce the memory requirement 12 times. From 25 MB to 2.1 MB form 1024*1024 patch.

ATM the proto displays and makes patch of 100*100 tiles. But for example 2000*2000 map with 50*50 display works perfectly well.

It is really slow for now. But I'm planning to use vertex/color/normal buffer which shuld increase performance about 3-5 times. The polycount is actually neglibly small - most of the time is wasted on calculating normals and moving data to all 4 adjectent vertices (one more point for dropping cliffs).

Flyby/Zoom proto is planned once I get my life a bit straightened out.
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
User avatar
jfs
Tycoon
Tycoon
Posts: 1760
Joined: 08 Jan 2003 23:09
Location: Denmark

Post by jfs »

Hmm I don't know if this is just a bad idea or if it'll actually work.
But I just though of storing a height-map in a fashion similar to the I/P/B frame scheme used in many moders video codecs. It should allow for storing much larger heightmaps.
First of all (not directly related), there shouldn't be any need for using floats for heights, even with just a 16 bit unsigned int, there would be 65536 different height levels, which should be plenty. Now, using my scheme, it might be possible to raise that to a 32 bit int without using too much memory.

Basically, it's a kind of difference-coding. The full height-value is only stored for some points, while most of the points store only the difference between itself and its neighbors.
The most effective coding might result if only one reference-point (one of the corners, or the center) was stored for the entire map, but that would be horribly ineffecient. So instead there is a "reference-grid". There is one point on the reference-grid for each 8 or 16 points on the real grid. (This is just along one axis, of course.) The height of an R-point is stored as a 32 bit unsigned integers.

Now, while writing this, I realise it probably won't work when the landscape is modified, but I'll attempt to continue anyway :P
The data in between R-points are byte-packed, meaning a D-point (delta-point) will take up 1, 2 or 4 bytes. How much is decided by a kind of prefix-code of the highest bits. (This requires the data to be stored as big-endian. Damn you Intel ;))
A D-point always uses single-directional prediction towards the R-point, because if the datastructure was corrupted, a bi-directional coding could possibly result in infinite loops or other nasty things. I'm not sure if anything could be gained from introducing a BD-point type (bi-directional delta), but I doubt it.
Now, to the problem: When the landscape is reshaped, some of the values might flow outside the possible range of their coding-size, and data would have to be moved around. That could result in massive moves of memory or reallocations. Bad.
Also, the data would have to be transformed into full uncompressed heightmaps before any work could be done on them anyway. It might not be much of a gain then.

Now, IFF there was no possibility of ridges AND the max slope was limited, a similar system, but with fixed D-point byte-lengths could be possible.

Comments? How many other faults did I miss? :)
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Don't store the heightmap in floats, that isn't a good idea I think. While the fpu are working better and better you need additonal time to put stuff in it and out it...


Well, I fast read your idea, some point I see:

Let's say you want to calculated the height of a train to ground, say it's currently on slope and you need to know how much the code needs to reduce speed.
Normal way:
find the square of it, get the height, compare the difference = result

Compressed:
Find the square, get the compressed height, get the reference / grid height, calculate it, compare with the height of the train = result.

Well, and it really depends how you will do tunnels after all. The tunnel could be under the max. And how tiles will work after all...
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

if you ask me,
widths can be integers, but height can be byte, 8bits is enough for that
however that applies is we stay with tile system

(sorry for posting something that was already but I just started to following this section, I'm thinking the project's going to be interesting and worth doing)
what are you looking at? it's a signature!
Monti
Engineer
Engineer
Posts: 26
Joined: 06 Feb 2005 12:49
Location: Dresden

Post by Monti »

Hello,

I think we need the following things to evaluate it as a base framework for the final game:
- we need a fast demo with 1000x1000
- adding a zoom function (should be easy)
- adding different textures
- animation (eg. water, woods and so on)

monti
User avatar
PJayTycy
Route Supervisor
Route Supervisor
Posts: 429
Joined: 09 Mar 2004 20:30

Post by PJayTycy »

SHADOW-XIII wrote:height can be byte, 8bits is enough for that
I don't agree. 256 heights is not enough. If we use 1 train height = +/- 10 landscape heights, 256 height levels would compare with 25 height levels in TTD.

16 bits would be more than enough anyway.
Jpl
Engineer
Engineer
Posts: 18
Joined: 24 Aug 2003 00:32
Location: Finland

Post by Jpl »

The demo runs slowly on my Pentium II 350 MHz box with voodoo3 2000 graphics card. I'm trying to do some optimizations to the code and I'll post a message if I can get it faster.
User avatar
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

...
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
User avatar
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

...
Attachments
texture.jpg
texture.jpg (427.99 KiB) Viewed 5783 times
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
User avatar
PJayTycy
Route Supervisor
Route Supervisor
Posts: 429
Joined: 09 Mar 2004 20:30

Post by PJayTycy »

The screenshot looks nice.

Can we see the code ?
User avatar
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

Not yet. I'm working on adding mouse support and some variety to the generated terrain (Deserts and alike).

Then I want to add basic GUI and land modification tools.]

Where is Hellfire?
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
User avatar
PJayTycy
Route Supervisor
Route Supervisor
Posts: 429
Joined: 09 Mar 2004 20:30

Post by PJayTycy »

uzurpator wrote:Where is Hellfire?

Aren't you both working on the design document ?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Post by Zuu »

Hellfire said something some time ago aout that he had things to do. I think it was with the orchestra. I have seen him on MSN a few times, but I havn't talked with him. But if not eaven Uz have heard from him, I can ask him next time I see him.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

PJayTycy wrote: Aren't you both working on the design document ?
We were - But I haven't heard from him for quite some time now (over a month or so) - and I'm not doing the job myself - as much I'd love to, I cannot let my personal opinions shape the DD.
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
Locked

Return to “Transport Empire Development Archive”

Who is online

Users browsing this forum: No registered users and 8 guests