Jump to content
Eternal Lands Official Forums
Sign in to follow this  
Entropy

Changing the map format

Recommended Posts

Ok, mikeman was right, processing each and every object on the map, sometimes 3 times (normal rendering, shadows, reflections) every frame is TEH SLOW.

I realized that while working at the Barren Moon client, and noticed how fast it was, even with many big trees.

So this is why EL is so slow, because of the whole god damn looking through the objects list.

We need a new map format, that will have the objects in sectors, rather than one list. Each sector should be 4x4 tiles, and should have a limit of maybe 100 3d objects, 50 2d objects, and 10 particle systems.

Anyone feeling like doing it, and then writting a convertor so we can convert the old maps?

Share this post


Link to post
Share on other sites

They can get inspiration from bmc @ berlios.de, however rotations, positions should still be floats. You should also use the e2d/e3d/partlist.txt as seen in bmc to change the filename to an integer ID + add extra reserved ints or floats to the 2d/3d/particle/lights io structures.

Share this post


Link to post
Share on other sites

Well, since you are going to change the map format anyway, I suggest to go all the way and implement a hierarchical space partioning, like quadtrees(I don't think octrees are necessary). This way, you will be "covered" if in the future you'll want to add a real heightmapped terrain, for instance. Whoever does this, take a look at "loose octrees&quadtrees", they're great for handling moving objects, and very easy to implement.

Share this post


Link to post
Share on other sites

If I knew enough proggraming then I would vouleteer to help with this. But don't and seen game problem with not enough proggramers to help out.

Share this post


Link to post
Share on other sites

Sector.c seems to be well enough structured that it could quite easily show me how it can be done... and could we do converting by reversing sector_to_global_y and sector_to_global_x, find pos, writing to the sector to a mapfile...I guess now I have something to play with other than embedding SMALL GUI/Console extendability into the client (which is pretty much done anyway). But still, no guarantees. If anyone else thinks they can do it, do it, you're probably a better programmer than me. :)

 

BTW, the BMC is under the The Eternal Lands Client Public License Version 1.0, right? That makes it a little easier to hack code back and forth.

Edited by crusadingknight

Share this post


Link to post
Share on other sites

Yes, they are under the same license. However, after looking at the BMC code, I realized that we still parse the huge 3d objects array, when we look for rendering objects. We don't only use the info from the near sectors.

Share this post


Link to post
Share on other sites

Well, you shouldn't really rely on the sector.c functions for anything except from interchanging from the objects to the object IO. We had to make some tradeoffs in precision/size to make dynamic maps possible without using too much network traffic.

Furthermore you don't need to calculate the checksum of a sector like we do in bmc. Instead, perhaps you should dig into using quad/octrees (methods that we really don't need in bmc).

 

map_io.c:
int e3dlist_getid(char *name);
int e2dlist_getid(char *name);
char *e3dlist_getname(int id);
char *e2dlist_getname(int id);
int partlist_getid(char *name);
char *partlist_getname(int id);
int e3dlist_get_attributes(char * name);//3D object attributes
void sector_add_map();
void load_map();

#define sector_get(x,y) (((int)y/12)*(tile_map_size_x>>2)+(int)x/12)

 

But yes, BMC is under ELCPL 1.0

Share this post


Link to post
Share on other sites
Yes, they are under the same license. However, after looking at the BMC code, I realized that we still parse the huge 3d objects array, when we look for rendering objects. We don't only use the info from the near sectors.

I have been doing some tests with this. I set up a map with 10k trees, got around 165fps, changed the 3d object rendering to only render the objects in my sector, fps went up to 210+.

In my opinion, getting this to work should be one of the priorities for the next client release.

Share this post


Link to post
Share on other sites

I'd say... possibly, make a public patch release to stop the whining about FPS in gen. chat :\

Share this post


Link to post
Share on other sites

Yes, I noticed the same Sadez. That part of the application goes from being CPU limited to GPU limited.

Share this post


Link to post
Share on other sites

hey um..i dont know how related this is to what you guys are talking about....but we also need to be able to stand above/below someone, on the same tile, if the heights have a difference of X...so like a double height map. So that someone can walk on a bridge, and also walk underneath the bridge.

Share this post


Link to post
Share on other sites
If this is implemented, leeloo can ditch her new computer :(

ROFLMAO

That would be teh funnay!

ROFL ~11&c.

 

Hrm, as per roja's, I was looking at the cubic usage of quadtrees, so possibly that could work, if each sector contained height tiles, say being 2 sectors high (N * N * 2).

 

But then, we have to do double-layer checking... erk.

Edited by crusadingknight

Share this post


Link to post
Share on other sites

I have added sector support to ELC. Remember to add sector.c to your projects/makefiles.

 

Please try it and comment any fps improvement, slowdowns at map loading, problems, etc ;)

Share this post


Link to post
Share on other sites

while the speed seems fine, i have lost the ability to enter buildings or trigger other stuff that needs the door mouse. basicly the mouse dont change when on top of a building or similar any more...

Share this post


Link to post
Share on other sites
while the speed seems fine, i have lost the ability to enter buildings or trigger other stuff that needs the door mouse. basicly the mouse dont change when on top of a building or similar any more...

Should be fixed now.

Share this post


Link to post
Share on other sites

Maybe you should add sector.o to the makefiles, 'cause elc won't compile without them.

 

Oh, and what are the elc.dsp and elc.dsw files doing in the CVS?

Share this post


Link to post
Share on other sites
Maybe you should add sector.o to the makefiles, 'cause elc won't compile without them.
Remember to add sector.c to your projects/makefiles.

 

 

Oh, and what are the elc.dsp and elc.dsw files doing in the CVS?

These are VC project files.

Share this post


Link to post
Share on other sites

in case someone is useing vc maybe?

 

hmm, while i still see a sharp drop near large gatherings (something i guess this cant help with) it seems that the speed have climed slightly...

Share this post


Link to post
Share on other sites

I threw trasengaard at the current CVS...and it flinched. Turns out we need almost 200 3D objects, not just 100. :P

 

Also, we need to restrict the zoom, else we see objects disappearing behind us.

 

 

Also:

	short e2d_local[20];

Doesn't seem to match this code fragment:

for(k=0;k<100;k++){

   int l=sectors[(j*(tile_map_size_x>>2))+i].e2d_local[k];

Edited by crusadingknight

Share this post


Link to post
Share on other sites

2d_objects.c: In function `display_2d_objects':

2d_objects.c:434: warning: implicit declaration of function `get_supersector'

Share this post


Link to post
Share on other sites

2d_objects.c: In function `display_2d_objects':

2d_objects.c:434: warning: implicit declaration of function `get_supersector'

did you put sector.o in OBJS in the makefile?

Edit: oops, yes, you did

Edited by Vegar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×