intfiction.org

The Interactive Fiction Community Forum
It is currently Sun May 19, 2013 7:48 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 55 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Thu Jan 05, 2012 10:25 pm 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 686
JoeyJones wrote:
RealNC wrote:
Wait, I7 needs your whole source in a single file? Seriously?

The existence of extensions would seem to suggest otherwise...

Then I suppose that single-file monstrosity isn't exactly a fair example.


Top
 Profile Send private message  
 
PostPosted: Thu Jan 05, 2012 10:30 pm 
Offline
User avatar

Joined: Mon Oct 03, 2011 12:03 pm
Posts: 632
Location: Stoke Barehills
My difficulty in reading this source text is mostly down to the penchant Michael Martin has for giving things inscrutable code names rather than using words in English, and the I6 code that he's added for a feature specific to that particular game. I can understand why he did it, but you don't really want to be trawling back and forth looking up that 's_unknown' is 'status unknown' or 'sao_outmaneuvered' is something about a slack attack rating, and so on. Naming your variables stuff that makes sense in English is helpful for making readable code.

As for the code source size: you could break down the game into different files and then load them all up as extensions into the final game if you really wanted, but I don't see the point. Inform's IDE is such that you don't have to view the source code as one huge block of text, but rather you focus on different subsections of it separately.


Top
 Profile Send private message  
 
PostPosted: Fri Jan 06, 2012 2:52 am 
Offline

Joined: Tue Mar 30, 2010 9:30 pm
Posts: 188
Obligatory favorite example of valid I7 code wrote:
Instead of attacking Tom when something lethal is held, now every visible dog owned by Tom hates the player.


I've personally never really encountered a language that lets you express complex world simulation concepts like that so elegantly.

_________________
Aaron Reed - Creating Interactive Fiction with Inform 7 - Smarter Parser


Top
 Profile Send private message  
 
PostPosted: Fri Jan 06, 2012 5:35 am 
Offline
User avatar

Joined: Tue Nov 17, 2009 5:25 pm
Posts: 628
aaronius wrote:
Obligatory favorite example of valid I7 code wrote:
Instead of attacking Tom when something lethal is held, now every visible dog owned by Tom hates the player.

I've personally never really encountered a language that lets you express complex world simulation concepts like that so elegantly.

That is so very true.
Although, to be honest, the same sentence can be phrased in any other way and Inform wouldn't understand it. In the end it's just another programming language, with rules and bounds.
BUT: the integration between what you think of doing and how I7 handles it is so seamless it is astonishing. I think the best parts of I7 were done by the "narrative" minds of Nelson, Short and the rest, not the "coding" ones. This IS a work of genius, no matter how people react to it.

I started coding my first game with less than 20 hrs of teasing at the documentation.
I found myself in front of a puzzle which just self-generated by how the story was going on. I had this piece of soap the player had to push on (er.. push ACROSS) something to copy its surface. And then a machine able to replicate that surface on yet another thing.
I started coding it absolutely unaware of how to do it.
And it was done. In, like, 30 minutes, on the first try. I seriously doubt I would have succeeded in I6 or TADS where I got stuck in much simpler problems.

If there is a problem with I7, imo, it's in how the language-directed code sometimes gets along with the real descriptions ingame. I mean, there is no much difference between "Instead of taking the steel bar, say" and the part after the quotes in the same line of code. That drives a non native speaker like me to forget this is a PROGRAM and not my other average friend. Coding starts being too much like a conversation, and this can generate errors.

This is what i mean:
Code:
Metal_ladder is in the Campus. "There is a metal ladder here." The printed name is "metal ladder". Understand "ladder/metal" as the Metal_ladder.

Instead of going up when in the Campus, try climbing the ladder.

This compiles, but doesn't work, of course. And it takes a lot of time to know what's wrong if you just don't turn on your brains. (Ok, in this case it is NOT that hard, but imagine you've already written the word LADDER ten times in ten different descriptions. To you, the Metal_ladder IS the ladder, no matter what).
And this is a common mistake I do when coding in I7.

That said, I wouldn't recommend anything else than I7 to a beginner. Unless he has the mind of Andrew Plotkin, I mean :)

When I come to the blank page, writing a novel or a short tale, I want the computer, the software (I actually use InDesign to write: Word is just tooooooooo unstable... and I need the eye candy as well as the page size), or the damn typewriter to disappear as soon as I start writing "It was a dark and stormy night...". Inform quite succeeds in this, although not so much as one would hope. And this is what I most like in it.


Top
 Profile Send private message  
 
PostPosted: Fri Jan 06, 2012 6:24 am 
Offline

Joined: Thu Dec 08, 2011 11:41 am
Posts: 6
And so the language wars begin ... again ...

But they are surely a bit of a distraction in this case. Whatever one thinks about particular IF-specific languages, the main point is that if one's aim is to write interactive fiction (and not, e.g., to write a parser, or stretch programming muscles in a particular language) any of the established languages will probably end up producing a better result (and certainly a quicker one) than starting from scratch, because there are all sorts of dark corners and common problems and pitfalls that the established languages have fretted over -- and even where the "core" language may not end up with a satisfactory solution, the likelihood is that there are extensions or published code that does. If you "roll your own" you will certainly have to reinvent quite a large number of wheels (and probably find yourself having to look in some detail about how those who have gone before have made theirs), and very likely find that your first efforts are as one expects of first efforts.

Beyond that it's surely a matter of choice. If you like the Inform 7 IDE and its way of organizing things, then that's great. If you prefer I6 or TADS, that's fine too. If you find Inform 7 elegant, wonderful; if you think TADS is more rigorous, that's wonderful too. Sooner or later you are going to hit something that you don't terribly love, something which another language does "better", something that you find annoyingly difficult to achieve.

If you are writing IF for fun, there are two people you have to please: yourself (in writing) and the audience (in playing). Any of the mainstream languages is capable of doing the latter; that has been proved by experience. Non-IF-specific languages are much less likely to do so (that has been proved by experience as well), certainly without quite disproportionate investment of time. When it comes to pleasing yourself -- well, please yourself! If you want to write interactive fiction in Haskell (notoriously, to its cognoscenti, the nec plus ultra of elegance), feel free.


Top
 Profile Send private message  
 
PostPosted: Fri Jan 06, 2012 11:09 am 
Online

Joined: Sat Dec 22, 2007 11:52 pm
Posts: 766
It bothers me a little that there hasn't been a serious attempt at a new general-purpose IF system in the last five years (and I'm not even sure you really can include I7 here). Of course here is where I hand wave away Curveship, ChoiceScript, Undum, Quest, Adrift 5 I guess...man, these arguments get into trouble quickly don't they. :?


Top
 Profile Send private message  
 
PostPosted: Fri Jan 06, 2012 12:47 pm 
Offline

Joined: Tue Jan 03, 2012 1:41 pm
Posts: 14
aaronius wrote:
Obligatory favorite example of valid I7 code wrote:
Instead of attacking Tom when something lethal is held, now every visible dog owned by Tom hates the player.


I've personally never really encountered a language that lets you express complex world simulation concepts like that so elegantly.


How I would write that-
Spoiler: show
'Note that I would replace item_hostile with every hostile item, as I don't have grouping of items programmed.
'0 = not owned, 1 = owned, 2 = equipped

If (item_hostile = 2) And hostility_check = True Then
'This makes the relationship of all dogs be hostile to the player if the player is holding the item, which triggers this check.
'The temporary just stores the current amount until needed again.
'0 is neutral, -20 is mean, -50 is hostile, -100 is offensive (they attack)

dog_relation_temp = dog_relation
dog_relation = -99
Else If hostility_check = True Then
dog_relation = dog_relation_temp
hostility_check = False
End If


It's a lot dirtier, but that is how it would be written. And it does this PERFECTLY.
EDIT: If I don't screw up.


Top
 Profile Send private message  
 
PostPosted: Fri Jan 06, 2012 12:56 pm 
Offline

Joined: Tue Mar 30, 2010 9:30 pm
Posts: 188
Fair enough, except you left out the part about this being a rule that applies only when the player is attacking something, the part about that being a specific thing (Tom), the part about it taking place after checking that this action is possible but before beginning to carry it out (the "instead" rulebook), the part about looping through the dogs in the game, the part about only applying the loop to dogs who are currently visible to the player, and the part about only applying the loop to dogs who have a certain relationship to Tom (ownership). Not really a fair comparison, I would think.

_________________
Aaron Reed - Creating Interactive Fiction with Inform 7 - Smarter Parser


Top
 Profile Send private message  
 
PostPosted: Fri Jan 06, 2012 6:19 pm 
Offline

Joined: Mon Dec 07, 2009 5:14 am
Posts: 897
Touchè.


Top
 Profile Send private message  
 
PostPosted: Sat Jan 07, 2012 10:25 am 
Offline

Joined: Tue Jan 03, 2012 1:41 pm
Posts: 14
Well, that's how I understood the code that was given.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 55 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group