God hates me again

Published February 22, 2005
Advertisement
Today I finished the 'baby ojects' which can be used for growing plants, and possibly to show the stages of a structure that is being built.
I finished that in about 30 minutes of work.
However, there were a few problems. First, the map got corrupted whenever a plant became a baby plant (for testing purposes I changed the order in which the plants grow, from adult to baby plants).
Then, the baby plants became adult plants whenever a seed of the same species germinated.
Finally, when plants associated with a resource changed to some other resource, the other resource was not being used, but the previous one was.
So I had to spend about 5 hours debugging, and solving all those problems, which were not related.
The plants not becoming another resource was relatively easy, I was using the ID of an object after that ID changed.
The plants becoming adult when a seed of their type germinated was relatively easy as well, but tricky. It turned out that I set the "size" value in a definition of a 3d object, rather than in the instantiated version of the object (we are talking C here, not C++, so it was about structures, not objects as in OOP).
The map corruption problem, on the other hand, was very nasty, and took most of the time, about 2 hours. The problem was that while replacing a 3d object with another, some old values were not copied properly, due to using a pointer to an object that was erased.
There was also a small modification I made with the vegetation becoming a resource by default, based on the object type, rather by using the flags sent by the server. While this is SLIGTLY less flexible than the previous way, it is far better from the bandwidth point of view, and makes my life easier.
This change also took a little more than expected, due to some other bugs that had to do with the CVS acting up, and using a previous version of a file which I fixed a while ago.
Previous Entry Vegetation again
0 likes 11 comments

Comments

Nahrix
Your work is absolutely incredible. I'm sure you're going all the way in the world of game development. Hope you have fun with what you do.
February 22, 2005 11:05 PM
Raduprv
Thanks ;)
Tomorrow maybe I will post some simple screenshots showing the plants growing. However, the growing is not smooth, the obejcts have only 8 sizes, so the plants 'jump' each time they grow, until they reach maturity.
February 22, 2005 11:26 PM
xanin
Shame that there isn't any easy way to 'scale' the plant objects as they grow. Or to have an adult plant model as well as a baby model and have the client interpolate between the two.
February 23, 2005 01:29 PM
Nahrix
Just a thought: Couldn't you have the plants 'jump' to certain sizes (like the 8 different sizes, or maybe even less), and have them grow per-frame on the client-side? The server-side's plant size (which would for however many frames it takes to grow from one size to another) would thus be smaller than the client's depiction of it.

The problem you would run into is having the players be able to partially walk 'into' to plant as it's growing. That problem could easily be fixed by making the collision box the size of the current plant-size on the server + 1. You wouldn't be able to walk 'right up' to the plant most of the time, but you would get smooth animation on the client's side, at little performance cost on bandwidth.

I'm a newbie, so maybe I shouldn't be giving advice, as there is probably something I stated that is terribly wrong and blasphemous, heh.
February 23, 2005 02:02 PM
Raduprv
The client COULD interpolate between the plant positions, that's not a problem. However, the plants are updated on the server only once/hour, and the client doesn't know when/which plant will be updated next. Some plants grow faster than others, and some plants grow only if there are enough nutrients in the soil. The client doesn't know that either.
The server COULD send information to the client like: thisplant will grow this much in one hour, but then this would require a lot of bandwidth, since the client would need to know that information for all the plants, so this can be very taxing on the bandwidth.
February 23, 2005 05:43 PM
xanin
Hmm. I can see where that would be a problem then. *thinks* Given the constraints of your situation, I can't really think of a way around it without increasing the bandwidth consumption either.
February 23, 2005 06:55 PM
Raduprv
I am sure that if this were the outmost important thing in the Universe, I could find some solution around it, but does anyone REALLY care about seeing a plant growing smoothly, or do they care more about having more freedom in the game? Our team is very small, so we have to focus on the important stuff first.
February 23, 2005 08:41 PM
xanin
I wouldnt care if it was smooth or otherwise, though you might consider, if theres spare time and a bored programmer, when the client recieves a grow update to have it grow in size smoothly via interpolation. I just have a tendency to obsess over fine little details, which is probably why i rarely finish personal projects...
February 23, 2005 09:16 PM
Raduprv
Before starting working at Eternal Lands, I also had this tendency, but I had to abandon it in favor of adding more important stuff (gameplay related) rather than focusing too much on the the eye candy things.
February 23, 2005 09:24 PM
Roboguy
You could send a message saying that, in a fixed amount of time, the plant will reach the next stage. It wouldn't really need much data, just the message ID and the plant ID, so I doubt it'd take much bandwidth.
February 24, 2005 07:37 PM
Raduprv
Consider the plant ID is 16b and the time ID (how many seconds till it grows big) is another 16b
Combined with the message headers, we have 7 bytes for every plant, for every player in the screen.
To make things worse, you will ned yet another value which says: this plant is of this size (where size is a 16b value, indicating a delta growth). It's hard to explain, but, like I said, this is NOT easy and can't be done without extensive bandwidth.
February 24, 2005 09:26 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement