Skip to main content
added 162 characters in body
Source Link
Davislor
  • 9.2k
  • 19
  • 39

On many systems even today, you can also insert ANSI color codes (16 colors, foreground and background, and some special features like bold and underline, like in the late 8-bit or early 16-bit era, and exactly like classic Unix terminals over telnet) or xterm color (more than 200). Can’t get more authentically retro than that. The Linux console supports those codes natively, and I think the OSX terminal does too. ETA: And so does Windows, through a non-standard API.

On many systems even today, you can also insert ANSI color codes (16 colors, foreground and background, and some special features like bold and underline, like in the late 8-bit or early 16-bit era, and exactly like classic Unix terminals over telnet) or xterm color (more than 200). Can’t get more authentically retro than that. The Linux console supports those codes natively, and I think the OSX terminal does too.

On many systems even today, you can also insert ANSI color codes (16 colors, foreground and background, and some special features like bold and underline, like in the late 8-bit or early 16-bit era, and exactly like classic Unix terminals over telnet) or xterm color (more than 200). Can’t get more authentically retro than that. The Linux console supports those codes natively, and I think the OSX terminal does too. ETA: And so does Windows, through a non-standard API.

edited body
Source Link
Davislor
  • 9.2k
  • 19
  • 39

I want to repeat and emphasize the advice to separate the data from the display code. You want code orthogonal to your game data. You shouldn’t be rewriting the display code for every kind of monster, because that makes it a nightmare to ever change. Don’t repeat yourself! That also makes it possible for you to do a lot more things with your data or run your code on arbitrary new datedata.

I want to repeat and emphasize the advice to separate the data from the display code. You want code orthogonal to your game data. You shouldn’t be rewriting the display code for every kind of monster, because that makes it a nightmare to ever change. Don’t repeat yourself! That also makes it possible for you to do a lot more things with your data or run your code on arbitrary new date.

I want to repeat and emphasize the advice to separate the data from the display code. You want code orthogonal to your game data. You shouldn’t be rewriting the display code for every kind of monster, because that makes it a nightmare to ever change. Don’t repeat yourself! That also makes it possible for you to do a lot more things with your data or run your code on arbitrary new data.

Deleted hypercorrection based on my misreading.
Source Link
Davislor
  • 9.2k
  • 19
  • 39

The portable ways to write a multiline string literal include

"Line 1\n"
"Line 2\n";

and (uglier, not allowing leading spaces, but there for backward compatibility with C):

"Line 1\n\
Line 2\n";

However, inIn this case, you might consider storing your ASCII art as vectors of rows. (Since two-dimensional array can mean a few different things, a good unambiguous name for this is a rectangular array.) This would make it possible to, for example, display a picture of the monster in a box and wrap an infodump around it, or show its stats on the left or right of the picture, or overlay a caption like "-999 HP" on the frame.

The portable ways to write a multiline string literal include

"Line 1\n"
"Line 2\n";

and (uglier, not allowing leading spaces, but there for backward compatibility with C):

"Line 1\n\
Line 2\n";

However, in this case, you might consider storing your ASCII art as vectors of rows. (Since two-dimensional array can mean a few different things, a good unambiguous name for this is a rectangular array.) This would make it possible to, for example, display a picture of the monster in a box and wrap an infodump around it, or show its stats on the left or right of the picture, or overlay a caption like "-999 HP" on the frame.

In this case, you might consider storing your ASCII art as vectors of rows. (Since two-dimensional array can mean a few different things, a good unambiguous name for this is a rectangular array.) This would make it possible to, for example, display a picture of the monster in a box and wrap an infodump around it, or show its stats on the left or right of the picture, or overlay a caption like "-999 HP" on the frame.

Removed confusing piece of the section on string literals.
Source Link
Davislor
  • 9.2k
  • 19
  • 39
Loading
added 458 characters in body
Source Link
Davislor
  • 9.2k
  • 19
  • 39
Loading
added 111 characters in body
Source Link
Davislor
  • 9.2k
  • 19
  • 39
Loading
Source Link
Davislor
  • 9.2k
  • 19
  • 39
Loading