Writing IF in Java?

Video Game Discussions and general topics.

Moderators: AArdvark, Ice Cream Jonsey

hygraed
Posts: 711
Joined: Mon Feb 20, 2006 2:15 pm

Writing IF in Java?

Post by hygraed »

I'm about to finish up an AP Computer Science course at school, and for our final project we have been tasked to write a playable game. I figure this might be the impetus I need to finally get started with the IF vignette I've been wanting to write. However, Java might not be the ideal language for writing IF. The game I've got in mind doesn't have any tricksy bits; it's pretty much on a par with Zork as far as the technical side goes.

So, my question is, is it at all feasible to write an IF game of any appreciable length in Java, and are there any tools out there to make it easier?

User avatar
pinback
Posts: 17853
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Post by pinback »

I think the hardest part (and really, the only hard part, other than coming up with the game/story) of writing IF is getting a parser that works. But I was writing parsers in BASIC when I was 10 years old, so it can be done. They sucked balls, of course, but if you're okay with just having something good enough to get the job done, then you can just write a quick "verb noun" parser, and off you go.

Back in the day, I was all:

if verb == "hit" and noun == "kitten" then
print "You bitch-slap that kitten like it owes you money."
endif

Probably today I'd be all

class Kitten {
hit() {
print "Damn, you pound the fuck outta that kitten.";
}
eat() {
self.eaten = true;
print "Mmm... That's good kitten!";
}
}
Am I a hero? I really can't say. But, yes.

User avatar
Ice Cream Jonsey
Posts: 30077
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Re: Writing IF in Java?

Post by Ice Cream Jonsey »

hygraed wrote:I'm about to finish up an AP Computer Science course at school, and for our final project we have been tasked to write a playable game. I figure this might be the impetus I need to finally get started with the IF vignette I've been wanting to write. However, Java might not be the ideal language for writing IF. The game I've got in mind doesn't have any tricksy bits; it's pretty much on a par with Zork as far as the technical side goes.

So, my question is, is it at all feasible to write an IF game of any appreciable length in Java, and are there any tools out there to make it easier?
Yeah, the issue for non-educational purposes is that the three major IF languages give you all of Java's benefits already (multiple platforms, a virtual machine, etc.).

That's not to say that real work can't be done: if you were to come up with a Java terp for Hugo (for instance) it would be the greatest thing ever, because we could then in-line our games through a webpage, like how you can with Inform. It wouldn't even need graphics support, just getting text-only games up would be huuuuhhh-yuge.

All that being said, putting together a two-word parser implementation in Java would be above and beyond the call of duty for an AP Computer Science class, I would hope. We didn't even have that class offered when I was in high school, we had to take AP Chemistry and shit and if you were lucky a dot matrix printer might be involved at some point. There was AP CS for you.
the dark and gritty...Ice Cream Jonsey!

draaal

Post by draaal »

I did write a text interpreter in Java for AP Computer Science (I also remember hand writing java code for the AP test, and playing Doom and Quake 2 on the school's lan) and the task isn't all that difficult, just determined.

User avatar
Ice Cream Jonsey
Posts: 30077
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post by Ice Cream Jonsey »

draaal wrote:I did write a text interpreter in Java for AP Computer Science (I also remember hand writing java code for the AP test, and playing Doom and Quake 2 on the school's lan) and the task isn't all that difficult, just determined.
The Milker and I used to play Quake on the LAN at work when we were at Cyrix. Our manager thought that all of us in the lab were playing too much Quake, so he wanted us to not play it at all, but our lab manager had our backs and got it so that we could play it at lunch and after work. Eric Johnson was his name, and he was fucking awesome. Did possibly the best Yoda impression on the planet. I remember him breaking into Yoda as he was pretending to dress down a fellow Cyrix employee (or something like that) and I went into an absolute fit of laughing. One of those times in your life when you just can not do anything but laugh, and you don't stop, because when you think of what made you get started in the first place, it starts all over again.
the dark and gritty...Ice Cream Jonsey!

Ghost of Yoda

Post by Ghost of Yoda »

Ah, Funny it was to hear my voice on the job, hmmm?

Post Reply