Your Most Desperate Console Code

I have always wanted to make video games and when I say always I mean there are spiral bound notebooks from when I was 6 yrs old of concept sketches I drew somewhere back in my old bedroom. So when I got my first C++ book I was as pumped as anyone to get right into it. But no one tells you how much using a CLI console sucks for writing games. Now, because I KNOW that I am not the only one who wouldn't face reality at first, I'm asking everyone now:

What Is The Most Desperate Thing You've Done To Try To Make A Video Game On A CLI Console?

As for me, I'll start off by setting the stupidity bar absurdley high. When I was in Junior High School we had to take manditory typing classes, part of this class was to follow a set of instructions on a printed sheet of paper (I know right?) that if you did correctly you would end up with a picture. I kid you not my friends, one of my early attempts at "graphics" was to cout ASCII art, wait for user input, clear screen, loop. For those of you who don't know what this is here is a google img link: http://www.google.com/search?q=ascii+art&hl=en&prmd=ivns&tbm=isch&tbo=u&source=univ&sa=X&ei=xOi1TfGIBJDqgQeU-tDFCw&sqi=2&ved=0CDoQsAQ&biw=1252&bih=639

I REALLY wish I had the origional code to show you. Or that I could even remember how I wrote it up, I put an absurd amount of time into it. But sadly that HDD does not exist anymore.
I did a basic graphical map on a TI-84, does that count? All the maps were hard coded in and it looked like a mess (BASIC ftl), but it actually ran pretty fast and looked nice.
@ firedraco: It sounds like it was functional in the end but it was a desperate attempt none the less. Thanks for the entry!
Computergeek01 wrote:
one of my early attempts at "graphics" was to cout ASCII art, wait for user input, clear screen, loop

I'm ashamed to admit that I did this as well. I drew an ASCII art helicopter facing left, right, top-down and botton-up, stuck each drawing in its own file (Files/Helicopter/<direction>.txt) and wrote a Helicopter class which would load the relevant text data on the console and everything. You could change which direction it was facing with the arrow keys and fire a machine gun with space and missiles (which I never implemented) with enter. There were no enemies, though, so all you could do was increase your velocity (the only thing that told you how fast you were going was a little "speedometer", there were no backgrounds and the helicopter stayed in the centre of the screen). The more I talk about this game the more I want to write it again...
Last edited on
I never really made much in the way of games in the console, tic-tac-toe, but that's not badly suited to the console at all.
@ chrisname: It sounds like you put a good deal of work into it. The part about the speedometer sounds especially interesting.

@ quirkeyusername: I don't know about that, you could write some serious garbage that would end up looking something like a tic-tac-toe game. Especially when checking the winning conditions.
Not really, it was very simple. The code for the speedometer wouldv'e just been something like:
printw("Velocity: %0.2f ms^-1", current_velocity);
Ah, see I was trying to picture what it would take to draw an analog speedometer in ASCII characters complete with that little indicator stick. But a digital one makes a lot more sense.
Nah, I wasn't cool enough for that.
I've done quite a few video games on the console ... but this was a really long time ago. (DOS and VGA colors! Sweet!)

I've also written a program that is for editing ASCII art and displaying it as sprites, using full 16 color foreground/background and transparency. (I called it "TE".) It was pretty sweet.

It still runs on the default Windows Console, but crashes if you try to navigate around the root directory. I've not considered it worth my time to upgrade it to modern systems...
That TE program sounds really cool, Duoas. I've messed around with DOSBox; I tried to write my own version of the program LoadLin.
closed account (3hM2Nwbp)
Dug this out of my OLD C++ course that I took years back. The campus still has my student partition active. My flame-suit is on, so fire away.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
  //C++
	class FlyingGame {
		private:
			BufferToggle toggle;
			int difficulty;
			bool gameGrid[10][10]
			static const char Player = '^';
			static const char object = '*';
			static const char voidObj = ' ';
			bool alive;
			int playerPosition;
		public:
			FlyingGame()
			{
				playerPosition = 5;
				srand(time(0));
				alive = true;
				for(int x=0; x<10; x++) {
					for(int y=0; y<10; y++) {
						gameGrid[x][y] = false;
					}
				}
				cout << "Which Difficulty Level? (0-5): ";
				cin >> difficulty;
				difficulty++;
				while(!cin || difficulty < 0 || difficulty > 5)
				{
					cout << "Invalid Entry...\n";
					cin.clear();
					cin.ignore(numeric_limits<streamsize>::max(), '\n');
					cout << "Which Difficulty Level? (0-5): ";
					cin >> difficulty;
				}
				toggle.off();
			}
		~FlyingGame()
		{
			toggle.on();
		}
		void addNewRow()
		{
			for(int x = 0; x<10; x++)
			{
					gameGrid[x][0] = false;
			}
			int random;
			for(int spawn = 0; spawn < difficulty; spawn++)
			{
				random = (rand()%10)+1;
				if(gameGrid[random][0] == true)
				{
						spawn--;
				}
				else
				{
						gameGrid[random][0] = true;
				}
			}
		}
	
		void advanceRows()
		{
			for(int y = 9; y > 0; y--)
			{
				for(int x = 0; x<10; x++)
				{
					gameGrid[x][y] = gameGrid[x][y-1];
				}
			}
			addNewRow();
		}
	
		void paintAdvancedRows()
		{
			system("clear");
			for(int y=0; y<9; y++)
			{
				for(int x=0; x<10; x++)
				{
					if(gameGrid[x][y] == true)
					{
						cout << object;
					} 
					else
					{
						cout << voidObj;
					}
				}
				cout << '\n';
			}
			for(int x = 0; x<10; x++)
			{
				if(gameGrid[x][9] == true && x != playerPosition)
				{
					cout << object;
				}
				if(gameGrid[x][9] == false && x != playerPosition)
				{
					cout << voidObj;
				}
				if(x == playerPosition)
				{
					cout << player;
				}
			}
			cout << '\n';
		}
		
		void movePlayerLeft() 
		{
			if(playerPosition > 0)
			{
				playerPosition--;
			}
		}
		
		void movePlayerRight()
		{
			if(playerPosition < 9)
			{
				playerPosition++;
			}
		}
		
		bool getIsDead()
		{
			bool isDead;
			if(gameGrid[playerPosition][9] == true)
			{
				isDead = true;
			} else
			{
				isDead = false;
			}
			return isDead;
		}
	};

	FlyingGame FG = FlyingGame();
	void *mainThread(void* x)
	{
		char ch;
		while(1)
		{
			if(cin.get(ch))
			{
				if(ch == 'D')
				{
					FG.movePlayerLeft();
				}
				else if(ch == 'C')
				{
					FG.movePlayerRight();
				}
			}
		}
	}
  
	int main()
	{
		pthread_t gameThread;
		pthread_attr_t attributes;
		pthread_attr_init(&attributes);
		pthread_create(&gameThread, &attributes, mainThread, NULL);
		while(!FG.getIsDead())
		{
			usleep(500000);
			FG.advanceRows();
			FG.paintAdvancedRows();
		}
		return 0;
	}


* I also made a game called - "Ascii Dice" :-\
Last edited on
Come to think of it, one of the most interesting games I made was a "snakes" game on the Sun OS (Unix) console back in the early '90s. (It was a pretty simple game -- it was only interesting because of playing with the broken NCurses Rutgers maintained then.)
I’ve made a console TETRIS game some time ago, although I wouldn’t call it "desperate". I just wanted to play a little with console graphics, out of curiosity. I'm quite happy with the result.

This was long after I created my first simple OpenGL game:)
A 3D rotating cube on an IBM System 34 (and displayed on a remote text terminal), written in BASIC, after learning 3D matrix transformations in trig class.
A 3D rotating cube
Me too (only in C++). Also a bunch of raycasting things. Though I never intended to make games out of them, so I don't know if that counts..
@hamsterman

I remember that. you posted it here a few years ago O:
When I said "Desperate" I origionally meant what attempts have people made to write a video game on any CLI using only the STL library. It's kind of an oppurtunity to look back at our selves and how far each of us has come with C++.
@Luc Lieber,
That code is actually quite elegant and neat. There's nothing to be ashamed of there.

@hamsterman,
I remember that and I must say, it was very impressive.
Topic archived. No new replies allowed.