Qbasicnews.com

Full Version: Anyone interested in making a text adventure as a group?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
everyones welcome!!!!^^ then again im not the starter of this thread dont sk me.

Anonymous

good luck guys. making a game is a ton of work.
Quote:everyones welcome!!!!^^ then again im not the starter of this thread dont sk me.

Doesn't matter to me how many people work on this, as long as it gets done.
ok! so what can i do! were do we stand?
So far we have an intro....that's all.
Yes, speedlemon, for the last time, I KNOW IT'S NOT A CHOOSE YOUR OWN ADVENTURE. I was just planning on writing a main story and we can build from there.
i've been really busy with school, but i managed a few minutes of coding

here's some code (FreeBASIC .14):
[syntax="qbasic"]'
' Text Adventure game...thing...Oz style Smile
'

ENUM Boolean
True = -1, False = 0
END ENUM

TYPE World
fname as string

lumps as integer
END TYPE

TYPE Scene
offset as integer
length as integer
END TYPE

TYPE Object
' Where are we loading this from?
fname as string

name as string

num_c as integer ' How many associated commands?
assoc_c as any ptr ' Associated command function reference

assoc_f as function() as any ' This will be determined by assoc_c[#]

' We could add attributes such as weight here if we want to...
END TYPE

TYPE ObjCommands
name as string ' Main name of the command ex: "Kick"

aliases as string ptr ' Aliases of the main name, ex: "Take"->"Get", "Steal"

assoc_f as function() as any ' The function (from pointers)
END TYPE


DECLARE FUNCTION Valid_Command(command_ as any ptr) as integer ' Returns index of the command
DECLARE FUNCTION Valid_Obj_Command(this as Object, command as any ptr) as integer ' Returns -1 if the command is not accepted, otherwise it returns the command index

' Our actions to objects
DECLARE FUNCTION Take(this as Object) as Boolean
DECLARE FUNCTION Break(this as Object) as Boolean
DECLARE FUNCTION Push(this as Object) as Boolean

' This controls our world
DECLARE FUNCTION Move(direction as string) as Boolean

' Here are our initializers
DECLARE SUB Init_Commands()

' ***
' Lets make some variables
' ***
REDIM SHARED cmdlst(0) as ObjCommands

Init_Commands()


' ***
' Our code for the main game goes here
' ***

' These are just some tests and examples
dim i as integer
i = Valid_Command(cptr(any ptr, @cmdlst(0).assoc_f)) ' @Take Wink
print i

sleep

end

' ***
' Initializes commands (to make code less messy)
' ***
SUB Init_Commands()
' We have 3 commands:
' Take(), Break(), Push()

REDIM cmdlst(0 to 2) as ObjCommands
cmdlst(0).name = "take"
cmdlst(0).aliases = Callocate(2) ' The number of aliases...right now we have 2 (0, 1)
cmdlst(0).aliases[0] = "grab"
cmdlst(0).aliases[1] = "steal"
cmdlst(0).assoc_f = @Take

cmdlst(1).name = "break"
cmdlst(1).aliases = Callocate(2) ' The number of aliases...right now we have 2 (0, 1)
cmdlst(1).aliases[0] = "smash"
cmdlst(1).aliases[1] = "destroy"
cmdlst(1).assoc_f = @Break

cmdlst(2).name = "push"
cmdlst(2).aliases = Callocate(0) ' The number of aliases...right now, we have 0 (i couldn't think of any)
cmdlst(2).assoc_f = @Push
END SUB

FUNCTION Valid_Command(command_ as any ptr) as integer
dim cmdi as integer ' command index
for cmdi = lbound(cmdlst) to ubound(cmdlst)
if(command_ = @cmdlst(cmdi).assoc_f) then
return 1
end if
next

return 0
END FUNCTION

FUNCTION Take(this as Object) as Boolean
return False
END FUNCTION

FUNCTION Break(this as Object) as Boolean
return False
END FUNCTION

FUNCTION Push(this as Object) as Boolean
return False
END FUNCTION[/syntax]

Oz~

:: Edit ::
I should explain the World and Scene types

If you've ever looked at quake code, you'd see how they save and load levels....through "lumps"

basically, a lump is a chunk of data....it has a starting point, and it has a length

here's a good example:
Code:
mynick$ = "Ozwald Smooth"
lump(1).offset = 1
lump(1).length = 6
' Lump(1) = "Ozwald"
lump(2).offset = 7
lump(2).length = 6
' Lump(2) = "Smooth"

It's jsut a quicker way of organizing multiple forms of data in one file

Here's how it would work in a file format (each line is a pseudo line in the file):
Quote:num_lumps%
lump_1_offset%
lump_2_offset%
(...)

Length_of_Lump_one%
data$

Length_of_Lump_two%
data$
(...)

So, in one file, we could have multiple rooms, with multiple mini-lumps inside, if we wanted

i hope that helps explain how it could work

if there are any other thoughts, please contribute...you can completely trash that base code if you have another idea...

if you don't feel like coding it, i probably can if i have a better idea of what I'm doing

Oz~
Because I'm new to FB, I am clueless to what you just did.(Been using QB too long)
The only thing non QB that he did is use pointers. With CAllocate, he allocated memory on the free store. Then, using pointer arithmetic, gave them a value. It's difficult to understand at first. You should read rdc's Introduction to Pointers. Here is the link: http://www.freebasic.net/wiki/wikka.php?...utPointers
gottabej2krei: chill out ok? ill stop asking you. but i thought there would at least be a couple big quests in the game and theres a couple different stories that are possible that you have to play the game a couple times to get to see.

oz: that lump idea sounds cool.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24