I am trying to make a simple console (ASCII) game |
There's your first problem. Get SFML and just make a graphic game. It's easier.
when I try to print out characters in ascii, I just get a bunch of weird random stuff on the screen when i try to compile it. |
You are not printing ASCII. You are trying to print extended characters that are outside of ASCII. This is notoriously difficult on windows.
This depends on 2 things:
1) The way your cpp file is being saved
2) The way your console is accepting text output
To put it simply... characters are really numbers. Each number represents a different character. Which number represents which character depends on how the text is
encoded. In one encoding one number might be a different character than in another encoding.
ASCII is pretty much standard and uniform everywhere. But it only covers the basic English alphabet and a few common symbols (anything on a US keyboard is ASCII... the extra "box" characters you are using are not)
What is probably happening is your source code is being saved as UTF-8... but when that UTF-8 text is being sent to the console... the console is interpretting it as Extended-ASCII... which is why you are getting garbage.
Your file and the console must be encoded the same way.
So you have 2 options here:
1) Change the console encoding to match your source code (This can theoretically be done on Windows with SetConsoleCodePage... though I have
never gotten it to work properly -- and it's not portable anyway)
or
2) Change your text to match whatever encoding scheme is used by your console. However this is also problematic because different people might be using different encoding schemes. So even if you get it working on your computer... if you give the program to someone else it might not work on theirs.
...or
3) Don't try to make a game in the console. It's retarded.