For now, that is. I think I've worked out all of the new bugs I introduced and everything seems to be working fine. I feel so compelled to work on things more related to the engine than creating more 'x-com' content, but this is probably a good thing. If you open/close a door that's adjacent to another door, it automatically opens/closes all adjacent doors. Yay for double-wide doors. Units now have a dimension variable, which will later be used for 2*2 sized units... and possibly larger ones.
the LOS algorithm is still only looking at a single dimension and I need to work on this, but I also need how to abstract objects into a sort of 3d shape. Things have a height, but nothing else really. I really need to figure out how I want to do this. Goal: windows that you can see out of.
Also, I'm going to start working on light sources, which will be switchable and vary in different ways. The simplest type of light source would be a diffused light which wouldn't cast shadows, but would diminish as its distance from the source increased. This would only need to be updated if it was switched on/off. Another type of light would be very similar to the LOS that agents use to see, except it would add light to the lighting matrix array. Each time some object in the world were to move, it would have to check with all of these light sources:
am I within your range?: no = done
yes = am I within your field of view: no = done
yes = subtract your light from my current position and the position I'll be moving to,
I move
add light aimed at my old and my new position.
This could still take time if there were a lot of these lights within range, even with only needing to redraw a small portion of their beams, but I think it would open up an interesting level ambiance that isn't normally seen in roguelikes. Also, many light-sources will likely be a combintaion of diffused light that doesn't cast shadows, with another LOS light that does, but the raytracing one will have a shorter range than than the diffused/soft light. The sun would be directional also, but would come from an entire horizontal direction, not a single point. (so, each ray would move directly across the y axis, for example.)
Showing posts with label refactoring. Show all posts
Showing posts with label refactoring. Show all posts
Wednesday, July 29, 2009
Tuesday, July 28, 2009
Refactoring is almost done
I'm nearly complete with my refactoring. I've also pulled all of the hard-coded human stats and all of the changeable information out of the classes, so that they can be kept outside (and later) will be contained in text files. I've also chosen to separate most of the standard 'costs' for things and contain all of this as a 'rule set' or something.
One of the most annoying reasons that I chose to refactor, besides realizing just how much in common many of my classes were, I found that the original way I'd been labeling my methods became horribly unworkable the larger my code got. I'd been naming things like, 'getThisThingy' and 'calculateThisThingy' (where these to both are in reference to 'ThisThingy.' when ordering the methods by alphabetical (or any other order) it was hard to keep track of which things were in refrence to what. All of my methods now are of the sort, 'thisThingyGet' 'thisThingyCalculate'
I continue to be amazed at how much I've learned so far in this process. Once I finish my external functions to actually set up the agents and I make sure that I haven't introduced any new bugs during my refactor, I'll likely 'fix' my messy equipping-related code. Seriously, it's incredibly horrid. You don't want to know. (it's not 'hacked' in or anything, it mostly is the way it is because I was OVERLY worried about somehow using it to cheat and dupe items, etc.)
One of the most annoying reasons that I chose to refactor, besides realizing just how much in common many of my classes were, I found that the original way I'd been labeling my methods became horribly unworkable the larger my code got. I'd been naming things like, 'getThisThingy' and 'calculateThisThingy' (where these to both are in reference to 'ThisThingy.' when ordering the methods by alphabetical (or any other order) it was hard to keep track of which things were in refrence to what. All of my methods now are of the sort, 'thisThingyGet' 'thisThingyCalculate'
I continue to be amazed at how much I've learned so far in this process. Once I finish my external functions to actually set up the agents and I make sure that I haven't introduced any new bugs during my refactor, I'll likely 'fix' my messy equipping-related code. Seriously, it's incredibly horrid. You don't want to know. (it's not 'hacked' in or anything, it mostly is the way it is because I was OVERLY worried about somehow using it to cheat and dupe items, etc.)
Subscribe to:
Posts (Atom)