One Hour One Life Forums

a multiplayer game of parenting and civilization building

You are not logged in.

#1 2020-01-24 00:56:22

jasonrohrer
Administrator
Registered: 2017-02-13
Posts: 4,676

Update: Curved Tracks

NA9DVDT.png

Forum member Wuatduhf made an important discovery:  recent changes to the way object patterns work had suddenly made curved cart tracks much more reasonable to implement.

It turns out that I already had the graphics drawn for these curves, and they looked really good back in the day, but I had to scrap them because of the combinatorial explosion that they would entail.  For example, north-moving carts already had three "leave" cases (leaving from south ends, north-south tracks, and cross tracks) and three "entering" cases (entering north-south segments, entering north ends, and entering cross tracks).  To handle all the combinations, 9 distinct transitions were required for each cart direction, resulting in a total of 36 transitions.  That's a lot, but as soon as we add in curves, it blows up even more, with something like 25 transitions needed for each cart direction, or 100 total.  That's a lot of transitions to author correctly, and way too much to keep track of along the way, resulting in tons of room for error.

So what changed with object patterns to help with this problem?  Something pretty tiny and simple, actually.  Part of the bottle update a few weeks back involved emptied bottles that made a final sound as they were emptied.  Roughly half of the bottles held liquid, and the other half powders, requiring a different empty bottle state for each to play the "glug-glug" or "swish-swish" sound.  All the bottles were part of one big 18-item pattern, but how could I flesh out the empty state for this pattern?  Since an object can only occur in a given pattern once, I would need to create 18 separate "empty" bottles, even though they all pretty much did the same thing (half of them playing the powder sound instead of the liquid sound).  That's a lot of extra objects that essentially do nothing.  But why couldn't a pattern have repeated objects in it?  In other words, why couldn't a pattern "converge" on a few common end states?  These bottles could be different all along, with 18 variations, but once empty, end up as one of two empty-state bottles to play one of two sounds.  Each of the 18 slots in the pattern would contain one or the other of these two bottle objects.  I updated the pattern editor to support this, and that was it.

Wuatduhf's observation was that these new "converging" patterns were exactly what was needed to cut through the combinatorial explosion for tracks.  As a simple example, when a track cart moves north out of one of five possible north-bound tracks, each of these needs to potentially land in the same connecting track.  This can be implemented as a pattern, then, only if the pattern can contain repeats of the same destination track.

Thus, instead of 25 separate north-bound transitions, I was able to implement one set of north-bound transitions describing what happened to a north-bound pattern, and then fill the pattern with all the cases.

This also allowed me to implement tracks that pass through spring-loaded doors pretty easily, preserving the insulation bonus for the room that the track emerges from.

In the end, each of these patterns had 25 elements each (with repeats to cover the various combinations), and the north-south patterns had 36 elements each (due to the extra combinations needed for passing through spring doors).  And there were five separate patterns for each direction, resulting in a grand total of 610 items listed in these patterns (all passing through only a small handful of transitions).

There was still a lot to keep track of when fleshing out these patterns, and the whole thing felt about as close to an IQ test as I've experienced while working on this game.  My moth-holed, 42-year-old brain muddled through it all, but barely.

But those curvy tracks sure do look nice.  Great to dust off 17-month-old artwork and finally put it to use.

Offline

#2 2020-01-24 01:01:14

MapleSugar
Member
Registered: 2019-10-30
Posts: 39

Re: Update: Curved Tracks

I like it
I want track cart to be faster

Last edited by MapleSugar (2020-01-24 01:08:23)


Sorry my poor english.
---  ....  ---  .-..

Offline

#3 2020-01-24 01:02:47

Jamie
Member
Registered: 2020-01-20
Posts: 95

Re: Update: Curved Tracks

Nice, Maybe people will build railways now.  Might you look into letting us ride them. Possibly making then into a form of fast travel.

Offline

#4 2020-01-24 03:24:30

Jojigirl
Member
Registered: 2019-02-16
Posts: 238

Re: Update: Curved Tracks

Very nice! I know there will be lots of different builds and designs happening with the tracks now! 

Good work, very much appreciated! smile

Curious, if you happen to send a cart on each track and they meet in the middle at the same time, will they crash into each other and be destroyed?

Last edited by Jojigirl (2020-01-24 03:27:25)

Offline

#5 2020-01-24 03:41:41

Wuatduhf
Member
Registered: 2018-11-30
Posts: 404

Re: Update: Curved Tracks

Jojigirl wrote:

Curious, if you happen to send a cart on each track and they meet in the middle at the same time, will they crash into each other and be destroyed?

Very much so. They'll destroy the tracks underneath themselves.


Avatar by Worth

Offline

Board footer

Powered by FluxBB