Home Artists Posts Import Register

Content

I just finished reworking the store system, employing a different approach than what I initially did. The remainder of today will be spent debugging the new system, and then I will add a bunch of new items (including a lot of patron-suggested items) before releasing the next update.

The old store system was honestly a bit of a mess. It worked by keeping a list of items the store owned, which was synced to the working copy of save data and shared across both the merchant inventory generator, and the controller invoking it.

It wasn't good. The two major problems with it is that I can't retroactively add items to this system, and it takes up an unnecessarily large amount of storage, since the items in the store are pretty much hardcoded anyway.

The new version is far more compact and cohesive.  While visually, nothing has changed, the underlying code has been improved and made more future-proof. Instead of holding a list of items the store has, that list is generated at-runtime, by coalescing two separate lists: the hardcoded list of items the store owns, and the list of items the kobold has bought or sold.

So basically, instead of keeping the entire store's inventory in your save data, the game now only keeps track of what you bought or sold (which will typically be far less entries). Only in the very worst case scenario, where you buy everything a store owns (typically impossible) and then sell some things on top of that, will the save-data-usage exceed the previous model.

Furthermore, this new implementation allows me to retroactively add items to stores. If, in the future, I decide I want to add another potion to Morning Four, then that can very easily be done. The rework is also simpler to implement into scenes, as I no longer need to handle a bunch of things in the scene's controller itself.

Since that would cause a lot of headaches with already existing save-data, Seki's store, and Rolande's store both remain unaffected by this change. They are still running the old code. The Morning Four marketplace will, for now, be the only one running the new system, which will be used for all future stores in Kobold Adventure.

So yeah! Basically a programming week, thus far. Up next will be implementing new items. Once that's done, the update will hit! Probably somewhere this weekend. That's pretty much all I have to say for now. Sorry for the nerdy post, but it's hard to explain what I've been doing these past few days, without dipping into technical things. Thank you for your continued interest, and I'll see you this weekend!

Comments

No comments found for this post.