Hearthling item memory for vending stands

Thoughts on the further development of Haven & Hearth? Feel free to opine!

Re: Hearthling item memory for vending stands

Postby Granger » Wed Apr 28, 2010 3:06 am

loftar wrote:
Granger wrote:You created this with OO technology?

Nope. :) I am utterly unconvinced by Simula-style OO.
I was once too, but i must admit that with time i see some merits when applied to the right problems.
There are two possible things that could at all be considered an ID of an object: The sprite, and the ID for locating the code which takes care of deserializing an object from its on-disk save-format. Both would work for extremely simple things like apples, of course, but break down with more complex objects. The sprite can both vary within the same kind of object/item (as for e.g. road signs or tree-planting pots) as well as potentially being the same between different objects/items.
Should you really save on-disk what sprite to use you have a really innovative way to handle this for some reason (which evades me so far tbh).

The same thing goes for the persistence ID as well, though in different ways. For instance, kilns, baking ovens, ore smelters and finery forges are all deserialized by the same function. The same goes for all kinds of crime clues, and for some other stuff as well.
In case the deserialisation ID works for extremely simple things (i don't think someone would feed an oven to a vending stand) like all items able to be picked into inventory you could maybe use this - without any warranty because i don't know the sideeffects this might have, cans of worms opened, or amount of paint used to paint yourself into a corner (in terms of doors for future expansions closed).

Apart from those, objects/items have no type. They do have various predicates they can satisfy, however. The crafting and building systems ask an item if it is an apple, a string, some common metal, if it is a container containing at least an amount of some substance, or something else entirely.
Without having looked at the code (which must be quite interesting given the view i have now on how you do it is correct - willing to sign a NDA to get a glimpse ;)) i am currently out of ideas on how to possibly handle this - apart from restructuring it in a way that an apple is an apple (on-disk and in memory).
⁎ Mon Mar 22, 2010 ✝ Thu Jan 23, 2020
User avatar
Granger
 
Posts: 9254
Joined: Mon Mar 22, 2010 2:00 pm

Re: Hearthling item memory for vending stands

Postby loftar » Wed Apr 28, 2010 3:28 am

Granger wrote:I was once too, but i must admit that with time i see some merits when applied to the right problems.

It might have some limited merits here and there. Having looked far and wide, I still don't see what or where, though. ;)

Granger wrote:Should you really save on-disk what sprite to use

No, I don't. You must have misunderstood me somehow.

Granger wrote:In case the deserialisation ID works for extremely simple things (i don't think someone would feed an oven to a vending stand) like all items able to be picked into inventory you could maybe use this

Not all inventory items are that simple, however. I already mentioned crime clues as one example, but I think there are a couple of others as well -- I can't really think of any right now, though, but I have plans for several, particularly if I figure out a good scheme to make combinatorial food.

There are other problems, too; for instance, such a vending stall could never ask for String, Metal or other abstract categories of items. Neither is there, as I already mentioned, any way to map those IDs to any displayable resource.

That said, however, I can see that an ugly-hack vending stall could still have some utility, in which case I'd probably limit items by sprite. I'm not sure I'm ready to open that proverbial can, though.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 9051
Joined: Fri Apr 03, 2009 7:05 am

Re: Hearthling item memory for vending stands

Postby Granger » Wed Apr 28, 2010 3:40 am

loftar wrote:You must have misunderstood me somehow.
Given that english isn't my native language - and i just ended a way to long session of your very addictive game leading to near-sunrise local time...

There are other problems, too; for instance, such a vending stall could never ask for String, Metal or other abstract categories of items. Neither is there, as I already mentioned, any way to map those IDs to any displayable resource.
One option could be to create a new flavour of vending stand (buying type, maybe with a different color to give hints to people passing by) which opens an additional palette with generics that can be used in case stuff like string is wanted (they must be limited to dragging onto the vending stand interface though, so they don't end up in players inventory).

As a sidenote: Thanks for opening your hobby project to the public!
⁎ Mon Mar 22, 2010 ✝ Thu Jan 23, 2020
User avatar
Granger
 
Posts: 9254
Joined: Mon Mar 22, 2010 2:00 pm

Re: Hearthling item memory for vending stands

Postby loftar » Wed Apr 28, 2010 4:53 am

Granger wrote:i just ended a way to long session of your very addictive game leading to near-sunrise local time...

Our time zones must be close, then. :)

Granger wrote:As a sidenote: Thanks for opening your hobby project to the public!

Nah, really; thanks for playing. Haven would not have taken its current shape if it weren't for everyone playing it. :)
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 9051
Joined: Fri Apr 03, 2009 7:05 am

Re: Hearthling item memory for vending stands

Postby Jackard » Wed Apr 28, 2010 5:03 am

Granger wrote:One option could be to create a new flavour of vending stand (buying type, maybe with a different color to give hints to people passing by) which opens an additional palette with generics that can be used in case stuff like string is wanted (they must be limited to dragging onto the vending stand interface though, so they don't end up in players inventory).

we need these for offline trading to actually work properly viewtopic.php?f=5&t=4983
User avatar
Jackard
 
Posts: 8849
Joined: Sun Jul 12, 2009 6:07 am
Location: fucking curios how do they work

Re: Hearthling item memory for vending stands

Postby Granger » Wed Apr 28, 2010 11:56 am

Jackard wrote:
Granger wrote:One option could be to create a new flavour of vending stand (buying type, maybe with a different color to give hints to people passing by) which opens an additional palette with generics that can be used in case stuff like string is wanted (they must be limited to dragging onto the vending stand interface though, so they don't end up in players inventory).

we need these for offline trading to actually work properly viewtopic.php?f=5&t=4983

Read through this and tbh i still don't really see the the absolute need for generics (at least at the current state of the game).

The example given there (selling caroot cake and wanting linnen, chants or berries) could well be modeled by using one buyers stand acceptin linnen, chants and berries (3 slots, each with an individual price - must be able to say 'buying ? items of type ? (minimum quality ?) for ? coins' though to make it useful for lowpriced goods) and a vending stand selling the cake.

And in case you want to get string you could well setup the slots to accept fibers, taproot and stinging nettle...
⁎ Mon Mar 22, 2010 ✝ Thu Jan 23, 2020
User avatar
Granger
 
Posts: 9254
Joined: Mon Mar 22, 2010 2:00 pm

Previous

Return to Critique & Ideas

Who is online

Users browsing this forum: Claude [Bot] and 1 guest