• Advertisement
Sign in to follow this  
  • entries
    109
  • comments
    378
  • views
    128029

Shadows dancing

Sign in to follow this  

130 views

Yeah, the title is a rip off from Babylon 5. I got my Babylon 5 DVDs 2 days ago, and I am still very happy about it.
But anyway, today I worked my ass off at making the latest version of Barren Moon to work on my computer. There were a few peoblems with the objects not being properly syncronized between the server and the client. After I fixed the bug (took me about 1 hour to debug the client and see where was the problem, as it wasn't my code), I wanted to commit the fix in the CVS only to realize that I already DOWNLOADED a fixed version from the CVS.
Basically, I have two directories for each project: the CVS directory and the working directory. Each time I do a CVS update, I copy all the files from the CVS dir to the work dir. but today I forgot to do that, so I was working with some old code. Oh well, at least now I understand Sadez's code and how exactly the objects syncronization is being accomplished.
Then I realized that there was a bug in the map editor. When it saved a map, it saved it wrong. When loading the map again, some of the 3d obejcts were replaced with other 3d objects. After a quick look at the code, and doing some tests I pinpointed the problem: a function that was supposed to return an ID was returning an index. Normally, the index and the ID were supposed to be the same, but in some cases, such as removing/adding items in the middle of the definition file caused the ID and the index to be different. That was an easy fix.
Then there were some problems with the map editor not compiling because of an undefined variable from the client (the map editor and client share some files). So I had to use #ifndef MAP_EDITOR and solved the problem.

Originally I wanted to work a little at the vegetation code, but after seeing the crappy shadows again, I wanted to fix them a little. So the first thing I did was to greately decrease the ambient light, so that the shadows will stand out more. This change in the ambient light made the game look MUCH better, because not only that the shadows were very visible, but the normals on the objects shown very nicely, which is teh r0x.
The only problem was with the shadows being too blocky. After playing with the light frustrum size, and making it about 5 times smaller, the shadows look much better, but still a little bit squary. So I e-mailed Umrion (the dev who wrote the shadows in the firt place) asking him if he can use pbuffers so we can have bigger shadow maps, rather than being limited to the dimensions of the game window.

Another thing I noticed was that the Barren Moon client is so much faster compared to the Eternal Lands client, even tho they share the same rendering code. Then, after analyzing the code a little I realized that the speed is not due to any new/different code, but it is due to the fact that my test map is pretty empty.
I mean, I had a lot of objects in my view, but only a very small portion of the map had any objects in it.
So this made me realize that mikeman was right, and having all the objects placed in a single list is a Bad Idea (TM)
Now I have to think how to make it so that we do not check for all the objects when displaying the scene.
I posted it on our (EL) forums, see if anyone comes up with a good idea.
Sign in to follow this  


2 Comments


Recommended Comments

IMO Lists are the Devil. Use arrays instead, unless you have a good reason to use lists :)

As for your rendering speed... can't you simply use a quadtree ?

Share this comment


Link to comment
Oh, when I said lists, I meant it as an enumeration of stuff, an array[].
We have an array of pointers to the objects, then each frame that array is parsed and we calculate if the object is close enough to be sent to the OpenGL rendering.

Share this comment


Link to comment

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

  • Advertisement