❔ Console RPG Game
Hello. Im currently in middle school, and our project is to make an RPG game using console. Sadly we cant use Unity or anything like that to make a graphical game. Is there any way to print things faster? Im planning to make a 2D top view game, but rendering the map takes too much time, and its like a CRT monitor, watching the map appear line by line every sec.
21 Replies
it would help to see your current code to get an idea of what might be slow
some things off the top of my head would be minimizing the actual
Console
calls like building up your screen in a buffer beforehand, or dropping down to lower level APIs to manipulate the console buffer directlyOr using a package that makes it easier, should using 3rd party packages be allowed
I dont have a code yet, I'm just planning in my head, but its smt like
map = "##################"
"#AATAAARAAAAATAAAA#
"#AAATAARAAAAATAAAA#
....
A=Air
T=Tree
R=Road
And its getting scaled to screen size
So # = "███"
"███"
"███"
And my graphic processor would be like
if map[i] == "#":
print(...)
Im kinda new to c#
if you don't have anything yet i'd start with building up one large string that you print to the console with one write call
then if that's too slow go from there to find a more optimized solution
So print line by line, not process block by block?
print an entire screen with one
Console.Write
ooo, so whole map is 1 print?
right
Geeeez, gonna be fun to build it
But thats a good idea
The console isn't slow even with really large strings
Thank you soo much
yeah, it's usually best to know something is slow before trying to optimize it
otherwise you might spend time optimizing something that wasn't slow anyway
I had a project and while printing the Fox&Rabbit simulation grid I could see the things appear line by line when the simulation map size was too big
Is there any idea how to process the scaling? Because when
Map = "###"
I cant print
███
███
███
then go back lines and print more characters after it
███ ███
███ ███
███ ███
Also if I want to color the wall gray, and trees green+brown, how can I do it in 1 print?
you can using ANSI escape codes to modify the text style
assuming the terminal you're using supports them, windows terminal should by default but
cmd.exe
doesn'tyoo
Thats gonna be wild 🔥
Can u give me an example?
K = character, # = wall
I cant get it working :/
I might have to look into stringbuilder
idk what it is, but it seems like I cant do it with string+writeline
oh boy, you know the casey muratori/molly rocket case, right?
If you want to use an engine like package you could use this: https://www.nuget.org/packages/ConsoleNexusEngine
ConsoleNexusEngine 2.4.0
A powerful and easy to use engine to create console games
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.._.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.