World streaming and data

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
Post Reply
ezikialbasix
Posts: 2
Joined: Sat Jul 25, 2015 3:51 pm

World streaming and data

Post by ezikialbasix » Sat Jul 25, 2015 3:58 pm

Hi folks. I recently got into the df unity tools thing.

I'm a long time hobbiest in unity.

I was pondering imitating how dagger fall pages its terrain in a simple tech project I'm working on for fun.

My question is, how exactly does the world streaming work. I'm gotten a world generated from a atlas image, each pixel being a terrain in unity, and a color being a type of terrain ( desert, tundra, etc ).

For unique locations at x,y, would I just have unique location blocks at those pixels and load a prebuilt terrain with objects at that location? Kinda giving the illusion of running into a town?

In my head this works, but I wanted to ask people would have been working with this procedural world :)

User avatar
Interkarma
Posts: 5478
Joined: Sun Mar 22, 2015 1:51 am

Re: World streaming and data

Post by Interkarma » Sat Jul 25, 2015 11:27 pm

G'day Ezikialbasix, welcome to the forums! :)

My understanding here is you are creating a Daggerfall-like tech project and would like more information on how the streaming world works in Daggerfall Tools for Unity? If I misunderstood something, just let me know.

Here's a high-level summary of how I do this in DFTFU.
  • Terrains are placed based on initial player position in world (from world data as you describe).
  • All the terrains stay in a pool. As the player moves, old terrains are recycled in front of player with new TerrainData. This saves a lot of time and memory as there is a fixed pool size.
  • The location references (or "seeds" if you like) are in a dictionary keyed by map pixel X,Y (e.g. key = (y << 16) + x). If a location exists at that X,Y it will be placed when a terrain is created/recycled. Old locations are destroyed when terrain goes back into pool.
  • For very large environments, you will need a floating origin script of some kind. This shifts the entire world back towards 0,0,0 to avoid precision problems after a few kilometres.
The locations themselves could just be blocks of prefabs assembled randomly. Daggerfall uses a system based on the classic geomorphs concept. Search around for city and dungeon geomorphs online and you'll see how easy it is to build tiling, reusable locations like Daggerfall.

I hope that is of some help. All the best!

ezikialbasix
Posts: 2
Joined: Sat Jul 25, 2015 3:51 pm

Re: World streaming and data

Post by ezikialbasix » Sun Jul 26, 2015 12:53 am

Hi Interkarma,

Thanks for the welcome and taking the time for the reply. :) You hit the nail on the head.

I'm an huge fan of the elder scrolls series, and when I saw your project a part me of me squealed on the inside. All the possibilities :) I may be interested on contributing to your code. I just wanted to play around with your concepts a bit!

Post Reply