The biggest project I've worked on: ASCIIpOrtal

This is a discussion on The biggest project I've worked on: ASCIIpOrtal within the Projects and Job Recruitment forums, part of the Community Boards category; I don't drop in as much as I once did... which wasn't much. But I wanted to plug my current ...

  1. #1
    Registered User guesst's Avatar
    Join Date
    Feb 2008
    Location
    Lehi, UT
    Posts
    179

    The biggest project I've worked on: ASCIIpOrtal

    I don't drop in as much as I once did... which wasn't much. But I wanted to plug my current project which I just got to what I'm calling my final public beta. It's called ASCIIpOrtal. It's Portal, in ASCII. I'm using the PDCurses library and hope to integrate sound with SDL, tho I've never done that so hopefully it'll work. If anyone has any experience with this, let me know.

    Meanwhile, you can get more information here as well as downloading the source and windows binaries:

    ASCIIPortal development
    Type-ins are back! Visit Cymon's Games at http://www.cymonsgames.com for a new game every week!

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    My only suggestion is to use SDL_mixer if you want to use sound with the SDL. (But you probably were going to anyway.)

    Good luck, looks good so far! (I might have feedback once I get it working on my machine . . . .)
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User guesst's Avatar
    Join Date
    Feb 2008
    Location
    Lehi, UT
    Posts
    179
    IIRC your system was Linux. Lemme know if you needed to do anything to get it running. You know me, I like to think that I'm being cross-platform compatible.
    Type-ins are back! Visit Cymon's Games at http://www.cymonsgames.com for a new game every week!

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    You do indeed recall my system correctly. With some minor modifications, I got the code to compile. I eliminated some warnings, but didn't try to get rid of the signed/unsigned mismatch ones since there were so many -- enable compiler warnings!

    Anyway, changes required for Linux compliation:
    Code:
    $ diff original/main.cpp main.cpp
    8a9
    > #include <cstdlib>  // added by DWK
    112c113
    <             check++);
    ---
    >             check++) ;
    231c232
    < int fireportal (int por, int pl) {
    ---
    > void fireportal (int por, int pl) {
    419c420
    <         case BOULDER:
    ---
    >         case BOULDER: {
    445a447
    >         }
    488c490
    <   int player;
    ---
    >   int player = 0;
    491c493
    <
    ---
    >
    538c540
    <     name = mappack + "\\" + mappack + num.str() + ".txt";
    ---
    >     name = mappack + "/" + mappack + num.str() + ".txt";
    $
    <cstdlib> is for some function you were using (rand()? Can't remember) which was in that header file. I set player to zero because it was uninitialized (look at the code carefully and you'll see why). The backslash had to become a slash to work on Linux, of course. Oh, and I put curly braces around that case block to avoid nasty warnings that result when you declare a variable in a switch statement without wrapping it in curly braces. (If via a case label you jump to a point after the variable was declared, the variable gets allocated, but it doesn't get initialized!)

    Oh, and it seems fireportal() should return void, not int (since you never actually return anything, nor use the return value).

    The graphics are really messed up under Linux (perhaps you use extended ASCII characters or something). See attached image. I broke down and ran the Windows executable, but once I had, I can understand what the symbols mean, sort of, and play the Linux version.

    Anyway, I must say I'm very impressed by this program! If you want me to port a version to Linux, I'd be happy to. Just give me a shout.

    Also, some minor suggestions:
    • Use version control and multiple source files. Really, it will probably make your life easier.
    • moveplayer() can make use of tolower()/toupper(), e.g.
      Code:
      if(input & 0xff == 0) input = tolower(input);
      Just because it's not a char doesn't mean you can't use those functions.


    I look forward to the implementation of portals.

    [edit] I should mention that the output looks much more palatable on full-screen terminals (which seem to support extended ASCII characters), but I can't really take a screenshot of that. [/edit]
    Attached Images Attached Images  
    Last edited by dwks; 06-19-2009 at 11:22 AM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,660
    Moved to Projects and Job Recruitment forum.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User guesst's Avatar
    Join Date
    Feb 2008
    Location
    Lehi, UT
    Posts
    179
    Quote Originally Posted by dwks View Post
    You do indeed recall my system correctly. With some minor modifications, I got the code to compile. I eliminated some warnings, but didn't try to get rid of the signed/unsigned mismatch ones since there were so many -- enable compiler warnings!
    Oh, they're on. I see 'em. but I got tired of trying to nail every one of them down every time I'd take a variable and compare it to size(). I need the XY to be unsigned for bounds checking. So meh.

    Anyway, changes required for Linux compliation:
    Code:
    Snip
    Thank you thank you thank you.

    The graphics are really messed up under Linux (perhaps you use extended ASCII characters or something).
    Yes, and hopefully when I add STL I'll be using that to do the text so that I can control the font and use a square one, so it should fix it.

    [edit] I should mention that the output looks much more palatable on full-screen terminals (which seem to support extended ASCII characters), but I can't really take a screenshot of that. [/edit]
    We'll call that a solution for now.

    Anyway, I must say I'm very impressed by this program! If you want me to port a version to Linux, I'd be happy to. Just give me a shout.
    SHOUT!

    Also, some minor suggestions:
    [list][*]Use version control and multiple source files. Really, it will probably make your life easier.
    Hmm, I should. for now I'm relying on these releases being my save points. And good thing too because I screwed things up in the most recent changes. Plus I'm using Dropbox, so that's got version control for me.

    But I definitely want to get in touch with you. You helped so much with Alleytris.
    Type-ins are back! Visit Cymon's Games at http://www.cymonsgames.com for a new game every week!

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Quote Originally Posted by guesst View Post
    Oh, they're on. I see 'em. but I got tired of trying to nail every one of them down every time I'd take a variable and compare it to size(). I need the XY to be unsigned for bounds checking. So meh.
    Yeah, well, if you're intentionally ignoring them then consider using the GCC flag to ignore that particular warning, so that other warnings show up more easily. I often use -Wno-unused-parameter, for example, because I don't care about unused parameter warnings.

    Unfortunately in this case the flag looks like -Wno-conversion, which warns you about other stuff too. Oh well. Never mind.

    SHOUT!
    LOL! See below.

    Hmm, I should. for now I'm relying on these releases being my save points. And good thing too because I screwed things up in the most recent changes. Plus I'm using Dropbox, so that's got version control for me.
    Well, that's certainly better than nothing. By the way, if you don't want to use version control, at least consider using my "dup" program (source attached). Type "dup codeform.c" for example and it will make codeform_0.c, unless that exists, in which case it will create codeform_1.c, etc. It's useful for primitive version control, and believe me, if making a backup is as simple as that one command, you'll do it more often.

    But I definitely want to get in touch with you. You helped so much with Alleytris.
    Well, my first post helped (though it did make you stay up rather late), and my second post didn't. 50% help rate isn't too bad though!

    Just send me a PM if you want code written/refactored/ported/criticized/whatever. I might make maps too if asked nicely!

    Anyway, as my first official task, I've attached an archive containing compiled 32- and 64-bit linux executables. (I hope you're grateful for the 32-bit one; I had to install ncurses on my chroot, an extremely laborious process which took at least twenty five seconds. </sarcasm>)

    Also, there are a few more warnings caught by my chroot compiler . . . .
    Code:
    $ g++ main.cpp -o asciiportal -lncurses
    main.cpp: In function 'XY rotchar(int, XY, XY, XY)':
    main.cpp:75: warning: converting to 'int' from 'double'
    main.cpp:76: warning: converting to 'int' from 'double'
    main.cpp: In function 'int hitswall(double, double)':
    main.cpp:149: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]'
    main.cpp:149: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = int, _Alloc = std::allocator<int>]'
    main.cpp:157: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]'
    main.cpp:157: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = int, _Alloc = std::allocator<int>]'
    main.cpp: In function 'void play()':
    main.cpp:505: warning: passing 'double' for argument 1 to 'int napms(int)'
    dwk@cypress:~/c$ g++ -W -Wall -ansi -pedantic main.cpp -o asciiportal -lncurses
    main.cpp: In function 'XY rotchar(int, XY, XY, XY)':
    main.cpp:75: warning: converting to 'int' from 'double'
    main.cpp:76: warning: converting to 'int' from 'double'
    main.cpp: In function 'int hitswall(double, double)':
    main.cpp:149: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]'
    main.cpp:149: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = int, _Alloc = std::allocator<int>]'
    main.cpp:157: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]'
    main.cpp:157: warning: passing 'double' for argument 1 to 'typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::reference std::vector<_Tp, _Alloc>::operator[](size_t) [with _Tp = int, _Alloc = std::allocator<int>]'
    main.cpp: In function 'int hitsobj(int, double, double)':
    main.cpp:163: warning: comparison between signed and unsigned integer expressions
    main.cpp: In function 'int still_alive(int)':
    main.cpp:172: warning: comparison between signed and unsigned integer expressions
    main.cpp: In function 'void draw_screen(int)':
    main.cpp:193: warning: comparison between signed and unsigned integer expressions
    main.cpp:194: warning: comparison between signed and unsigned integer expressions
    main.cpp: In function 'void fireportal(int, int)':
    main.cpp:233: warning: comparison between signed and unsigned integer expressions
    main.cpp: In function 'int move_objects()':
    main.cpp:334: warning: comparison between signed and unsigned integer expressions
    main.cpp:335: warning: comparison between signed and unsigned integer expressions
    main.cpp:337: warning: comparison between signed and unsigned integer expressions
    main.cpp: In function 'void play()':
    main.cpp:505: warning: passing 'double' for argument 1 to 'int napms(int)'
    $
    In case you're interested.

    Talk to you later!
    Attached Files Attached Files
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #8
    Registered User guesst's Avatar
    Join Date
    Feb 2008
    Location
    Lehi, UT
    Posts
    179
    Hey, DWKS, or anyone else, how well does SDL code mix with Linux? Does it remain pretty cross compatible? Are there any special considerations I need to be aware of?

    Portals are implemented, in fact all features I want are implemented. However, in nailing down bugs I ended up breaking and rewriting swaths of the code. What I've rewritten is much easier to follow, which is good because _I_ was getting lost.

    If you'd like to see an earlier build that had portals implemented, check it out:
    Bytejacker - The Gamerdrome - ASCIIpOrtal Update 2

    DWKS, I'll be contacting you with the updated code tonight.
    Type-ins are back! Visit Cymon's Games at http://www.cymonsgames.com for a new game every week!

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    SDL code mixes really well with Linux. And you don't have to put any platform-specific code in at all (though you sometimes do for Windows, depending on your compiler).

    As I mentioned in my email to you, I'm pretty busy right now but I'll definitely have a look at this by Thursday, perhaps even tomorrow if I can.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  10. #10
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I would suggest abstracting SDL also, since you'll only ever use a handful of SDL stuff. It means that when you want to change frameworks, you can very easily.

    Although I tend to use, SDL just for input/windowing & texture loading. Then OpenGL for drawing, and FTGL for fonts. It's certainly true that SDL is a "Jack of all trades, master of none".

  11. #11
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by zacs7 View Post
    I would suggest abstracting SDL also, since you'll only ever use a handful of SDL stuff. It means that when you want to change frameworks, you can very easily.
    You're going to abstract an abstraction layer?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  12. #12
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    Quote Originally Posted by brewbuck View Post
    You're going to abstract an abstraction layer?
    that's done all the time...
    I guess people just get complicated about making something simple...
    Currently research OpenGL

  13. #13
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    I do that all of the time . . . nearly all of my SDL projects have a wrapper around it. Some of them are good ones which let me drop in other libraries like the SGE instead of SDL_gfx (i.e., xuni and mundus's wrappers). Some of them are really simplistic 200-line ones (like collision's). It makes your life easier, especially if you decide to use a different library at some point.

    (I especially like writing nice wrappers for XML libraries. xuni originally used expat but I easily added minixml support; callis originally used minixml until I got tired of it and wrote my own XML parser instead. )

    Anyway, contrary to my assertion, I did have a look at ASCIIp0rtal today. I made a few changes, compiled it on Linux, and spent a rather long time playing it. I've attached a git diff log (read it from bottom up), a full diff of my changes, a compiled 64-bit executable, a compiled 32-bit executable, and a program of mine you may be interested in.

    I didn't attach the full updated code with the git repository, since I'm not sure if you want the code to be public yet. I did however email this to you.

    Anyway, here's the contents of the file dwk-notes.txt. It doesn't cover everything I did, but it's a good place to start.

    - Consider open sourcing ASCIIp0rtal. Seriously. See below.
    - I don't like spaces in file names . . . but if you do then that's fine.
    - Consider word-wrapping the help documents (probably to 80 characters). If you
    want this but don't feel like doing it, I could run the "fmt" Linux command
    on them which word-wraps automatically.

    Changes I've made to the code:
    - You had a #ifdef LINUX wrapper around the "\\" code, and I'm assuming you
    intended to change it to a "/" but never got around to it. Anyway, I added
    platform.h with a DIR_SEP definition which is either "/" or "\\" depending on
    the platform. It's easier to check for Windows and default to "/", since
    Windows has a standard define (WIN32) and UNIX, Linux, and Mac all work with
    "/". I admit to using string literal concatenation in main()'s help message.


    Broader suggestions:
    - Create map "scenarios". So if you ask ASCIIp0rtal to run the "original"
    scenario, it would open maps/original001.txt, then maps/original002.txt,
    etc. This makes it even easier for other people to create maps.
    (You could even scan the maps/ directory to see which scenarios there are.)

    Anyway, about open source -- I really really hope you're planning to make this open source. Because if you are then I'll probably contribute even more to it. I was thinking of using my 2D SDL game engine, callis, to write an image-graphical interface for it. I like it that much. I probably wouldn't do this if it wasn't open source though. I don't mind if you want to keep it sequestered from the world until making a 1.0.0 release with a bang -- that's fine as long as it's open source in the end. I wouldn't think you'd mind, since the code for most of your programs seems to be posted on your website -- but I thought I'd put in the request anyway.

    So . . . yeah. A description of the attached/mentioned files:
    - diff-2.txt: diff with log messages (read from bottom to top)
    - diff-2-full.txt: full diff; your beta1 version to my final modified version
    - beta1-dwk-2-binary.zip (get rid of the .txt): Linux 32-bit (Debian stable) and Linux 64-bit (Debian testing) executables (normal, neither stripped nor debug ones)
    - quaeris.zip: the very beginnings of a rogue-like I wrote in ncurses three years ago. Not too interesting, but I thought you might be interested in its line-of-sight code. Can't even remember how I did it, but I know I got the algorithm from Dungeondweller - www.roguelikedevelopment.org. Fantastic site, that.
    - and see your email for the full source archive.

    [It seems that quaeris.zip is too big to attach -- I've uploaded it to here: http://dwks.theprogrammingsite.com/m...wn/quaeris.zip

    "quaeris", by the way, is Latin for "you seek"; since it was supposed to be a role-playing game, I thought the name appropriate.]

    As you'll see, I really didn't change the [ASCIIp0rtal] code much. I didn't look too closely at it this time. I did note however that you could make use of temporary variables to make some lines shorter. Oh, and if you wanted to foray into object-oriented programming you could try to create a method which would determine whether a point lay within a bounding box, and other operations like that which you use a few times.

    Keep up the great work!

    -- DWK
    Attached Files Attached Files
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  14. #14
    Registered User guesst's Avatar
    Join Date
    Feb 2008
    Location
    Lehi, UT
    Posts
    179
    The only reason I don't want to release the sourcecode of the current build publicly is I don't want folks getting frustrated with the lack of user-friendlyness in the game because it's unfinished. But when I finally release 1.0 I will include the source and, if you all would like I'll make a note of it here.

    Tho it seems DWKS is the only one that's interested.

    I wonder why it's necessary to include a whole new header for compatibility when it'll only affect a single line? Seems like using a flamethrower to light a cigarette. Okay, maybe not that extreme, but still.

    As for abstracting the SDL properties... I'm probably not going to worry about that since every platform I'd like to develop for use the same SDL functions.
    Type-ins are back! Visit Cymon's Games at http://www.cymonsgames.com for a new game every week!

  15. #15
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,231
    Actually, I think it is pretty cute and looks very playable, but until you have a version with actual portals I don't see a reason to comment.

    Soma

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Your biggest project: how many lines have you written?
    By happyclown in forum A Brief History of Cprogramming.com
    Replies: 44
    Last Post: 04-29-2009, 07:30 AM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  3. Dynamic Binding
    By gpr1me in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2006, 08:01 AM
  4. MFC in an empty project
    By cunnus88 in forum Windows Programming
    Replies: 0
    Last Post: 10-09-2005, 09:19 AM
  5. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21