1.

Solve : I did it! Yay!?

Answer»

It's currently 12:08 at GMT-8 as I type this.

I needed to do a project for my Health class, and I was sick of the same ol' posters and crap. "Game" was on the LIST, and, well, the rest is history.

Long story short: I wrote a C++ command-line menu-driven game revolving around Suicide, the last topic of our unit. In it, the player attempts to talk some guy out of jumping off a TALL building. I worried my parents greatly, because I've never finished a "real" C++ program to date.

How did I write a fully-fledged game (by 1990 standards, anyway) within a week, you ask? I'm almost ashamed to say it, but I nearly completely abandoned the concept of OOP. I wrote purely procedural code. I had a one-variable class out of habit, but actually, a global variable would have been easier for something of this small scale. I also stripped the program of all exceptions and error logic, since I'll be the one at the helm.

The game is actually simple enough for a one-page flow chart. Luckily, debugging is a small chore when all conceivable paths are marked. I'm proud to announce my first real program was a Gold-star program -- it compiled and ran to specifications perfectly the first TIME. (I'm not counting the delays in the couts I added later; I left them out at first intentionally for debugging purposes.)

^^^^I'm not sure whether to be proud or scared. What can I say, other than I'm done ahead of time and did a good job? Oh, maybe I should get to bed. Well done! You also learnt a valuable lesson: OOP is just one style of programming available. Each different situation requires a different style and with experiance you will be able to weigh up the pros and cons of each style. Sometimes it can be disastrous to force a particular style "just because".

For small simple projects, OOP can be more trouble than it's worth. Forcing OOP for them can be fine for learning purposes but when it comes to create a "real" (wasn't sure of the correct word to use) program, then consider the best style.

I'm still looking forward to your escape game! I'd rather not use a "software creator" program to make programs. Not only is it "one step removed"* from actual programming, it's Visual Basic. There's nothing wrong with VB as a language, but it's extremely removed from Assembler, which causes unnecessary overhead.

Besides, anything that uses VB requires the .NET framework. Since we're talking 2006-07, it's probably the Framework 2.0. I'd rather not make other users download a 20-something MB thing just so my 400 KB EXE works. When you write in C/C++/Java/Assembler/alltheothers, no additional stuff is required -- it runs on its own.

*FrontPage is "one step removed" from writing HTML. The code it makes is a MESS, and it usually causes only IE to render properly. Not my idea of fun.Learn how to use apostrophes.You mean DeltaSpider, right? If so, then add periods, commas and capital letters to the list. Quote

When you write in C/C++/Java/Assembler/alltheothers, no additional stuff is required -- it runs on its own.

I thought you needed at least the JRE to run Java programs / applets (~16-20Mb download from SUN).

Quote
*FrontPage is "one step removed" from writing HTML. The code it makes is a mess, and it usually causes only IE to render properly. Not my idea of fun.

100% accurate there. I'll take notepad over it any day. When you use any WYSIWYG system for programming or websites it usually makes it 100x harder to maintain (and understand the code) than if you went away and learned the HTML/Java/C(++)/etc...
*Reads up on Java

Oops! Oh well, the rest of my statement stands.

As for WYSIWYG, Dreamweaver is fairly good at not totally botching up the code it makes. It's still hard to maintain, though. And I'd never use a C++ code generator; the mess of code it makes would be a nightmare.

Side-Note: Do you know about the old compilers that would try to correct programmer's mistakes at compile time, so stupid things like forgetting a ; at the end of a line or missing a ) or two wouldn't cause a program that takes 5 minutes to compile to spit back an error instead of linking.

It was a noble quest, but like most of mankind's projects it went way too far. One infamous example is a compiler that someone typed only one word into: "if". No INCLUDES, no "int main()", nothing. Would you believe that it created a 200-line command-line which successfully compiled and ran? Quote
Side-Note: Do you know about the old compilers that would try to correct programmer's mistakes at compile time, so stupid things like forgetting a ; at the end of a line or missing a ) or two wouldn't cause a program that takes 5 minutes to compile to spit back an error instead of linking.

Now if only you could do that with javac.... Then I wouldn't get pages of console text telling me I missed a couple of ;s. It ticks you off enough to check what you type before sending it to the "compiler". Especially when you have to ssh it to the server first as it's running a different version of Java.Sheesh, a suicide negotiator game?  I think I lose by default.Nah, a monkey could beat it. You see, as long as the Suicide Meter is below 50% after five moves, you win a technical victory. It's really not hard at all, but it does include a lot of the things we covered in the Suicide unit at school, and it's playable and, for about a minute or so, interesting to play. Which is why I received an A+ stamped on the printed source code. (It's kinda hard to write the grade on a file...)

For anyone interested, here's the program and the source code. Note that I didn't comment a single line, which is completely out of character for me, I assure you. The only reason for that is that I didn't ever... EVER... want to return to this program and modify it further.

Only other thing to mention is that the dialog is rather cheesy. But hey, a week deadline is an hour or so of creativity.

*grumble grumble* stupid 128KB attach limit... you'll have to compile the source code with Dev-C++ or a similar C++ compiler. But the compiled game is 130 KB -- 2 over the limit. :-/

[old attachment deleted by admin]You need this:

http://upx.sourceforge.net/

It's so amazing. I got a game, with graphics included in the exe, to 114kb. And the guy on the other end doesn't need to do anything or have anything. He just runs like normal.

Edit: On my compiler it is 68kb, and 16kb after upx.I wonder if I can attach a .7z file...

Sweet! 104 KB!

That's amazing... the uncompressed is 400+ KB... (pre-UPX and 7-zip)

[old attachment deleted by admin]I like that game.
Nice job there.Thank you! Again, I got it down to 16kb so I still win.


Discussion

No Comment Found