One Big World Map

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

One Big World Map

Post by dlangdev »

Just wondering what you guys will say about this.

Recently I just got a VPS server with the intention of writing this one cool test program.

Basically, the structure of the map is stored in a database with the following:

1) Object ID
2) MeshFile
3) Position
4) Rotation
5) Size (in megabytes)

When a player spawns in the world, a map is dynamically generated on-the-fly using the database and it then gets sent to the client. The client then receives the map and builds the scene. Note the map is built based on where the actor will be spawned.

When actor moves around the world, its position is sent to the server and the server may or may not send assets back to the client for loading. Loading and unloading of assets is done by means of proximity test, a radius test is used to determine which object is loaded or unloaded.

Does that sound quixotic?

I have code that sends out game resources to a client, and a client program that receives those resources.

Let me know because I'm working on a test program for that.

Thanks.
Image
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

How quick can the server send assets to the client? And why do the assets have to be sent out in realtime? Couldn't you download any new assets not already downloaded to the client when you load up the game and then you won't have to download them when they're actually needed as that's not gonna be particularly quick if your assets are anything sensible.

Obviously you could still get the server to tell the client where to place the objects, though even that's not really necessary is it? Could you not just download the latest map structure when you load the game and use that?

Presumably this system is because you want to have some sort of dynamic world for your users which the server controls?
Image Image Image
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

Post by torleif »

It makes sense to have the data in a db like that

Another thing you could do (if you are willing to take on a challenge) is have each map generated by seed number. The client would generate what objects it needs based on the seed and the players position, and then ask the server for the meshes.
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Q: How quick can the server send assets to the client?

A: Good question, initial tests showed sending one mesh file having a size of ~1Mbyte turned out to be OK. There's no test results yet for downloading meshes with textures in bulk. That will be measured in this test.

Let's say an avatar moves at a certain velocity V1 and then there's this number DT1 representing download time of an object. So, DT1 must be small enough in order for an avatar to see the object with a velocity of V1. That's the formula I'll be using for this one.

When the object is in viewing range, it should be there, fully textured and ready. Otherwise, it will show-up late and cause a pop when it becomes visible.

For testing, I'll use a billboard with a red X mark in the middle to show the location of the object. Once it is ready, the billboard will get replaced with the real object.


Q: And why do the assets have to be sent out in realtime?

A: ActiveX control, basically the game needs to be light as possible having no baggage. Once the game loads, the assets need to be downloaded next.

Q: Couldn't you download any new assets not already downloaded to the client when you load up the game and then you won't have to download them when they're actually needed as that's not gonna be particularly quick if your assets are anything sensible.

A: There's no algorithm for that at the moment, but that will be coded later when a client cache is implemented.

Q: Obviously you could still get the server to tell the client where to place the objects, though even that's not really necessary is it?

A: I got to chat with someone and he said some cool ideas about that. I could set it up in such a way it would look like a dynamic HTML document, driven by a webservice. I know this stuff coz this is what I do in my day job. What's new here is dealing with game assets and designing a document model above it.

In the database, some objects will be static in terms of location, houses and buildings will have static location. On the other hand, objects that move will have dynamic location, and that will get reflected to the clients connected to this DB.

A user table is one of those game assets that will populate the gameworld. Though that's not the only table driving the gameworld table, there's going to be other tables as well, it's just undefined at the moment.

Q: Could you not just download the latest map structure when you load the game and use that?

A: For static objects, I think that's the way to go. There's no algorithm at the moment that will take care of that so right now, there's only this DB table describing one big world, with infinite size. The problem right now is how to slice-n-dice this huge gameworld when a user spawns into this world. It's obvious the entire gamewold won't get downloaded to the client, it's just too big. So it needs to be chunked into pieces and then packaged and sent to the client.

Chunking meaning a map is generated based on proximity test.

Or I could cube it into tiles and send those tiles to the client.
Last edited by dlangdev on Wed Aug 13, 2008 6:13 pm, edited 7 times in total.
Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

"Another thing you could do (if you are willing to take on a challenge) is have each map generated by seed number. The client would generate what objects it needs based on the seed and the players position, and then ask the server for the meshes."

That sounds like an gameworld editor, similar to half-life.

Not sure if that can be added in this test, though. I'll take note of it.
Image
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

So currently you want to download assets when they become visible in the world but in the future you're going to do a bulk download before the game begins..? That seems a bit silly, shouldn't just go for the simpler, latter approach which you're aiming for anyway straight away and save yourself time and effort?

I really don't see the point in downloading on the fly, it's really gonna be a drag on your performance. the game isn't going to be any lighter doing it this way as you'll still have to download all the stuff over time...
Image Image Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

I understand your point. I will definitely keep a note of it and take that as an advice. Though I really have to do this test in order to collect data.

I got the database schema up and running and will try to finish the webservice code around it this week.

With that i can make a webservice that places an object in space having the objectID, position, rotation, scale, size as parameter. And it will get inserted into the table.

This is going to be cool.
Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Q: I really don't see the point in downloading on the fly, it's really gonna be a drag on your performance.

A: Web browsers have it in such a way rendering and loading of resources are handled gracefully. It would be nice to write code that mimicks that effect, though.
Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Q: the game isn't going to be any lighter doing it this way as you'll still have to download all the stuff over time

A: I understand that and it actually is happening in my current implementation. There's no code for the new feature yet, though it would be nice to have a manager or controller that can handle this stuff. I would imagine a thread may be needed for maintaining local cache, making sure the gameworld is supplied with enough materials to keep the avatar busy.

Plus, I read somewhere LOD can help here. What do I mean by that? For example, at a certain distance, a model will have an LOD value of say 16 that's the lowest LOD and that gets loaded right away. The Cache manager keeps going downloading all the mesh LOD levels while the lowest LOD is engaged. Once the avatar gets closer at a certain distance, LOD is then evaluated and perhaps a new model with a certain LOD is loaded instead.

There's a good example of LOD in IrrLicht, see the TreeGenerator project. It has code in there that figures out distance and then renders a LOD model based on distance.

See: http://www.ai-aardvark.com/modeling/LOD ... a_LOD.html
Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Q: So currently you want to download assets when they become visible in the world but in the future you're going to do a bulk download before the game begins..?

A: Why not? all that is new there is simply moving the work of setting-up the assets at a different stage.

It's a different experience, that's going to be obvious for the user. They'll see that right away and perhaps they will react favorably to it.
Image
Post Reply