Live data from Hacker News

Roguelike Tutorial: Up-to-Date and Literate

aimlesslygoingforward.com

11–20 of 28 posts

Re: Roguelike Tutorial: Up-to-Date and Literate

#11
post #2

If you are interested in both roguelikes and rust, there's an embarrassment of riches for tutorials. In addition to the (very good!) tutorial on the OP by Tomas Sedovic, I wanted to mention the rust roguelike tutorial by Herbert Wolverson / The Bracket: http://bfnightly.bracketproductions.com/rustbook/ The main difference is that on this case they use rltk_rs, a pure-rust library for roguelike development, instead of…

Oh this meets my interests very much. I was considering spending some time with rust during my Christmas vacation and this seems like a good candidate for leveling up my rust skills. Thanks for the link!

Re: Roguelike Tutorial: Up-to-Date and Literate

#12
post #7

Roguelike creators need to experiment a bit more with different themes and different core mechanics to make gameplayore interesting and diverse. > High Fantasy is the vanilla ice cream of video game themes https://www.goldenkronehotel.com/wp/2018/08/01/things-i-hate... > We have lots and lots of fantasy dungeon crawlers, so naturally if you want to really distinguish your project, go for any unique theme that’s not a…

I'm surprised the context is always fantasy instead of sci fi, given the games are inherently tech dependent.

Re: Roguelike Tutorial: Up-to-Date and Literate

#13
post #2

If you are interested in both roguelikes and rust, there's an embarrassment of riches for tutorials. In addition to the (very good!) tutorial on the OP by Tomas Sedovic, I wanted to mention the rust roguelike tutorial by Herbert Wolverson / The Bracket: http://bfnightly.bracketproductions.com/rustbook/ The main difference is that on this case they use rltk_rs, a pure-rust library for roguelike development, instead of…

For what ever it's worth, anyone looking into starting a roguelike in Rust would probably do much better by folloving the The Bracket link above.

In addition to it being a pure Rust library (which does make a difference when you get started, but also when you try to distribute your game) it compiles to WebAssembly as well meaning you can use the same code to produce a game that runs on the desktop and the web. And the tutorial covers much more ground as well, including ECS for those interested.

And finally, both the tutorial and tcod-rs are barely maintained anymore. I try to address questions/fix serious issues from time to time, but the chances of this seeing any significant developments in the future are very slim. The RLTK stuff is actively maintained and developed.

(I'm not the OP, but I did write the linked post, the tutorial -- which is based on the classic Python+libtcod one as well as started tcod-rs)

Re: Roguelike Tutorial: Up-to-Date and Literate

#14
post #7

Roguelike creators need to experiment a bit more with different themes and different core mechanics to make gameplayore interesting and diverse. > High Fantasy is the vanilla ice cream of video game themes https://www.goldenkronehotel.com/wp/2018/08/01/things-i-hate... > We have lots and lots of fantasy dungeon crawlers, so naturally if you want to really distinguish your project, go for any unique theme that’s not a…

This comment feels like a bit of a non-sequitor, but I agree. Cogmind is amazing, my own roguelike is quite abstract and a lot of the ones that really gripped me are not yer classic orcs and trolls.

If this is the reaction to the theme in the Rust tutorial that the original post talks about, that's because it's basically a port of the classic Python+libtcod one. It implements the same game, but walks the reader through doing it in Rust.

I (not OP but the author of the article and the Rust tut) wanted to use the same game & structure so folks can compare and contrast. A lot of folks are coming from Python or are familiar with libtcod. Plus it's trained generations of RL devs for better or worse.

If you do want to see roguelike creators experimenting, check out the annual Seven Day Roguelike Challenge[1]. Lots of absolutely amazing stuff keeps coming out of that, including most of my favourites.

[1]: http://www.roguebasin.com/index.php?title=Seven_Day_Roguelik...

Re: Roguelike Tutorial: Up-to-Date and Literate

#15
this literate programming is really cool. Thinking about the caveats at the end, I wonder if anyone's ever implemented something like this on top of git or similar? seems like the iterations of the evolving code across the tutorial could be mapped to commits or branches

Re: Roguelike Tutorial: Up-to-Date and Literate

#16
post #12
post #7

Roguelike creators need to experiment a bit more with different themes and different core mechanics to make gameplayore interesting and diverse. > High Fantasy is the vanilla ice cream of video game themes https://www.goldenkronehotel.com/wp/2018/08/01/things-i-hate... > We have lots and lots of fantasy dungeon crawlers, so naturally if you want to really distinguish your project, go for any unique theme that’s not a…

I'm surprised the context is always fantasy instead of sci fi, given the games are inherently tech dependent.

Historical reasons mostly, but also fantasy is a lot easier. You don't have to pretend to be realistic. That said, if fantasy is vanilla then sci-fi is chocolate.

Re: Roguelike Tutorial: Up-to-Date and Literate

#17
post #2

If you are interested in both roguelikes and rust, there's an embarrassment of riches for tutorials. In addition to the (very good!) tutorial on the OP by Tomas Sedovic, I wanted to mention the rust roguelike tutorial by Herbert Wolverson / The Bracket: http://bfnightly.bracketproductions.com/rustbook/ The main difference is that on this case they use rltk_rs, a pure-rust library for roguelike development, instead of…

I've been looking for some more examples of using the Specs project, thanks!

Re: Roguelike Tutorial: Up-to-Date and Literate

#18
> And I'm also unsure whether he needs to build the list of include statements like I do or whether that's somehow captured in the annotation itself.

> the workflow could be better. In the example above, we had to define the function body, prelude, if statement, else statement and both if/else blocks.

> It would be much better if we could inverse this: defining the whole function block with holes for the if/else blocks that the code generation would put in.

The original CWEB and newer NOWEB do handle these things a bit better - sections can be defined and included in any order, and sections can define which file their in.

It lends itself particularly well to laying out a program "top down", ie:

We define the utility ctof as consisting of a c file: ctof.c.

It has the following structure:

standard header includes

defining constants for conversion

defining the function ctof that converts a float value of degrees Celsius to Fahrenheit, returning a float

A help procedure that prints help

A main function that parses command line parameters, and conditionally call the help procedure or ctof function... Etc

Then can go on to define the inner bit of ctof first (the calculation).

In general literate programming is very nice. It can be a bit of a challenge when breaking out small sections (we define a loop that iterates over an array like so...) - because of scoping issues - if the programming language discourages many small (max 10 lines) functions/procedures.

At that point the literate system itself takes on the role of a macro assembler of sorts - which can work with old school "structured programming" - short programs, well defined global state (a few array/lists, a few "in" and "out" global variables).

See eg: http://literateprogramming.com/cweb_download.html (historic relevance)

http://leoeditor.com/ (not sure if it's alive - an interesting idea in "all literate, all the time"

https://www.cs.tufts.edu/~nr/noweb/ modern-ish take on literate programming - if you want LaTeX for the document part

Finally, the most pragmatic variant I'm aware of - literate markdown tangle - which might be close enough to what's in op to encourage a port:

https://github.com/driusan/lmt/blob/master/README.md

Re: Roguelike Tutorial: Up-to-Date and Literate

#19
post #2

If you are interested in both roguelikes and rust, there's an embarrassment of riches for tutorials. In addition to the (very good!) tutorial on the OP by Tomas Sedovic, I wanted to mention the rust roguelike tutorial by Herbert Wolverson / The Bracket: http://bfnightly.bracketproductions.com/rustbook/ The main difference is that on this case they use rltk_rs, a pure-rust library for roguelike development, instead of…

The bfnightly tutorial is a very good tutorial, but I do want to warn that it's not always terribly idiomatic Rust: Herbert was using the writing of the tutorial as a way of practicing Rust, so there are places where the explanations aren't quite correct and other places where the code isn't what an experienced Rust programmer would write. An example that jumped out at me (this from Chapter 8) was the use of

    &s.to_string()
which is an expression that could be shortened to just s. (Specifically, s has type &str, calling to_string() on it converts it to a String, and borrowing it allows it to be coerced back to a &str but now with unnecessary copying.) Elsewhere (this from Chapter 3) it has explanations like

> Copy and Clone allow this [type] to be used as a "value" type (that is, it just passes around the value instead of pointers)

which is also not a correct explanation, or at least is a misleading one: things can still be passed by value even without Copy and Clone and without any pointers at all. (Arguably, he meant, "You can share the value without using borrows," but that's not what the explanation said.)

That said, all this is nitpicky (and I suspect that Herbert would be receptive to feedback along these lines—I just haven't had a chance yet to provide it!) because the tutorial's explanation of roguelike-writing is still very good, and in fact I've been following it as a guide for writing a tutorial on top of a different Rust library myself! But I do want to warn about using it as a model for learning Rust specifically.

Re: Roguelike Tutorial: Up-to-Date and Literate

#20
post #5

If you're interested in the technical aspects of roguelikes, such as map generation and simulation, I recommend checking out the articles at roguebasin: http://www.roguebasin.com/index.php?title=Articles

The developer diaries for Cogmind are also a treat: https://www.gridsagegames.com/cogmind/

On the topic of game dev diaries, Factorio's devs have been making some of the best weekly posts in the industry: https://factorio.com/blog/
Post reply on HN