Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

roomchain generator seems to be broken (mod edit: fixed!)

A topic by r618 created Aug 27, 2018 Views: 570 Replies: 8
Viewing posts 1 to 5
(5 edits)

hi,

i've made sure to be as careful as possible adding 15 (all combinations of four direction minus 1) room templates w simple tilemap (empty and non emtpty tile), but roomchain generator seems to be producing non connected paths often, 

- the Exits room lists for N and S seems to be swapped  (the custom inspector seems to be adding N to S, S to N, but E to east list and W to west list though) - note I've tried to manually swap room templates in N and S exit lists, but it looks like there's bug somewhere else (still getting non connected paths) 

and two things in the manual:

- there should be step 5.3.1 for adding the empty/black tile as default to board library

- picture in 5.1 is wrong :) - should highlight create new roomtemplate

do you want me to send a package w the project ? it's minimal reproducible after 1 - few random runs

(2 edits)

So the problem is that if room chain generator is started more than once in single generation request - which it occasionally is since there's (hard) for loop in BoardGenerator.cs 's BuildLevel coroutine calling RunGenerators() checking its return value - you initialize starting conditions (location and start room) again - which is not in sync with whatever current data was being generated so far (including them in the 2nd run  would be probably incorrect anyway), so the generated layout breaks (despite chain being found correctly internally)

(I at first thought that the coroutine starting twice with combination with editor button click would be the problem, but 'decoroutining' it didn't help)

You might want to fix this properly - ( a quick fix directly in roomchain generator assigning initial location/room only on '1st' run is not stable, running out of iterations often. - The rooms seems to be generated OK if it passes, though, with Exists assignments being left as originally were)

Hope this helps, cheers!

Developer

hey there,

Extremely sorry I didn't see this, somehow I didn't get an email notification on it from Itch. Please email support@mirrorfishmedia.com next time if you don't hear from me and I'll get right back to you.

Thanks very much for pointing these issues out and the thorough bug report. I'll look into them.

The switch to using Coroutines actually came about later in development since I did a prototype which combines it with Aron Granberg's A* asset and it was useful to be able to wait for generation to be complete before generating the NavMesh, so I figured others might want to do the same.

Honestly the looping/discarding in the RoomChain generation is still not totally satisfying to me, it was created to guarantee chains of a certain length, since sometimes it's would just throw up very short chains. Might need a deeper rethink for that. The PlatformerRoomChain at least guarantees reasonably longer chains without this approach.

Best,

Matt

Developer

Quick update, I think the issue was that for some reason I failed to call ClearLevel() during the loop in BuildLevel(), leading to old data on subsequent loops. I think this was an attempt to optimize gone wrong. Could you please try adding a call to ClearLevel() to the beginning of the for loop in BuildLevel (around line 203 of BoardGenerator) and let me know if that solves this issue for you? It looks good on my end, if it works for you I'll ship the fix.

Thanks again and sorry I missed the earlier response. I'm new to using Itch for this purpose.

Best,

Matt

Hi, don't worry, I'm prototyping other stuff, not sure what (and if) generator should be the best yet

Yes, I've tried to move the whole setup before the loop in BoardGenerator into separate function and called that inside the loop before RunGenerators() - this results in non consistent state when generation fails ( generationSucceeded == false ) such that the minimal number of rooms is not reached and generated tilemap layout does not correspond to generated board data ( I have player placed inside first room after generation which is off the rooms chain in that case ) - probably something's not cleared enough in next iteration, but I did not investigate further yet

(there's plenty of space to run w 6x6 tiles and 102x102 tilemap, I've since deleted test package from OP, but I'll leave it here now: https://www.dropbox.com/s/tlp7sklzcu6i6fe/STroomchain.unitypackage?dl=0  (few SOs + scene))

I haven't tried other generators such as PlatformerRoomChain - I wanted very simple setup first with short (5-20), one-way non branching paths

it works neatly otherwise though :-)

Cheers!

Developer

Hmm so even calling ClearLevel the state is not reset? That's weird. There may be some parameter I'm failing to reset. For additional clarity, are you doing this in Play mode at Runtime or in Edit mode or both? Thanks for your patience, I'll take a look at your repro case and get back to you.

Honestly I probably should just move the state-ful stuff out of the BoardGenerator and into a function like almost everything else. Gonna have a think about it.

best,

Matt

(1 edit)

i was just restarting play mode when it failed to produce chain on the first try, this was the same when generating in edit mode [clear&generate button]

when it failed the displayed chain was very short: 1- 3 rooms max - this seems to be correct though since there _are_ rooms w one entrance/exit only and requested minimum was 5

(as a sidenote: the condition for picking the next room should be probably more advanced and not entirely random if room template with more exits exists and end (edit: minimum rooms) was not reached - to not run in these premature dead ends; - but moreover there's no guarantee that the generation has successfully finished currently - I think you're safe to loop/yield until it is instead of hard limit though :-), but note that I'm totally fine with current state and can check result in user code if necessary)

'400' is enough for everybody, until a kitten is burnt ^_^

Cheers!

Developer

I just shipped an update (1.1) that replaces RoomChain with RoomSequence, which so far is much more robust. Also added RoomTiler which is sort of Wang tile inspired and spreads out along any open exit, as opposed to generating a linear sequence. If you have a chance to try it out I'd love to hear further feedback. Details here:

https://itch.io/t/298310/strata-11-is-out

Thanks! 

Developer(+1)

hey just FYI I edited the post title to say that it's fixed, in case anyone just glances at forum titles, hope that's ok :)