Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Develop a roguelike from scratch

  1. #1
    Join Date
    Jan 2009
    Location
    UK
    Posts
    122

    Default Develop a roguelike from scratch

    Hi, I am intending to develop a roguelike from scratch in MS VS C++ , unsure of whether to go with a win32 app or console poject but considering I love adom well I would appreciate any advice you can give on getting started, I have read lots of theory but I really need to see an example of say a rougelike gameloop in main, I have ideas and could put something together but I really want to complete something this time hence dont want to just code thrash and end up 3/4 the way through having to do massive re-writes.

    My main hurdle would be how to do AI, and exactly in code how to draw the dungeon on screen?

    All I am interested in at the momment is building a single 4 * 4 dungeon with 1 player and 1 monster, the player and monster have a viewing distance fixed viewing distance, when the moster sees the player the monster attacks.

    So then I have to consider timing of attacks, how is this done?

    I figure also have a player and monster class , player has attributes which I can code later but I just want to set fixed values to start with an see if I can code simplistic combat and ai, basically start small, simple and build incrementally after testing.

    I just compiled and succesfully ran the angband source and after looking at its numerous API hooks etc its made me not so keen to go with a windows32 app

    N.B I have been to roguebasin but I need a barebones piece of code that is well written, clean , small as hell and well commented if possible, plus any advice any of you can give

    I dont want to use LUA or Ncurses so no libraries or scripting languages as I am determined to nail various areas I lacked in coding and I figure a text game is a good way to go, I did write some direct X newbie code away back and bought a directx book which I read lots of, so I understand the complexities involved, I mention this because I in essence crash coursed direct3d however I realise that I need to get so many fundemental concepts nailed that I need to start small and with text only(I also concur that this is no easy option )

    Thanks all!

    Heres a link to another forum post I created, I am just going around the differant communities forr thoughts and ideas as well as trying to pull resources as I want to ty some stuff out tommorow but I need as good a start as I can get to stand a hope in hells chance which is why I am asking

    http://groups.google.co.uk/group/rec...6784f18f7b8a2#

    Just as an "aside" Is there a beta test program for jade or something similiar? Just curious but not wanting to derail the thread
    Last edited by foxfire29; 05-31-2009 at 06:37 PM.

  2. #2
    Join Date
    May 2009
    Posts
    1

    Default

    Hi. It just so happens that I've been doing the same thing. I haven't gotten very far yet, but I more or less have the basic framework done. So far it can draw the map, the pc can move, and there it a vary basic item system. It does use ncurses, but nothing outside of ui.h and ui.cpp uses that (I think), so that should be fixable. Anyway, I attached the source, so feel free to look at it.

    Also, first post from a long time lurker!
    Attached Files Attached Files

  3. #3

    Default

    Quote Originally Posted by foxfire29 View Post
    So then I have to consider timing of attacks, how is this done?

    I figure also have a player and monster class , player has attributes which I can code later but I just want to set fixed values to start with an see if I can code simplistic combat and ai, basically start small, simple and build incrementally after testing.
    just some quick and dirty comments on these 2

    a) for starters it might be the simplest to just go "your turn - my turn" just loop through all critters on the map

    wich leads us directly to 2:
    seperating monsters from players is very rarely done these days. The player is a monster, that just happens to listen to keyboard input instead of AI.
    If you don't do that you need to do several things twice.
    For exampe You would have a routine player_attack_monster and one monster_attack_player
    If both are the same you just have one routine attack(att,def)

    Good luck with your project!

  4. #4
    Join Date
    Mar 2008
    Location
    Kentucky
    Posts
    5,067

    Default

    "Whip me!" pleads the adom player. The rng replies... "No."

  5. #5
    Join Date
    Apr 2008
    Posts
    21

    Default

    To be perfectly honest, QuickHack is not a good example to look at. More than likely, you are going to want to look into more "mainstream" and recent games. Remember that any 2D game tutorials can be translated into writing a roguelike. If anything, often the more modern tutorials will do you better than the same ten year old roguelike tutorials, as event-based architecture and OOP is much more developed and available this day.

    Roguelikes that use the Curses/NCurses/PDCurses libraries are a huge waste of time due to certain limitations. For instance, curses can't "Shift" the display like you can using a backbuffered graphical drawing method.

    Modern roguelikes are more often being written in C++ using an OpenGL rendering system. They run faster on modern computers due to certain rendering tricks like partial printing, and only-on-need updates.

    This is why Biskup's roguelikes suffer/benefit from nostalgia or "old design". One-screen dungeons aren't a bad thing, but frankly, it's a little outdated. JADE, however, seems to not have this problem, as it most certainly does not use CURSES to render things.

  6. #6
    Join Date
    Mar 2008
    Location
    London, England
    Posts
    5,014

    Default

    Quote Originally Posted by Ter13 View Post
    Modern roguelikes are more often being written in C++ using an OpenGL rendering system. They run faster on modern computers due to certain rendering tricks like partial printing, and only-on-need updates.
    I'd like to hear of one roguelike that uses OpenGL... (Okay, so I know a couple, but they're extremely rare - curses is still the primary library of choice for roguelike display, with perhaps jice's libtcod threatening to overtake it.)
    Platinum Edition ADOMer
    http://gamesofgrey.com - check out my roguelikes!

  7. #7
    Join Date
    Mar 2008
    Location
    Esslingen, Germany
    Posts
    3,973

    Default

    Dwarf Fortress uses OpenGL.
    ADOM Guides - whatever you wanted to know about playing a certain class, but have been afraid to ask!

    Check out my youtube channel to see my ADOM videos, including a completed playthrough of the game. I try to give instructions, so if you want to see some place you haven't been before and get some hints on how to deal with it, this might help! There's also some other games featured there that you might find interesting.

  8. #8
    Join Date
    Mar 2008
    Location
    Somewhere out there...
    Posts
    361

    Default

    As far as I know, Dwarf fortress isn't really possible for blind people to play.

  9. #9
    Join Date
    Jan 2009
    Location
    UK
    Posts
    122

    Default

    Hi Thanks for all these reponses and the feedback, I was doing okay until I decided I wasnt going to have a static map and that I would randomly generate areas, suffice to say I only got a little way with that and randomly generated stuff is much harder then it sounds

    Im about to start workimng on it again which is one of the reasons Im luking/posting again

    Thanks all

    P.S I did read about ncurses but I figured if I go with c or c++ all the way then whatever I learn from the roguelike well because of the nature of C these skills are transferable, ncurses gets a good name from what I have read about it.

    Prior to doing my roguelike I ended up doing some research on things like template classes ; I have used classes, inheritance, polymorphism in past programs and all that jazz lol but I hadnt used template classes, looking at various roguelikes source code I saw extensive use of such things so I kinda got bogged down learning this stuff and I initially decided to set myself an exersise as follows:

    Read a random map into an array so you have say lots of ####### for walls ,
    Next draw random squares, and make then all join until they exactly fill up the screen width and height

    So like

    Code:
    ######################                
    #                ##                      #
    #####################
    As you can see thats like two rooms perfectly aligned, I wanted to do this all over the screen and near the edges of the screen if the random numbers for length and breadth didnt fit itb would roll another squares dimensions until one did fit, got so far and granted this system would not work for a roguelike but I figured it was a good excersise
    Last edited by foxfire29; 08-04-2009 at 06:19 PM.

  10. #10
    Join Date
    Mar 2008
    Posts
    109

    Default

    Quote Originally Posted by Ter13 View Post
    To be perfectly honest, QuickHack is not a good example to look at. More than likely, you are going to want to look into more "mainstream" and recent games. Remember that any 2D game tutorials can be translated into writing a roguelike. If anything, often the more modern tutorials will do you better than the same ten year old roguelike tutorials, as event-based architecture and OOP is much more developed and available this day.

    Roguelikes that use the Curses/NCurses/PDCurses libraries are a huge waste of time due to certain limitations. For instance, curses can't "Shift" the display like you can using a backbuffered graphical drawing method.

    Modern roguelikes are more often being written in C++ using an OpenGL rendering system. They run faster on modern computers due to certain rendering tricks like partial printing, and only-on-need updates.

    This is why Biskup's roguelikes suffer/benefit from nostalgia or "old design". One-screen dungeons aren't a bad thing, but frankly, it's a little outdated. JADE, however, seems to not have this problem, as it most certainly does not use CURSES to render things.
    Does this mean that I should use C++ instead of C for programming a Rogue-like game? Because I've got some code for one I was trying to make and it's all in C. And can one use OpenGL even without "graphical" tiles (but just "ASCII"-like characters)? And do those rendering tricks require additional programming? If so, where could I find out more about doing them?

    Also, how and where could I find out more about how to use this "event based architecture", esp. in the context of a Rogue-like game?
    Last edited by mike3; 08-18-2009 at 11:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •