Author Topic: Python for a Rouge Like RPG  (Read 11980 times)

hawk767

  • Newcomer
  • Posts: 3
  • Karma: +0/-0
    • View Profile
    • Email
Python for a Rouge Like RPG
« on: November 10, 2011, 12:48:58 AM »
I've been studying programming from Java to C++ and now to Python. While I have never implemented anything I've learned I've always wanted to but have never had the ideas on what to do or how to do it. Now that I do I've found this language, Python, and like the simplicity and power behind it.

I've learn many concepts of programming and with C++ it was always hard to work with just the concept because of the language complexity, but with Python it seems a lot easier to work with.

So my idea:

The game is going to be made with the ASCII characters so basically it will be a rouge like. The major idea behind it is to be similar to Adventure mode in Dwarf Fortress but that's really the only comparison I'm making. Since this will be my first time working with Python I know to start small and work my way up.

1. Game screen generation + player character '@' placement
No movement will be implemented first just the screen and to have the player appear on screen.
2. Of course then movement through keyboard input.
3. I'll need to have an NPC character generate as well in order to test the next addition.
First NPC will probably be simple. I'm a little worried about how to have this character move around freely. Would I have to create AI before NPCs could be implemented?
4. I want the player to have the ability to interact with things in multiple ways. The most basic being through combat.
Combat from the beginning will simply be the ability to attack and maybe a percentage chance to block.

That's really the basic bare-bone set up for character control I have figured.

5. Simple Dungeon. Like most if not all rouge-likes they have a dungeon generator.
I'll probably find a good example with a generator and look over it. I wonder if I should just hand craft a sort of dungeon first before delving into a generator simply for the fact of expanding other game elements.

I plan to expand on pretty much every simple idea to add to it once I know how to work with it.

Interaction : Instead of just combat I'd like to include other interactions as well.
- talking
- examine
- advanced combat
- magic

Advanced Combat : One thing I love about Dwarf Fortress Adventure mode is the combat. While I don't think I'd like to go that complex, at least not now, I'd like to have the ability to,
- attack specific locations on the body
- have an attribute system that effects every part of battle from damage, chance to block, attack and movement speed, reach of attack, and whatever else is involved with the fighting.
- add in ranged weapons like bows
- have weapon types effect the attack reach, damage, and have your skill with the weapon effect all that as well.

NPC Generation : Instead of just having the random enemy NPC generate I'd like to have friendly or neutral NPCs as well.
- Talk with friendly NPCs, possibly receive quests or have an NPC become your companion.
- Enemy NPCs have advanced combat skills meaning they can and will fight like you can, choosing body parts to attack not completely randomly but maybe (though this would involve a lot of variable comparison) attacking depending on the efficiency of the attack depending on their attributes, weapon, etc.

Dungeon Generation : While dungeons are all fine and good I'd like to be able to create both interior and exterior locations.
- I'll start with an all interior dungeon generator then eventually work my way to having it generate exteriors as well. Have rivers, lakes, mountains, etc. I'd really limit this though because I know that I could lose all my time trying to make this as realistic as possible. I'm not looking to create a whole world (at least not yet) like Dwarf Fortress does.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

That there is basically the idea I have for this project. It will grow and develop as I work on it of course but I'm just looking to get input on how I might go about all this. Though that's a pretty broad question.

I'd really appreciate if someone or a few people could go through these things I've explained and either link me to sites that would help with this sort of thing or explain what ways I will code these mechanics.

I've read this and it is helpful but I'd rather not follow something like this step by step because I can't learn like that. I learn better finding things out on my own or with help from others, this way I feel as though I'm just copying and pasting the code and doing nothing myself.

One issue I've been running into as I tried starting with the code last night is that I can't get python to run through notepad++. I've tried a few different things like having the Run... shortcut set to the "$(FULL_CURRENT_PATH)" but a cmd window pops up and closes almost instantly and all I can make out is that I see the word syntax. I know the code I was writing was correct as well and I also copied it straight from the tutorial.

My final question. I read somewhere that Python is great for scripting but it may be necessary to write a games engine in something like C++. I was wondering how this would work. I'm also wondering what would an engine for this sort of game I've explain above me composed of.

Really appreciate any help I get seeing as this is such a long winded post.

Thanks

getter77

  • Protector of the Temple
  • Global Moderator
  • Rogueliker
  • *****
  • Posts: 4957
  • Karma: +4/-1
    • View Profile
Re: Python for a Rouge Like RPG
« Reply #1 on: November 10, 2011, 02:38:09 AM »
Out of my depth as usual, but this MAY be a thing of interest to you:

http://inventwithpython.com/pygcurse/
Brian Emre Jeffears
Aspiring Designer/Programmer/Composer
In Training

corremn

  • Rogueliker
  • ***
  • Posts: 700
  • Karma: +0/-0
  • SewerJack Extraordinaire
    • View Profile
    • Demise RogueLike Games
Re: Python for a Rouge Like RPG
« Reply #2 on: November 10, 2011, 12:55:23 PM »
I love a good rougelike ;D
corremn's Roguelikes. To admit defeat is to blaspheme against the Emperor.  Warhammer 40000 the Roguelike

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Python for a Rouge Like RPG
« Reply #3 on: November 10, 2011, 06:34:25 PM »
I've been studying programming from Java to C++ and now to Python. While I have never implemented anything

You never programmed anything? Don't start with a roguelike.

XLambda

  • Rogueliker
  • ***
  • Posts: 208
  • Karma: +0/-0
    • MSN Messenger - tau_iota@live.de
    • View Profile
    • The Weird Rogue
Re: Python for a Rouge Like RPG
« Reply #4 on: November 10, 2011, 08:11:59 PM »
I've been studying programming from Java to C++ and now to Python. While I have never implemented anything

You never programmed anything? Don't start with a roguelike.

I hate to say it, but I agree. Such a large project requires detailed knowledge of the language you want to write in and of data structures and algorithms. Especially C and C++ require this (don't even touch C).

However, if you really want to jump into RL development right off the bat, I can recommend the python+libtcod tutorial over at roguebasin.com. It explains a lot of things you probably wouldn't find out on your own. Even if you don't want to go through the entire tutorial, it is a very good reference for starters.

hawk767

  • Newcomer
  • Posts: 3
  • Karma: +0/-0
    • View Profile
    • Email
Re: Python for a Rouge Like RPG
« Reply #5 on: November 10, 2011, 10:54:44 PM »
I've actually been reading the tutorial.

The fact that I have, and continue, to flesh this game idea out I'm actually considering recruiting a programmer to write it either in C++ or python or both. I have been learning on my own doing it this way. The problem I've had and why I've never started to program is I've never created an idea for myself and worked on it. I didn't want to make something like pacman or tetris or pong I wanted to do something on my own and learn it that way and thats honestly how I learn. Truth is though that the scope I'm creating for this project is indeed beyond me and to get this going in full would take a lot of dedication and time before I even get it moving.

I think if I work as the designer, writing and sort of scripting, story, creating all of the in game things like items, racial abilities, attack types, magic system, that I could hopefully find someone that could help me along with it. No other way to really jump into game design besides, well, jumping into it.

I'll keep myself actively working on anything with the code either by learning through someone or by doing simpler things on my own.

I'll continue to post here if I need any help.

guest509

  • Guest
Re: Python for a Rouge Like RPG
« Reply #6 on: November 16, 2011, 05:18:31 AM »
  Writing something very simple can be a good first dip into programming after learning some basics. But seriously start with something as simple as move around the map and walking over things to destroy them.

  As far as starting a 'Rougelike'...Rouge is the color red. Rogue is the correct spelling. A very common mistake but you may get flamed on it. Interesting to note that Powder got its name because rouge is used to powder a lady's face. Rogue -> Rouge -> Powder.

george

  • Rogueliker
  • ***
  • Posts: 201
  • Karma: +1/-1
    • View Profile
    • Email
Re: Python for a Rouge Like RPG
« Reply #7 on: November 16, 2011, 08:00:24 AM »
I think if I work as the designer, writing and sort of scripting, story, creating all of the in game things like items, racial abilities, attack types, magic system, that I could hopefully find someone that could help me along with it. No other way to really jump into game design besides, well, jumping into it.

I don't want to be negative but I feel like you could use this advice at this point -- unless you have a good friend who's willing to program for you, I think the chance of finding a programmer willing to go the distance with you on a project like this is pretty much zero.

Unless you have something else to bring to the table besides design (art, for example, but then we're not really talking ascii anymore).

You're better off learning how to program and starting simple. If you don't want to program, well there's no shame in that. Don't beat yourself up over not wanting to do something you don't want to do.

At the same time though, remember that programming can be hard, difficult, frustrating -- at first. But it does get easier.
« Last Edit: November 16, 2011, 08:03:43 AM by george »

flags

  • Newcomer
  • Posts: 12
  • Karma: +0/-0
    • View Profile
    • Dev. Blog
Re: Python for a Rouge Like RPG
« Reply #8 on: November 16, 2011, 10:49:40 PM »
I am just going to address the topic directly. I've been developing a roguelike in Python for the past six months. I've went from only knowing a bit about game design/roguelike development to being mildly competent in both areas. I am by no means a genius or programming wizard, so maybe I can speak "on your level" to help you understand some of the finer points of what you're getting into.

Python is great for a lot of different things. Quick scripts to scan log files, neat little programs to speed up boring tasks, etc. Of course, the introduction of things like PyGame have brought the language into a different area of programming that is mostly dominated by people who want to learn a language just to make a game. That's fine, but only to a certain extent.

My experience with Python was pretty traditional and didn't involve games, but I quickly learned about PyGame and went from there. I made all the usual games, like Snake, Pong, and a whole pile of different things, but time passed and I wanted something with more depth. About a year went by and I started creating my first roguelike.

Python can be fast, but it can also be very slow. Unfortunately, learning a language just to make small scripts and games doesn't exactly teach you to optimize much. I was learning at a very fast rate that I had picked up some terrible programming habits from those small scripts where speed didn't matter. Example: If you're crunching a 50-line file even the slowest code will get the job done. It's when that file is a thousand lines long that you notice how slow your code is.

Thanks to this, my first level generator took five seconds to finish. Take note that most generators take less than half a second to finish and crank out sprawling worlds/levels. Mine was making a dozen rooms spread about and struggled on high-end hardware. Scary, and very discouraging. It's a year later and my generator can make potentially hundreds of levels in the same amount of time the old generator took to make a single one. That's just one aspect of the game, though. We've yet to talk about A* or Dijkstra maps yet.

So what's the lesson in all of this? You're not going to make a roguelike in Python unless you're willing to learn how to optimize it. People learn Python because you can jump into it without much prior programming experience, then get confused when their simple Pong clone struggles to render any higher than 20 frames per second. It's a high-level language that needs a bit of taming before it will do what you want at the speed you want.

I'm not trying to discourage you. Your design seems great, but it's going to take quite a large sum of cash to get someone to do all that for you when you could do it yourself for free.

Back to my story: I've been working on a roguelike for quite a long time. It's been a rough experience, but overall a HUGE learning experience. There's been times where I've erased hundreds of lines at once because it was too slow or hard to read after spending a week away from it, and that's usually when I learn the most. I promise you'll do the same multiple times.

And for the past few hours, I've been trying to squeeze every bit of speed I can get out of my Dijkstra map function. Turns out you really, really notice a 0.1 second pause every frame. Yet, from what I've seen, games like Brogue can generate multiple Dijkstra maps each frame without any change in performance. That's not too surprising, considering C is one of the fastest languages out there.

I will link you to my code if you're up for seeing how a Python roguelike works. I will warn you that while the code is in a public repo, it's still very much "hackish" and has remnants of unused code in places, but I'm willing to clean it up if you'd like to take a look.

In summary: A roguelike in Python would be easy to get started, but would be hard to finish. Your mileage may vary.
"What does anyone want but to feel a little more free?" -gy!be

hawk767

  • Newcomer
  • Posts: 3
  • Karma: +0/-0
    • View Profile
    • Email
Re: Python for a Rouge Like RPG
« Reply #9 on: November 19, 2011, 07:07:37 AM »
flags, thanks for the comments.

I've always heard the "start small" comment anytime I've seen someone saying they wanted to start with a project like this. The thing is I understand a lot of the mechanics and some theory of programming through my time learning different language structures and my computer science classes but I've never actually implemented it to learn how it all works together.

I'd really appreciate to see the code for your game if you don't mind.

The only thing holding me back from all of this is the fact that I try to always think creatively, I write a lot, and I've always been sucked in by the story and all that but the programming aspect of games amazes me to no ends. I want to learn to program, if even on an intermediate level, because I'd love to seek out a design job either with an existing company or through making my own games but of course designers have to have other skills other than just writing. Having the ability to do code would be a huge accomplishment for my own person and would help me out greatly in the long run.

So ya, I'd love to see the code. My email is on my profile so you can just email it to me if you'd like.

I appreciate everyone else's comments as well. I do realize that finding a coder to work with me is a long shot especially with the scope this project could possibly take on. I do plan to forge ahead and learn on my own at least for the time being. Something like this could get scrapped half way through once I've created different base systems, like say I can make a combat system or map generation and want to start fresh and implement different ideas or change things up. I still just want my ability to create and design to be at the forefront which is why I think I jumped on the idea of another coder, that way I'd have a good coder on top of my ability to help with whatever needed written, planned out etc.