Simple Video Games, Optimal Language


If it doesn't fit anywhere else, it belongs here. Also, come here if you just need to get hammered.

Spider Stomper

Posts: 248

Joined: Monday, 4th September 2017, 10:53

Post Friday, 8th December 2017, 17:43

Simple Video Games, Optimal Language

So I perused the coding section of this board, and was surprised there were no stickies or anything.

What language is Crawl programmed in? I am playing around with some board game designs, and one of them keeps poking its nose out of the box, wanting to be a video game instead. Im curious about what an optimal language to use is to this end, if high-end RT graphics are not the defining feature. I know very basic C++ and Python, and am otherwise good at logic. Turn based simple graphics ala Crawl is the idea, here. Google searches on this topic give a WIDE range of advice, so I was curious what people in the Crawl community have to chime in with.

Thanks.

Ziggurat Zagger

Posts: 8786

Joined: Sunday, 5th May 2013, 08:25

Post Friday, 8th December 2017, 19:41

Re: Simple Video Games, Optimal Language

DCSS is almost entirely C++, but some small pieces (level generators, vaults, etc.) are in Lua. Keep in mind that Crawl was originally written in 1995 by someone who didn't understand pointers at the time.
For a game you're developing in 2017, it's more likely that you want a small core in a mid-level language like C++, but do all the game logic and such in a language that's faster to code in like Python or Lua. Using an interpreted language for this also lets you test changes almost immediately instead of recompiling.

You probably won't get away with writing it in pure Python because you have to handle user input and draw things at some point, but almost-pure Python would work. (That's pretty much what ROM CHECK FAIL is, and that game is real-time! Though I don't recommend putting your entire game's source code in one file.)

The time it takes to learn a new language is going to negate any development speed advantage that you'd get from using a "better" language, so if C++ and Python are what you know, stick with those.

For this message the author duvessa has received thanks:
crawlnoob

Dungeon Master

Posts: 388

Joined: Monday, 18th August 2014, 20:04

Post Friday, 8th December 2017, 19:43

Re: Simple Video Games, Optimal Language

DCSS is in a mix of c++, lua, javascript (for webtiles), and python (for the webtiles server); for libraries it uses SDL2 as the graphics library for tiles and a custom websockets/jquery/ajax thing for webtiles. I don't really recommend DCSS as a good model for roguelike or game design, as it's a very old, complicated, and layered codebase, with roots long before using interpreted languages was viable. For most people starting out writing a roguelike (or related) game c++ is not going to be the best choice, I'd probably recommend an interpreted language, and in particular python. There are other factors that could push you towards something like c++ eventually, but prototyping in an interpreted language is still likely to be much easier. (Example factor: I suspect a pure python version of dcss wouldn't be viable because we need volunteer/cheap servers to be able to run as many instances as possible; this is actually just speculation though and I might be wrong given 2017+ cloud resources.)

If your game idea is roguelike enough there's a bunch of specific libraries around that can handle some of the graphics and turn-based aspects, but I know less about game development outside the roguelike sphere (I'd still start with SDL2 personally). One great place to start if your game idea is in that sphere is r/roguelikedev, which has a really immense amount of resources, FAQs, tutorials, etc. -- see the sidebar, plus the community thread links. The cogmind developer (u/Kyzrati) is one of the main admins there and has done a huge amount of work developing the sub, making resources available, running community threads, etc.

For this message the author advil has received thanks: 2
crawlnoob, duvessa

Swamp Slogger

Posts: 146

Joined: Wednesday, 30th August 2017, 23:08

Post Friday, 8th December 2017, 20:11

Re: Simple Video Games, Optimal Language

If your goal is making a game, don't put additional barriers in front of yourself. Make it in the language you know. If you have a burning desire to learn Unity or Swift or whatever, by all means, use a game as an excuse for a project, but if you don't care about learning new tech, use the language you know. You're going to make mistakes, you're going to regret choices you make. No reason to make it more complicated than it already is.

And definitely +1 to advil's comment - don't use DCSS's code base as a model for good development. It's just very old. (Though it is a very good case study on open source development - it's been going on all volunteer work with little centralized leadership for an impressive amount of time.)

Spider Stomper

Posts: 248

Joined: Monday, 4th September 2017, 10:53

Post Friday, 8th December 2017, 21:19

Re: Simple Video Games, Optimal Language

Hahah no, I know from the tavern that Crawl's code is a nightmare and figured it was probably not just a matter of architecture, but archaic programming languages as well. So didnt want to copy, necessarily, just wanted to see what it was that made crawl run and get the inevitable better suggestions. Thanks guys. Will look into it.

Return to Crazy Yiuf's Corner

Who is online

Users browsing this forum: No registered users and 19 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.