Tuesday, May 19, 2009

To the 9s

Coffe Nutrition Facts
Found the other divide-by-zero bug.  Same story, different day--magical weapon attacks with 0 random damage.  Fix going out with the bazaar update.

As far as that goes, the bazaar works quite well though I'm still worrying about how to handle gold. Gold needs to be tradeable and droppable just like an item--problem is, it's not completely an item since we don't want it cluttering players' inventories.   Maybe if there were a "bank" (or perhaps storage?) where putting gold would stack it up into the fluid number in the corner if the screen, and from there it was spendable, but to trade or drop it you would have to carry it around as an item.  Seems like it would be a bit annoying, but I can't think of a better way at the moment that doesn't require making a whole lot of hacks into the other systems.


Adding the items into trade was really easy.  All I did was add a parameter to the network message for currency (SUPER easy thanks to the serializer...omg I love that code) and in the trade controller for how much was offered on each side.

In the course of developing that, I realized I could create a generic "user inputs number" prompt fairly easily using the code I'd already written from the Bazaar and changing the GUIModule code slightly so that it gets passed messages after they are sent to the subcontrols.  The upshot is that with only a few lines I can stick in prompts anywhere they're needed, and they correctly block the user from interacting with all other controls.  W00t!  I love modularity.

After thinking about the problem for a while, I decided NOT to treat currency and items the same way.  For one, items have a lot of special processing and are used throughout the server.  Adding more special processing would just complicate things, and all I really needed to do was to be able to drop items on the ground.  Since dropping 1 gold several times on a single square of the map should still result in just 1 pile of gold if I implemented it along with items this wouldn't be possible.  Long story short, gold is stored alongside items in the world regions in a separate map.  There are a few lines for special processing, and gold will persist as long as the region is active--it's never "cleared" like items are.  It would be trivial to add this, but I think it's kinda cool that it doesn't work that way because then you can tell if an area's been active recently by whether or not there's gold present.

I think this update's ready.  Entering gold into the system is a bit hacked in right now (fixed chance 1/20 to drop any gold, drops 1-10 randomly 90% of the time and 20-30 the other 10%), but I think it'll let gold start working its way into the system until I put something more final into place.  Also, I'm going to list some items in the bazaar for players to buy so they can see some cool stuff.  I'll make up some new items just to have something interesting for them to ogle.

Only other  minorly sucky point: gold looks like a big chest on the ground.  It'd look much cooler as a nugget or a pile of coins or something.


3 pm
I gave in and made the pile of coins icon.  Ahh, much better.  Also I moved beam so it's not coming out of the crotch anymore--it's actually coming out of the hands, or closer to where they're going to be when I add that animation.

4 pm
Update's out.  Works like a charm.

2 comments:

Joe M. said...

"Like a charm": http://www.unseenstudios.com/community/viewtopic.php?f=25&t=1568&p=10331#p10331

hahahaha.

Joe M. said...

Damn manual html entry. Fine. Here