Official Codex Discord Server

  1. Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.
    Dismiss Notice

Banana Rogue

Discussion in 'Codex Workshop' started by Krice, Mar 17, 2019.

  1. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    I found an old source code for Advanced Rogue from 1985 and began to rewrite it for a modern compiler. Most work comes from changing old C function "list" parameter style to "new" style with parameters inside parentheses, but there are some surprising finds also. One of them is 'when' keyword used in some switch - cases as some kind of optional case-keyword. It could be some kind of old keyword even internet doesn't remember, because I didn't find any information about it. As if it never was a C keyword. Maybe the source code itself is from a parallel universe and it just slipped here for some reason? The name Banana Rogue is a project name, because you have to give the derived project some other name than 'Advanced'.
     
    • Informative Informative x 4
    • cool story bro cool story bro x 1
    • Interesting Interesting x 1
    ^ Top  
  2. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    That 'when' was just a macro that combined break;case so there is no need to write break. I think those macros are going to be removed, at least that one. This kind of project is almost fun compared to working with a project that requires content. For example I've been mostly fine tuning the source code structure in my roguelike project Teemu, because it's pesky to add/fix missing content.
     
    • Thanks! Thanks! x 1
    • Informative Informative x 1
    • When words are not enough When words are not enough x 1
    ^ Top  
  3. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    One of the strange things is that there are no header files for most c files and functions. It must have been somehow possible to call functions without declaring them first. Rogue.h has some declarations in form of function name without any parameters the actual function has. Most of the work this far has been recreating header files for each c file. Great fun.

    I think this kind of source code archaeology is nice, because if you know enough about programming you can understand the decisions programmers made back then, when they didn't know concepts like data-driven or OOP. Procedural code with global access to lots of stuff also underlines the difference to OOP which is the style I'm using in my own projects. I'm too old to "fight" about paradigms, in fact both styles have their pros and cons. The "distribution" of complexity is also interesting, because these old roguelikes didn't care a lot about dungeon generation, there are like only couple of functions for that where in my lightweight roguelike Teemu there are 11 .cpp files with more than 20 classes for level generation routines.
     
    • Informative Informative x 1
    ^ Top  
  4. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    Something weird is happening with Code::Blocks (or more like gcc). I guess it thinks the source files are C, even the project was created as C++ project. I need to check it with Visual Studio. I'm planning to replace curses with SDL2, because it's the library I'm using in my other projects. It's possible to keep the old functions and hide SDL2 in the implementation, so if someone wants to replace SDL2 later it will be relatively easy.
     
    • Thanks! Thanks! x 1
    • Informative Informative x 1
    ^ Top  
  5. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    Much easier to work with Visual Studio, because it's showing errors as red dots in the side scroll bar thingy. Most files are just a continuous red line... But most of the errors are missing header files and things like TRUE, FALSE and NULL which need to be replaced. There are some harder problems like function pointers. I never used them myself, but I think they could be fixed with same type of function signature.
     
    ^ Top  
  6. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    Most missing functions are part of curses. I think there are some functions that are not needed as such like clearok and touchwin, but to get things work it's better just write empty functions for those and see what happens. I'm not sure if you need clearok, it seems to clear a window. It may be useful. Some routines seem to add a character without x, y location (or y, x as it in this game) so each window has a cursor location. This is actually how I'm doing it in my projects as well even they are graphical. It's easy to have a cursor and when you add some text or letters you don't have to pass location every time.
     
    • Informative Informative x 1
    ^ Top  
  7. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    The function pointer "thing" in daemon is interesting, because you can't force it through C++. It has an object (struct) which has data for function pointer etc. The parameter data is int, but none of the functions have int parameters. Most functions have no parameters passed, but there just had to be two that has one parameter (not int). I guess C allows the parameter list of function pointer to be whatever you want, but in C++ everything has to match. To make things worse, those structs are stored in a list (there are two lists). It's not impossible to fix, nothing is, but it's going to be a bit pesky at least.
     
    • Informative Informative x 1
    ^ Top  
  8. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    12 files (of total 38) compile, there would be more but rip.h has an array with LINELEN size which isn't defined there. I'm probably going to replace that struct's hard arrays with std::strings. It would be really useful in many places, but the first priority is get this to compile and run. Function pointers are making me crazy, the "option" module has also those. And on top of that option has get_str which I think is used to input a string, but it's also storing something to option data?
     
    ^ Top  
  9. Krice Educated

    Infinitron
    Joined:
    May 29, 2010
    Messages:
    70
    I think this project failed, because I stopped at those function pointers. The problem is that C++ can't handle them, because 'void' in C can take random number of parameters! It's crazy how it works. I could actually stuff this one to github, although I rage deleted github for Visual Studio because it reset project files in one of my other projects. But you could exclude project files from repository and possibly keep it together. You can of course remove all function pointers and replace them with something else, but it's quite a task.
     
    ^ Top  
  10. Bester Arcane Patron Vatnik

    Infinitron
    Joined:
    Sep 28, 2014
    Messages:
    5,375
    Upload it to a repo.

    Who made this game, was it even ever released?
     
    ^ Top  

(buying stuff via the above buttons helps us pay the hosting bills, thanks!)