C
C#8mo ago
Tomy

❔ 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
Jimmacle
Jimmacle8mo ago
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 directly
Angius
Angius8mo ago
Or using a package that makes it easier, should using 3rd party packages be allowed
Tomy
Tomy8mo ago
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#
Jimmacle
Jimmacle8mo ago
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
Tomy
Tomy8mo ago
So print line by line, not process block by block?
Jimmacle
Jimmacle8mo ago
print an entire screen with one Console.Write
Tomy
Tomy8mo ago
ooo, so whole map is 1 print?
Jimmacle
Jimmacle8mo ago
right
Tomy
Tomy8mo ago
Geeeez, gonna be fun to build it But thats a good idea
Angius
Angius8mo ago
The console isn't slow even with really large strings
Tomy
Tomy8mo ago
Thank you soo much
Jimmacle
Jimmacle8mo ago
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
Tomy
Tomy8mo ago
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
Tomy
Tomy8mo ago
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?
Jimmacle
Jimmacle8mo ago
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't
Tomy
Tomy8mo ago
yoo Thats gonna be wild 🔥 Can u give me an example? K = character, # = wall
public static string map1 =
@"
##################
# #
# #
# K #
# #
# #
##################
";
public static string map1 =
@"
##################
# #
# #
# K #
# #
# #
##################
";
I cant get it working :/
class Palya
{
public static string palya1 =
@"
\x1b[31m################\x1b[0m
# #
# #
# \u001B[1m\u001B[33mK\u001B[39m\u001B[22m #
# #
# #
##################";

public static string palya2 =
@"\x1b[36m################\x1b[0m
# #
# #
# #
# #
# #
##################";

public static void PalyaBetoltes()
{
Console.WriteLine("\x1b[36mSzoveg\x1b[0m");
Console.Write(palya1);
}
}
class Palya
{
public static string palya1 =
@"
\x1b[31m################\x1b[0m
# #
# #
# \u001B[1m\u001B[33mK\u001B[39m\u001B[22m #
# #
# #
##################";

public static string palya2 =
@"\x1b[36m################\x1b[0m
# #
# #
# #
# #
# #
##################";

public static void PalyaBetoltes()
{
Console.WriteLine("\x1b[36mSzoveg\x1b[0m");
Console.Write(palya1);
}
}
I might have to look into stringbuilder idk what it is, but it seems like I cant do it with string+writeline
life grinder
life grinder8mo ago
oh boy, you know the casey muratori/molly rocket case, right?
BlyZe
BlyZe8mo ago
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
Accord
Accord8mo ago
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.
Tomy
Tomy8mo ago
._.
Accord
Accord8mo ago
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.
Want results from more Discord servers?
Add your server
More Posts
❔ ✅ Why am I getting error message CS0184?I am trying to compare the return type of a generic method, which produces the following warning. Ho❔ ✅ denary -> binary```cs using System.Data; static void Main(string[] args) { string ans = AddBinary(1, 2); Co❔ Entity framework migration problemI have problem with creating the migration. I get this error "The seed entity for entity type 'AuthoCS00012 The type is defined in an assembly that is not referenced. But that assembly it is referenceOtherwise if I remove that reference I am getting more than 100 errors, the moment I add that refereI need little help trying to make something like that clicks for this game to help me build somethinHello, I can't get this program to click as it jumps i try and try it won't click idk why but my py❔ EFCore Interceptor problemIn the MS documentation I see they're using the SaveChanges interceptor as: ```csharp public async V❔ Is Entity Framework still worth usingIt has been a good 10 years or so since I used EF. From what I recall, it was good for code first an❔ question around testing techniques and ressources for itgood evening everyone i recently started learning more in depth about testing tdd ddd and correspon❔ asp.net core sessions data set lost on refreshguys i have a big problem which i've been trying to solve for the past few days, so i'm using ASP.NE✅ Getting Error 400: Invalid Hostname when trying to access application in Docker containerHello, I have a .net 7 application running inside a Docker container. The .NET application has an en