Alice Thunderstorm is a user on mastodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

Hey @Efi !
I'm coding my Go game in play-clj and I have MANY questions!

How do you think it's the best way to handle a turn based game?
I'm migrating a game I made for the console and I handled the loop by myself and now I'm a little bit lost :(

@ekaitz_zarraga so you want to be event-driven, you need to have an event (or keybind) to process the next turn, and then you just return the new game state to the looping function as usual in play-clj

@Efi then I don't need a on-render by default because I don't need to render periodically ?

Alice Thunderstorm @Efi

@ekaitz_zarraga you still need to render, but you can keep passing the same game object you got as an argument at the tail to render the same thing unchanged

· Web · 1 · 1

@ekaitz_zarraga or iirc returning null also makes play-clj reuse the last object

@Efi The entities object for the screen is also to put the "status" there or only for the things you want to render on the screen?
I'm sooooo new to all this stuff (including clojure)

@Efi I'll come back to this tomorrow... meanwhile I think I rendered something! mastodon.social/media/rBX7C996

@ekaitz_zarraga entities should have all your game state
I usually just have it be a map to organize everything under it, and in render I cherry pick what to actually render dinamically

@Efi Perfect! I got it!
I think I can integrate the whole thang easily :D

I have to learn how to overlay some stuff and I think I'll be done soonish :D

@ekaitz_zarraga just have different lists for each layer and render them in order =P

@Efi hm!
And if the layer is just the same during the whole game? is there a better way to do it?

PS: Thank you, baby, you are sooo helpful.

@ekaitz_zarraga why would you have only one layer?
you can implement it as separate lists or as a property to filter on, but if you want to make sure something is always drawn over another thing, you need to draw them in the right order

@Efi I'm making a boardgame, that makes the thing be just the board and the other stuff on top of it.
But I can handle the board as a group of tiles and print them like that.

I'll keep playing and I'll come back to you :D

Thank you :)

@ekaitz_zarraga just make sure the board is drawn first, donw