[cells-devel] re: Hoping for a kickstart

Ken Tilton kentilton at gmail.com
Wed Mar 15 14:47:12 UTC 2006


Hey, sorry again for the dropout, I was moving homes and emails...

>
>
> [cells-devel] Hoping for a kickstartmomerath      michael at guildsoftware.com
> Sun Mar  5 20:10:09 EST 2006________________________________
>
> my
> initial attempt at using Cells for a very simple chunk of my own app was
> frustrating.

It really is a paradigm shift, so expect some whiplash. :)
Backsliding, too: for months after discovering (and loving) Cells I
would still fall into an imperative style when attacking some new
functionality because that would get my head into start-from-scratch
mode and I would fall back into my old ways. The neat thing is that
after an hour I would get this creepy feeling and realize why. :)

>
>  Rather than showing you the feeble start I made,...

OK, but it will be easier for me to help you if I have a feel for how
much you understand or do not, or where you are having trouble, and
for that nothing beats your failed attempts. No need to be shy,
because it does take a long time to start thinking declaratively, as I
said. (But it is fun from the beginning, and really worth it.)

That said....

> I'd like to
> describe the desired functionality, and get some feedback as to the idiom(s)
> to use.
>
> The primary classes are cargo items, cargo holds and maybe cargo sets.
>
> --Cargo items:
>
> slots that wouldnt change in the object's lifetime:
> item-id
> type-id
> volume-units (1-3 currently)
>
> changable slots (c-in for now I imagine, but if Cells invades the rest of
> the program, maybe not):
> holder-id
> authorized-holder-ids
> recipient-id
>
> calculated states I want efficient repeated access to and/or side effects on
> change:
> stolen (holder isnt a member of auth-h-ids)
> delivered (holder is recip)
> spaced (holder is not a char but a sector)
>
> --Cargo holds:
>
> static:
> ship-owner-id
> capacity
>
> dynamic:
> volume-used
> cargo-type-to-quantity hash
>
>
> --Cargo sets:
> Basically I'd like to be able to create a cargo set that is bigger than any
> cargo hold, and allow it to be distributed among the holds by both npc
> agents and players, but retain a handle on the set and certain dynamic
> subsets like the cargo in a particular ship, all the ships in a sector, all
> spaced cargo, all
> stolen cargo of a particular type in a sector, etc.  If the set mechanism
> were flexible and fast enough, I imagine that Holds could just be a type of
> set (the set of cargo held by character X), but there is a question of where
> to enforce hold capacity.  These sets would be used by npc agents (eg
> pirates) to drive potential actions (both at the level of posting a mission
> to collect specific cargo, and a single agent picking the best cargo close
> by that will fit in its hold).
>
>
> So, I hope that made sense.

Yes, but I have a suspicion (and your subject header confirms this)
that we can duck all that complexity and still get you kickstarted. By
which I mean, nothing there stands out as especially hard, there is
just a lot of it. So let's get you up to speed on a declarative
approach with the simplest subset you can carve out. Then you can
start adding in complexity and holler again for help when you get
stuck. And if you do not mind we can make this a Use Case for others
to learn from (I happen to think the Black Book series of tech
references (if you know it) is The Right Way to teach a system.)

We might want to start with a game universe that already has three
ships with varying numbers and sizes of holds, one set of cargo, and
one recipient? Just make those in a hardcoded initializer. Later on
you can worry about how the universe changes and how to have the model
adjust dynamically to, say, a new ship. I will let you be the judge,
just  try to think up something dead simple based on your
understanding.

The key trick here, and I bet this is where you are stuck, is... how
do things /happen/? Don't feel bad, if so; I always have trouble with
this. Cell applications are like spreadsheets: they are great at
expressing static computations over other spreadsheet cells, but the
only thing that /happens/ is a spreadsheet user typing a change into
one cell or another. If I am right, getting you over this hump really
does not need much complexity at all, it might just be as simple as:
how do I express an event such as "player allocates 50 tons of corn to
Titanic, Hold 42"? After that you want to see an "unallocated amount"
change, and you want to see the hold free space change, and you want
to see the allocation in a list of cargo subsets. Hell, maybe I will
toss off a quick Celtk demo complete with GUI.

OK, back to you. Let me know if this makes sense or if you need something else.

ken



More information about the cells-devel mailing list