Go Back   Forums > Community Chatterbox > Tech Corner > Programming
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

Reply
 
Thread Tools Display Modes
Old 05-09-2010, 08:09 PM   #21
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

Okay, all debug messages should be gone now. I've filled in some of the missing paragraphs, so that you can play a part of the first module's beginning without getting eaten by the Grues too often.

Far as the engine goes, this is a functional beta. Far as the module goes, it's still in demo phase.
Attached Files
File Type: rar DragonEngine_beta_1.0d.rar (175.0 KB, 1 views)
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Old 08-09-2010, 09:12 PM   #22
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

http://www.mediafire.com/?u4x6a49pfyaab9a

Ver. 1.00 full release, with the complete "Crypt of the Vampire" module. Enjoy.

Proper documentation coming soon, as some things changed from the beta releases.
Attached Files
File Type: rar DragonEngine v1.00.rar (209.7 KB, 5 views)
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards

Last edited by The Fifth Horseman; 09-09-2010 at 01:43 PM.
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Old 10-09-2010, 05:43 PM   #23
Japo
Autonomous human
 
Japo's Avatar


 
Join Date: Mar 2006
Location: ,
Posts: 4,613
Default

When I go into the witch's room and comply to leave, I get "Paragraph 219 was eaten by a Grue". But there is a 219.par and a 219.lnk.
__________________
Life starts every day anew. Prospects not so good...
Japo is offline                         Send a private message to Japo
Reply With Quote
Old 11-09-2010, 09:14 AM   #24
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

Found the cause - there was a trailing space in the line declaring the paragraph to move to.
Fixed, and will add a safety measure to prevent this from happening.

Added.
http://www.mediafire.com/?uygc78yynwgdidc
http://files.abandonia.com/extras/Dr...ne%20v1.01.rar
And also in attachement here.
Attached Files
File Type: rar DragonEngine v1.01.rar (211.4 KB, 4 views)
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards

Last edited by The Fifth Horseman; 11-09-2010 at 09:59 AM.
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Old 11-09-2010, 01:21 PM   #25
Japo
Autonomous human
 
Japo's Avatar


 
Join Date: Mar 2006
Location: ,
Posts: 4,613
Default

I killed Lord Tenebron!

It's good practice to flush the stdin buffer before every time you request console input, otherwise any keys pressed before the request are saved in line to be input, before anything else, which is also put in line, and so on.
Code:
fflush(stdin);
http://msdn.microsoft.com/en-us/library/9yky46tz.aspx
__________________
Life starts every day anew. Prospects not so good...
Japo is offline                         Send a private message to Japo
Reply With Quote
Old 11-09-2010, 02:55 PM   #26
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

That doesn't seem to work; possibly because - outside of specific cases - the game is using getch() to receive keyboard input.
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Old 11-09-2010, 05:36 PM   #27
Japo
Autonomous human
 
Japo's Avatar


 
Join Date: Mar 2006
Location: ,
Posts: 4,613
Default

It's not because of that. I've made a test program and fflush(stdin) does NOT work at all, regardless of what function you use to read input afterwards. Console input is buffered, what function you use doesn't change that.

So forget what I said, I remember reading about this, but it seems I was misled. Here's some info I googled:

http://faq.cprogramming.com/cgi-bin/...&id=1043284351

In short, the argument of fflush() must be an OUTput stream, otherwise its behaviour is undefined--that is, it may work as intended, or it may destroy the Universe, or anything. I've read fflush(stdin) may or may not work on different systems. I've just tried in Visual C++ and in Turbo C++ 1.01 under DOSBox, and both times fflush(stdin) returned 0 despite ostensibly doing absolutely nothing.

Looks like the only way to "flush" (emtpy) stdin is to read from it (the above linked FAQ links to another FAQ with some code snippets for this). The problem is that if you try to empty stdin and it's actually empty, the program will wait until any key is pressed.

People seem to recommend always using fgets() to read console input, and then if necessary fscanf().

PS: I made another test program in C#, since the .NET Framework is way more powerful and safe, and it's my preferred choice now. The Console class has an read-only property called In, but its type is not a Stream, but a TextReader--that is, it has no methods (functions) to modify its content, only to read. I took a detour and called Console.OpenStandardInput().Flush(), but then I got a proper exception (NotSupportedException) saying "Stream does not support writing." So there you have it, you can't flush the console input. Console.OpenStandardOutput() returns the same type as .OpenStandardInput(), but you can .Flush() the object returned by the former, whereas trying to do so with the latter throws a NotSupportedException.
__________________
Life starts every day anew. Prospects not so good...

Last edited by Japo; 11-09-2010 at 05:52 PM.
Japo is offline                         Send a private message to Japo
Reply With Quote
Old 15-09-2010, 10:26 PM   #28
Fubb
GreatCanadianMan
 
Fubb's Avatar


 
Join Date: May 2008
Location: Swan River, Canada
Posts: 842
Default

OK, for my digital logic class, i think it'd be kinda neat jsut to make a short little adventure game and show the teacher...

HOWEVER, after going through your code some more of the DE v.101, I got some more questions.

Im guessing you compile all the header files into "Dragon Engine.exe" and then Dragon Engine.exe fetches the paragraph files from the '1' folder....thats cool....

But im still not understanding how the lnk and paragraph files work, cause i know the lnk has the actions, but how do i know which action leads to which paragraph?
__________________
Kugarfang: o hai guiz im trying to find this techno song from the radio and it goes like this:

DUN duuuunnnn dudududududun SPLOOSH duuunnnnn


We ate the horse.
Fubb is offline                         Send a private message to Fubb
Reply With Quote
Old 16-09-2010, 07:40 AM   #29
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

Quote:
then Dragon Engine.exe fetches the paragraph files from the '1' folder....thats cool....
More than that, actually. It will look in 99 folders from '1' to '99' as well as the current folder. If there's more than one module present, you will be presented with a simple menu to choose the module from.
Further, that can be overridden entirely by creating a file named modules.ini in the same directory as the executable, and entering directory names into separate lines in the file. Then the game will only look for modules in the specific directories in modules.ini.

Quote:
But im still not understanding how the lnk and paragraph files work, cause i know the lnk has the actions, but how do i know which action leads to which paragraph?
The one named on the preceding line in the LNK file.
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards

Last edited by The Fifth Horseman; 16-09-2010 at 07:45 AM.
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Old 17-09-2010, 01:43 PM   #30
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

http://www.mediafire.com/?g6gg4qwlt4g1qq6
Engine 1.02. Alternate includes present for compiling under Linux and some minor changes in the code.
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 06:29 AM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.