Item Fixes, AI Looting, and Mouse Upgrade

After reading about a few stubborn item bugs today, I decided to put the editor overhaul on the back burner for a day or so. I feel weird working on new stuff when the old stuff doesn't work correctly :)

Item Degrading Bug

The first bug had to do with items degrading. The most common case was clean rags degrading into dirty rags. It turns out last week's fixes didn't cover the case when a stacked item degraded, especially if the degrading item was deep inside a stack, instead of on the top.

The symptom is usually endless rags appearing on the ground if the player is carrying stacks of clean rags in low condition.

I was able to fix that, so it should start behaving in the next build.

Item Swapping

Another change I worked on had to do with swapping items in the inventory screen. Normally, if a small item is hovering over a bigger item, it's possible to swap those two items. However, it's not possible to do the reverse: drop a big item and pick up the small item under it, even if the big item would've fit.

I wrote some code to handle that case, and it should be possible to swap items regardless of size, as long as the item being dragged fits in the space after the swap.

AI Looting Bug

Another fix involved the AI looting certain hex resources. AI was running off with whole lakes and woods in their hands, leaving the hexes empty.

I made some changes to stop that from happening.

Mouse Upgrades

This set of changes is a bit untested, so I left it for the bottom of the list. I don't want people to get too excited in case it doesn't work.

Basically, recent versions of Flash allow two new features for the mouse: hardware cursors, and right clicking. If the game is compiled in the right Flash version, and the plugin viewing the game is up-to-date, it's possible to do both of these things.

Hardware cursors just means that the OS handles the cursor updates, instead of Flash. The result should be smoother and faster cursor movement. So far, this appears to be working. Dragged items and button highlights are still a bit laggy (like before), but the cursor position is as fast as Windows/OSX/Linux cursors. Seems like an improvement!

And the other feature, right-clicking, is something folks have requested for a while now. This, too, seems to be working in my tests. I was able to get the top menu buttons to appear along side the mouse when right-clicking, and make them disappear when one is clicked (or the user clicks elsewhere on the screen).

So far, so good. Though, the top menu buttons may not be the right options for a right-click context menu. When the user right-clicks, they probably want the game to actually use the item, or delete it, not just change the cursor mode. On the other hand, clicking on "take" or "drag" is probably the user signifying that they want to change modes.

So I'll have to try out a few different solutions, to see what works. It'll probably evolve over time, too, as users try it out.

Hopefully, I can get this working tomorrow, and give you guys a chance to try it for yourselves. Wish me luck!


RevLowTec's picture

Good Luck! And may nothing unexplainable strange occur along the way, break or give you more of a headache than necessary.

mdqp's picture

Wait, does this mean that a lake can actually run out of water? How many units of water does it contain? Does this mean that one could get to the point of being unable to light a campfire because there is no more wood in the map (it can't be scavenged, if I remember correctly)? And what do NPCs use wood for? Do they carry torches at night?

dcfedor's picture

@RevLowTec, unexplainable bugs is my middle name :)

@mdgp, hex resources don't run out. It was actually a bug with the AI picking up the lake/forest icon and walking away with it, probably depositing it in their home hex. Hex resources don't run out. They hold an infinite amount of their resource.

Some day, I might add finite resources. But for now, the map can't be completely deforested/dehydrated.

Dan Fedor - Founder, Blue Bottle Games

mdqp's picture

You had me worried there, for a while... :D I think that lakes should remain, even in the future, it would be weird to have them be depleted through the use of the few survivors (woods could disappear, but I wonder about that too, since you don't actually cut the trees).

dcfedor's picture

Oh, no :) I doubt I'd ever make lakes, rivers, or forests deplete. I was thinking more along the lines of smaller resources, like an abandoned apple orchard. Something one could conceivably empty in hours or days.

Dan Fedor - Founder, Blue Bottle Games

LpPoru's picture

"AI was running off with whole lakes and woods in their hands, leaving the hexes empty."

the mental image of that just makes me laugh XD
phew that was a long fight. lets see what this raider has in his pocket. a.. lake??

check out