FBA The Creator
http://www.fbacreator.com/fbaforum/

Help on creating Graphic/Text adventure.
http://www.fbacreator.com/fbaforum/viewtopic.php?f=5&t=215
Page 1 of 1

Author:  Navigator [ Thu Sep 03, 2009 5:17 pm ]
Post subject:  Help on creating Graphic/Text adventure.

Being a bit of a fan of the traditional graphic/text adventures I would like to write one using FBA. This would require changing locations, collecting and using objects and creating an inventory. FBA has got all the bits & pieces but am not too sure about the coding. Can anybody out there give me a shove in the right direction. Any help would be much appreciated. :?

Author:  shaber [ Sat Jan 02, 2010 6:21 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

hi!Image
try to describe the game of your dream. Image and i think we can make skelet of your game together. ImageImage

but be prepared - time, needed for development is about 100*(gameplay time) hours. Image
if it is your first game then don't plan more then 30 minuts of gameplay time... Image small game is ideal for a start...

Author:  Navigator [ Sat Jan 02, 2010 7:05 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

Thanks for the reply and the offer of help. Haven't any solid ideas on the actual game, just need some programming tips on structuring. I have written graphic/text adventure creators on the Amiga (Do you remember that computer?) in Amos basic. Needed loads of dimension arrays and file input/output routines for saving game positions. Still got the Amiga 1200 stuffed in a cupboard somewhere.
What I really need is some sort of game template with a means of loading in background images and text descriptions and a dialogue box or a multiple choice input box for player input.
I look forward to any suggestions you might have.

Happy new year

:)

Author:  shaber [ Sat Jan 02, 2010 8:43 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

oups... i'm just 20 years old, Image so i don't remember Amigo.

in fact, you have more experience then me, and it make my confused.... Image

for start - discover some examples from FBA folder on the PC...

FBA hasn't functions for dialoge box, so you should make it by your hands.

mainloop redraw all on the screen every cadr. memory pages changing are already organized by the API
it looks like this:

Code:
function mainloop()
  clear(0,0,0)
  drawMyShaberMap()
  drawMyShaberUnits()
  drawSuperPatricles()
  drawAnythingElse()
 
  monsterAI()
  checkSomething() 
end


so, if you want to make dialoge box, the simpiest code should be like this:

Code:
-- all this code before mainloop are executing one time on program start. it's like "VAR" in the pascal :)
-- ofcoarse, i writed only variables, which related to dialogebox
-- in the Lua you don't need to set Type of variable. It is Variant.

isDialogeOnTheSreen=false
DialogeNumber=0
NumberOfAnswers=0
DialogeAnswer={}     --DialogeAnswer is a table.

loadphrasedatabase() --this is our function, we'll make it later

LastStylusUpX=0
LastStylusUpY=0

function mainloop()
  if isDialogeOnTheSreen then
   MyFunctionDrawDialoge(DialogeNumber)
  else
   clear(0,0,0)
   drawMyShaberMap()
   drawMyShaberUnits()
   drawSuperPatricles()
   drawAnythingElse()
   monsterAI()
   checkSomething() 
  end

end



so, lets go forward...
all this is MY way to organize the program working. I'm sure, it isn't ideal...

onstylusup(x,y) is standart event function. it work every time stylus or mouse button move up :) let's write it...

Code:
function onstylusup(x,y)
  if isDialogeOnTheSreen then
   LastStylusUpX=x
   LastStylusUpY=y
  else
   --there are some actions for non-dialogeBox game control. for example:
   unit[player]["targetx"]=x
   unit[player]["targety"]=y
   --or
   shotWithMagic(Selected_magic,player,x,y)
  end
end


and, finaly, dialogebox:

Code:
function MyFunctionDrawDialoge(dialogenumber)
  fillrect(50,50,200,300,255,220,210)     --fillrect(x1,y1,x2,y2,red,green,blue) draw filled rectangle
   print(70,60,phrasesDatabase[DialogeNumber],0,0,0)     -- print(x, y, text, red, green, blue)
  for i = 0,NumberOfAnswers-1 do
   print(70, 70+i*20, phrasesDatabase[DialogeAnswer[i]] , 0, 0, 0)
   if (LastStylusUpY >60+i*20) and (LastStylusUpY <80+i*20) then
     --action,change dialoge...
   end
  end
end


oups, it isn't finaly :)

how to create dialoge with THIS model:

Code:
--for example... 
if QuestStep==141 then
  isDialogeOnTheSreen=true
  DialogeNumber=150
  NumberOfAnswers=5
  DialogeAnswer[0]=151
  DialogeAnswer[1]=152
  DialogeAnswer[2]=153
  DialogeAnswer[3]=14
  DialogeAnswer[4]=900 
end

and
Code:
function loadphrasedatabase()
phrasesDatabase={}
phrasesDatabase[0]="lets start the game"
phrasesDatabase[1]="what your name?"
phrasesDatabase[2]="select your rase!"
...
phrasesDatabase[14]="No,thanks"
...
phrasesDatabase[151]="Do you think it will be useless?"
phrasesDatabase[152]="I understand. How many do you want?"
phrasesDatabase[153]="Calm out! It's joke..."
...
phrasesDatabase[900]="Die, bastard!"
...
end


near that... it isn't a ready-to-work model, but quite for a begin.

whay about loading in background images.. its very simple. look at the "graphic" in the FBA help - you can find all you need about this things...

whoooh... So many english make my brain burning... Image

Author:  shaber [ Sat Jan 02, 2010 8:53 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

and what about file input/output... all my games still waiting for "save game" option :) but it isn't hard. Use the "Binary files" folder from main help of FBA. Read it all :) next - take example "13.using.gamegrid.fbp" from FBA folder and look carefull at then. It's the basic file reading algoritm, i use copy of them alwayse... in this example there are map in the file, but it can be any other information...

Author:  Navigator [ Sun Jan 03, 2010 11:34 am ]
Post subject:  Re: Help on creating Graphic/Text adventure.

Thankyou shaber, you've certainly been putting some thought into it. I will see if I can cut/paste the code you have attached and have a good look at it.
I'm not too familiar with scripting. I've spent too long writing in Basic and it takes a long time for me to get my head round anything new, although it looks fairly easy to understand.
Thankyou very much for your time and trouble.
Will post again soon. I'm in the process of updating customers websites at the moment but will get back to it as soon as I can. It's more fun than web coding.
Have an awesome day :D

Author:  phrebh [ Mon Jan 04, 2010 8:00 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

I'm an old BASIC programmer, too, and I can tell that while FBA is not very similar to BASIC, your knowledge should help you out.

The main thing you're going to need to feel comfortable with is the table structure. Shaber has a couple of examples, but didn't draw attention to them. Tables are just arrays. Luckily they are pretty easy to understand.

And as shaber also said, the examples and the help file are your friends. And don't forget to find a good Lua resource online to learn some of the things not covered by the help file.

Good luck!

Author:  shaber [ Tue Jan 05, 2010 4:16 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

Quote:
And don't forget to find a good Lua resource online to learn some of the things not covered by the help file.

M... can you advice some of them? i tryed to search for someone, but english-zone internet is still hardly for my... and there are only translated documentation on the russian sites...

Author:  Navigator [ Tue Jan 05, 2010 6:08 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

Thanks for the input phrebh, I certainly need to study those tutorials. Nice to hear from a fellow BASIC programmer.
May your GOSUBS always RETURN :P

Author:  phrebh [ Wed Jan 06, 2010 4:06 pm ]
Post subject:  Re: Help on creating Graphic/Text adventure.

shaber wrote:
Quote:
And don't forget to find a good Lua resource online to learn some of the things not covered by the help file.

M... can you advice some of them? i tryed to search for someone, but english-zone internet is still hardly for my... and there are only translated documentation on the russian sites...

I just go straight to the source at Lua.org. It looks like they even have a Russian language manual.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/