views:

184

answers:

2

My basic goal here is writing a .NET remake of Kingdom of Kroz. For those not familiar with the game:

http://www.indiefaqs.com/index.php/Kingdom_of_Kroz

http://www.youtube.com/watch?v=cHwlNAFXpIw

Originally it was supposed to be a quick distraction project to give me a break from all the generic enterprise WCF/WF/LINQ2SQL/etc work projects occupying most of my time lately. While the result of my effort is playable, it looks like absolute arse (even for a console-based game) because of the way I'm redrawing everything in each frame.

I'm aware of some alternate approaches but in the brief tests I've done they still don't offer significant performance or aesthetic benefits. I almost can't believe I'm asking this, but... does anyone know of a fast and efficient "console graphics" library for VB.Net / C#?


Edit: failing the availability of a "library" as such, perhaps there's a reference for fast console drawing/update techniques?

+4  A: 

You could try Curses-Sharp http://sourceforge.net/projects/curses-sharp/ or libtcod http://doryen.eptalys.net/libtcod/

curses-sharp is a "A full featured, object-oriented, multi-platform C# wrapper for the curses terminal control library. "

and libtcod is "...a free, fast, portable and uncomplicated API for roguelike developpers providing an advanced true color console, input, and lots of other utilities frequently used in roguelikes."

Vili
As far as I can tell the former doesn't work with the standard console and the latter isn't even .Net at all.
FerretallicA
Did you actually check it out? http://doryen.eptalys.net/2010/08/libtcod-1-5-1b1-released/ You can get the Windows/Linux32/OSX C# version in the download section
Vili
I did but as far as I could tell it was just a C++ library using SDL / OpenGL to simulate a console, and the C# part is just a wrapper around that. I ideally want to use (and/or extend) the standard .Net console.
FerretallicA
Still +1 for the suggestions.
FerretallicA
Yes it's a wrapper, but I still would suggest that the libtcod is best way to get console-like application. It is used in several roguelike games which are classic ascii-based games just like Kingdom of Kroz.
Vili
For speed and control, you won't achieve what you want without 1) this library or 2) API calls to the console (http://www.tomshardware.co.uk/forum/65918-25-technique-fast-win32-console-drawing) which would just complicate it. Functionality wise, you might need to write your own wrapper.
Wez
@FerretallicA Are you talking about the "standard .NET console" as System.Console? Curses-Sharp works with the standard console output, but once you start creating things like panels and windows System.Console becomes a major pain point.
Agent_9191
+1  A: 

http://msdn.microsoft.com/en-us/library/ms682073(v=VS.85).aspx

Some/many of these functions you might need to use P/Invoke for, but they should do what you need. You can write at arbitrary locations in the buffer and get key-based, non-buffered input. Usually you start with GetStdHandle() to get handles to the console input and output "streams" and then you call one of the appropriate functions from the above list to do something, like WriteConsoleOutputCharacter(), or PeekConsoleInput().

I once wrote a library to create an in-process windowing system using the Windows console and plain Win32 on C. Fun project, but I don't know where it is now.

siride
It's not quite what I was after but enough to get me started writing my own wrapper for it without much hard work so thanks!
FerretallicA
Unfortunately, that's what you have to use to do console "graphics" on Windows.
siride