project-navigation
Personal tools

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Ranieri

Pages: [1]
1
Coding / Trying to fix my first bug: thoughts on capacity.
« on: October 19, 2007, 10:28:12 pm »
Dear Developers,

First of all, thanks for making UFOAI. You managed to really capture the xcom spirit. You are definitely on to something here, I enjoyed playing the game immensely. Of course, the thing being open source and all, it was only a matter of time before I got tempted to get the development files and have a look at the codebase.
Of course, just browsing code doesn't do much. I was silly enough to ask the guys on IRC if there was something small that needed doing, and they obliged.

After fixing a trivial display bug (that took me on a scenic route of .po files and .ufo scripts before I managed to track down the proper line, very educational) someone suggested I tried my hand at this one:
http://sourceforge.net/tracker/index.php?func=detail&aid=1801131&group_id=157793&atid=805242

I was not able to reproduce the bug by building a single small hangar and stuffing more than 2 stilletto's in. However, I did notice that you could destroy a full hangar without losing the planes stored therein. While it's technically a different bug, the effect is the same: more planes than you have space for.
Spurned by this I investigated the capacity subsystem and came to the following conclusions. Correct me if I'm wrong though, this is just what i gleaned from a preliminary look at the code.

* Planes are a special form of a general problem. With the exceptions of Aliens (who are destroyed when their containment is torn down) this problem exists with living quarters, storage, labs etc. It is worth putting some effort into a general solution.
* Capacity for different resources is handled at the building level. You have one building with cap 5 and one with cap 3, buy an item worth two units and it could be taken off either off the two leaving you with 3/3 or 5/1. I think it's taken off the oldest first if it has space.
* As far as I can tell however, the items are however not liked to the building, so if you are handed a building for demolition, you cannot tell what currently resides in it. You can tell whether it's empty or not, but the player has no provisions for moving items out.
* Moving capacity out is not guaranteed to work unless you can move it all to a new place in one block. The 5 could be made out of 5 items 1 big (so you can split them no prob) or one item 5 big. Then you can't.

Questions:

* Is there a way to trace contents back to a building that I missed?
* Are there utility functions to rearrange the contents of a set of buildings to empty one? This could be called before the tear-down. If this call is succesful, the tear-down could continue.
* If not, is it worth doing? Is there a better way?

Thanks for your time! :P

Pages: [1]