Archived

This topic is now archived and is closed to further replies.

Text Based Map Question

This topic is 5044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heyas, I am making a little NetHack type game. It is fairly simple so far. I have it to the point where you can move around and change rooms, however I noticed that on my computer(AthlonXP 1900) I can see it flicker some times and on my parent''s older computer(P2 400) it is very noticable. However, in NetHack you do not see a flicker at all when you move about the map. I was wondering how this is done? I know I could make something a little better if I chose to go with one of the graphics APIs, however I want to finish going through my book(C++ Primer) before I attempt to tackle one of the APIs, so right now I would like to stick with just the console. I do not think this would be much of a problem, as NetHack runs like a console app. Some ideas on this would be nice. However, if there is no way to do this fairly easily, that is OK too, I just thought it would look a little better if the the program didn''t flicker with every move. Thanks, Chris

Share this post


Link to post
Share on other sites
In nethack only the characters that have changed since the last redraw are changed. You''re probably doing something like clearing the screen and redrawing everything, and if you''re not, probably going to the next line via a newline character is clearing that line, making it flicker.

Share this post


Link to post
Share on other sites
Well, it probably would have helped had I shown some of my code as to how I did it. I don''t know why, but I didn''t think of that in my first post.

I have a 10x10 char array that I use as the ''board''. To display this array, I have a function that does

cout << cBoard[0][0] << cBoard[0][1] << and so on...

I call that after the player moves, and I do have it clearing the screen after every move, otherwise you still see the bottom of the last map at the top of the console screen.

How would I go about having just the tiles that change update witout having to call that Display function after every move, and redraw the entire map?

Thanks,
Chris

Share this post


Link to post
Share on other sites
dont bother making a multi demnsioanl array, make a single demension array the size of [map width * mapheight]

to access a specific point in the screen, its index is x + (y * mapwidth) . that way when you display it to the screen all of it is shown at once.....go to www.gametutorials.com i got that info from one of their tutorials

Share this post


Link to post
Share on other sites
Ever heard of curses? It is a library of console text manipulation routines buildable in various forms on just about every platform you can imagine, and used by many roguelikes for handling the display. You can try PDCurses for Windows.


Golem
Blender--The Gimp--Python--Lua--SDL
Nethack--Crawl--ADOM--Angband--Dungeondweller

Share this post


Link to post
Share on other sites