Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4

Author Topic: I want to learn how to program roguelikes.  (Read 6128 times)

palu

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #15 on: March 31, 2014, 07:10:02 pm »

If you're going to do it in javascript, I'd suggest rot.js. It's a javascript roguelike library with many useful features such as display, RNG, FOV, pathfinding, and map generation.
Logged
Hmph, palu showing off that reading-the-instructions superpower.
The internet encourages thoughtful, intelligent discussion and if you disagree I hate you.

catpaw

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #16 on: April 01, 2014, 09:15:56 am »

rot.js looks cool, didn't know about that.

Here found a nice little roguelike using it for example. You play in a funhouse and have to defeat evil clown laughing your self-esteem away :-)

http://kevinw.github.io/funhouse/
Logged

Melting Sky

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #17 on: April 01, 2014, 04:28:57 pm »

You really could program a rouguelike in just about any decent programming language of your choice. You could even use scripting languages like PHP if you put your mind to it but I think it would be wise to do it in a nice object orientated language which is much better suited for this kind of thing. C++ and its various sister languages would work well. Java actually would be another decent choice given its versatility across various platforms. You could even make it run on smart phones etc. Java would also be a good choice if you wanted to create some sort of persistent world that multiple players can interact with. Then again, that would be moving away from the traditional single player rougelike experience and into old school MMO territory like batMUD.
« Last Edit: April 03, 2014, 11:51:39 am by Melting Sky »
Logged

Loam

  • Bay Watcher
  • a Moal
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #18 on: April 01, 2014, 06:19:57 pm »

I began a roguelike-like in Python, using the libtcod tutorial someone mentioned earlier. It's pretty simple - I started with about zero programming knowledge and was able to start working on the game in a week, with good results (I need to start working on it again... that'll be a summer project, though).
The tutorial is well-written, unlike a lot of programming literature; it sometimes doesn't tell you exactly why you have to do certain things, but you can generally figure it out.
Only thing with Python is that, since it isn't standard on most computers, you have to bundle some extra stuff with the game to make it run (or something like that: I don't understand computers) - but that's a small problem.
Logged
Thob Goes to the Surface (Adventure Mode story, in progress)

metime00

  • Bay Watcher
  • Adequate Dwarf Fortresser
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #19 on: April 02, 2014, 07:38:15 am »

Use python 100%. It's very straightforward, concise and readable, and it has a ton of nice features when you really get into it. C++ will bog you down in memory management that the very smart compiler programmers have handled in languages like python and C#. Java will have you writing tons of boilerplate code and give you very little to work with in the way of good generic collections and standard libraries. Python has good standard libraries and premade functions that will be a huge headache saver. It's made to be easy to learn and painless to work in, so you'll be able to focus on the things your game would need to work, not implementing tiny things and having to create a huge bloated framework to do one thing. Good luck!

And roguebasin has a really good and comprehensive guide to make a roguelike, it'll help you keep important things in mind when you're making one
Logged
Live long if you can, and prosper by any means necessary.  Any means, Urist.  So pull that lever, or by Armok, I'll lock you outside come next siege.
He who plays with dwarves must take care that he does not become a dwarf.  And when you stare into DwarfFort, Dwarffort stares back into you.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #20 on: April 03, 2014, 01:17:12 am »

C or C++ is, or should be, a standard for most desktop applications.

Whazzis, 1992?

Things are ass-fast now. If you can get a Sonic the Hedgehog game to run at 60 FPS entirely off of Lua, you can damn well write a Roguelike in Befunge, much less Python or what-have-you.

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #21 on: April 03, 2014, 04:23:11 am »

Whazzis, 1992?

Things are ass-fast now. If you can get a Sonic the Hedgehog game to run at 60 FPS entirely off of Lua, you can damn well write a Roguelike in Befunge, much less Python or what-have-you.

C++11 has done a good job of adding many new modern features to the language (C++ lambda expressions are considerably more flexable than Python's, for example), and making it more usable (Auto-pointers make using raw-pointers almost entirely unnecessary). I wouldn't recommend it as a first language, however.
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

superbob

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #22 on: April 03, 2014, 07:49:37 am »

For someone new to programming, Python sounds great. C#/Java might also be an okay starting point, both are fine for learning how to code and put programs together.

C/C++ on the other hand, I do not recommend, even though I'm a huge fan of them. While not prohibitively difficult to learn the basics, they require some general programming experience to use well, and that experience is easier gained by practicing with less cumbersome languages. By experience I mean you need to know what you want to do, how you want to do it and why. In C, you'll need to translate that to pretty low-level concepts and build up from that, in C++ you can do everything you could in C plus a whole lot more, and in a lot more ways too - either way, unless you know what you're doing, you'll likely end up focusing on the how instead of why or even what you wanted to do, eventually straying pretty far from what it was you set out to do in the first place.

Essentially, if you want to learn how to create games, try Python, or maybe HTML5/Javasctipt, if you want to write bit more code, try Java/C#, if you want to code a lot and maybe, maybe come up with a game in the end, go with C/C++.

OTOH, if you want to learn to code, try doing stuff in a lot of different programming languages. Don't ignore languages like Pascal or Visual Basic, they can teach you programming concepts that are easily carried over to more difficult languages, without bogging you down with the complex syntax or confusing you with dozens of different ways of doing one thing. I know it sounds condescending but really, once you get the core concept right, it's a lot easier to expand your understanding in a more powerful language than start in a place you can do something in a bunch of specialized ways but not really have one simple way to get started.
Logged

catpaw

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #23 on: April 03, 2014, 09:51:58 am »

maybe come up with a game in the end, go with C/C++.

I don't get why so many here think that if you want to end up with a market ready game, you just must use C/C++.

So many commercial games use scripting engines for good part of the game logic, reducing the C/C++ needed to a minimal as possible engine.

Here a list of commercial games using Lua, which is a quite popular Language in the gaming industry, albeit hardly known outside for general purpose scripting.

http://en.wikipedia.org/wiki/Category:Lua-scripted_video_games

I give that there is a wide varity between the games of how big the relative chunk of the game is that is written in Lua. Some may do a majority in Lua while leaving only some 3D stuff etc. in the engine, others may have more in the engine while leaving only some level design scripting on a higher language like Lua.

Anyway even in highly professional industry, the amount of games that are purely C/C++ is diminishing.

PS: Lua used to be the fastest scripting language (as far one can say such a generalism as with different use cases differences are differences), thats why the gaming industry liked it so much. However with modern just in time compilers, the differences are shrinking. Today Javascript with Google putting a lot of effort - that is really a ton of money - into their V8 Engine, is up to par, which btw. both will outperform Python. Python is a cool language though, if speed is not your top priority - which as been said already, for a roguelike speed is not a concern unless you happen to have many thousends of entities like dwarf fortress, who all need to be concerned in calculations all the time.
Logged

BoredVirulence

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #24 on: April 03, 2014, 10:21:41 am »

Personally, while web based stuff is everywhere, javascript is shit, and always will be. If you want it to be mobile though, thats a fine start.

However, I defend my my statement that desktop applications, especially desktop applications that are memory intensive or computationally heavy, should use a more low level language. There are too many examples of programs that were fine using java, until they grew to the point where it isn't sufficient to be responsive enough. There are a lot of projects that started in a higher level language, but had to convert much of their engine to a lower level language once it grew too large as well.

If you're just learning programming, or if your application will be lite and doesn't need the efficiency, python is fine. Scripting languages in general will be fine. But there is much more to the world than scripting languages. I would recommend either C# or java to a first time programmer. Easy enough not to get too heavily confused, yet strong enough to get an idea of how programming works in general. Of course though, anyone who considers themself a programmer better know more than 1-2 languages.

Personally, I have a problem recommending people learn programming in a scripting language. There are certain things you never learn in a higher scripting language. Of course, most of that isn't necessary if you are just making web applications, but knowing it makes you a stronger programmer. Pointers and memory management are the obvious example. I've met too many java developers that claim to know and understand C++, but struggle at sight of the first pointer, or don't understand how memory works properly. For instance, when simulating an operating system, I saw a guy try and convert hex values into decimal before storing them, despite the fact that its binary representation is hex, and the system will just convert it back.

Using a scripting language inside of a game engine isn't new, and should be considered standard if you're making a game of any size using a low-level engine. I know HeXen used a scripting language for certain events, and I assume that it was used in Doom as well (although HeXen did extend the Doom engine, so maybe not).



TL;DR, C++ has a place in the world, javascript and python have a place as well. Unfortunately, most dev's I've met seem to believe everything should use a scripting language, or believe java is a replacement for lower level languages. Everything has a place, and if your application is computationally heavy and a desktop application, it should use a lower level language. Languages are only replaced when their use is better fulfilled by a newer language, not because its old. We didn't stop driving car's because they are soooo 1800's
Logged

catpaw

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #25 on: April 03, 2014, 10:55:44 am »

Roguelikes are not compational heavy. End of story.
Logged

Melting Sky

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #26 on: April 03, 2014, 11:54:25 am »

Roguelikes are not compational heavy. End of story.
It depends on how rouguelike your rouguelike is going to be. DF for instance brings my modern CPU screaming to its knees. But as with any programming project, it really depends on your level of skill, which languages you are familiar with and what you are trying to do.
Logged

BoredVirulence

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #27 on: April 03, 2014, 12:43:59 pm »

Roguelikes are not compational heavy. End of story.
It depends on how rouguelike your rouguelike is going to be. DF for instance brings my modern CPU screaming to its knees. But as with any programming project, it really depends on your level of skill, which languages you are familiar with and what you are trying to do.
This. The only change I would make to this sentence is that I believe you should always* use the tool that is best for the project, and learn the skills you need. If that isn't economical, then the project isn't economical for you.

*Except of course when the tool you are familiar with is similar enough that the extra effort to use the familiar tool is less than the effort required to learn a better tool. But in an ideal world you would learn the other tool anyway.
Logged

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #28 on: April 03, 2014, 12:46:34 pm »

Roguelikes are not compational heavy. End of story.
It depends on how rouguelike your rouguelike is going to be. DF for instance brings my modern CPU screaming to its knees. But as with any programming project, it really depends on your level of skill, which languages you are familiar with and what you are trying to do.
While this is a true statement, you're using an example on the very outlying edge of the bell curve of roguelikes to demonstrate your point. Do Nethack, DCSS, ADOM, or Cataclysm require the intensive CPU usage that DF does?

Also, Toady is using C++ for his engine, and as much as I love the game to death, if he were better at utilizing the language the game would run faster. C++ is not a magic bullet to more efficiency because you have to know how to actually utilize that power which is far more complicated than actually getting to the "making it work first" point. Yes, you can get some amazing speeds out of it, but you can just as easily construct something that will run slower because you didn't use it in the right way, and the right way is buried under sixty pages of badly worded documentation. Especially if you're working alone on a project and have no one to help you along with it.
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

superbob

  • Bay Watcher
    • View Profile
Re: I want to learn how to program roguelikes.
« Reply #29 on: April 03, 2014, 12:49:13 pm »

maybe come up with a game in the end, go with C/C++.

I don't get why so many here think that if you want to end up with a market ready game, you just must use C/C++.

I just said it's probably not the best tool for the job.

If the goal is to write code and learn a lot about programming then C++ might be a good choice, if the goal is to write a rougelike game and learn about making games in general then C++ would likely just get in the way. Even in the former case, it would probably not be the best choice, save for most stubborn newbie programmers.

As I said, I'm a fan of both C and C++. Among other things, I like how versatile C can be. C++, I don't even know where to start with things I think are awesome about it, especially with the new additions.

But I don't think they are particularly good tools for most things nowadays. Most certainly your programs would go faster if you wrote them in plain C. However, the number of applications where the end user could tell the difference is shrinking fast.

I'll admit, I used to be an ignorant C/C++ purist at some point, considering most other things either toy languages, useless academic/scientific languages, all scripts and things that ran in a VM like Java/C# to be uselessly slow. Well, I went out into the world and found out that they're all equals as long as they do the job. And some more equal than others, if they do the job better - better often meaning things other than being indisputably fastest and most scalable.

There's still great many things that should be written in C++, and definitely will be no shortage of them in the near future. No way I'm at any point implying this is a dying language. It's just that it usually takes a lot more effort to do something in C99 than it takes to do it in modern C++, which in turn is typically harder than doing it in Java, and still could be done with less effort with Groovy within Java, or Python if you can find a library that does it, or maybe all you actually need is a bash script that does some clever things with sed and find then calls a php script you conveniently persuaded the web dev guy to write for you, since he had too much free time anyway. So what if it runs for 5,4sec, instead of the 1,7sec that a C++ masterpiece would, if it took you 15mins to put together, you're only running it once a week and by keeping it simple you can let an intern maintain the code.
Logged
Pages: 1 [2] 3 4