Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Loading text files as maps...

Author
Message
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 1st Jun 2003 22:56
I'm designing a text RPG in DBPro, and instead of completely hard-coding the game, I need a way to load a file and use it for a map.

Basically, the text file would have tokens in it telling the engine what directions you could go (north, south, east, west, up, or down), any enemies (and their stats, although I was thinking of having a text file for those too and just having the game reference the database when needed), and anything on the ground, plus the description and text-color tokens for the current area. I'm not sure how the MUDs did this, but I would sure like to know.

Anyway, I was wondering if anyone had anything like this already done so I could get an idea. I'm stumped on how to go about this. If this doesn't work out, I might try a Rogue-style text rpg that uses ACSII levels and that sort of thing.
Attreid
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 1st Jun 2003 23:09 Edited at: 1st Jun 2003 23:10
you should use arrays, it may be easier
type m
west
ease
north
south
enemy
...
endtype
dim map(100,100) as m


"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 2nd Jun 2003 06:33
Possibly, but what about customizing? If I were to make it a full-fledged program, I would want it to be customizable, hence the text files. Maybe I'm dreaming over something I'm unable to do...
The Darthster
23
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 2nd Jun 2003 12:22
Here's the high score table code from Duck Hunter 3D:



This code contains bits for reading and writing arrays into a file.

You'll need a string array of location descriptions, both long and short, and a flag array saying which directions you can go in. Also a string array of object names and descriptions, a number array of object positions relating to the index of the location arrays, and a similar set for enemies. You'll have to hardcode enemy behaviour, but then you could program several behaviour sets and assign one to each enemy, making different types move and attack differently.

Once I was but the learner,
now, I am the Master.
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 3rd Jun 2003 09:07
Hmmm...I think I understand. I'll give it a try.
iac249
23
Years of Service
User Offline
Joined: 26th Mar 2003
Location: USA
Posted: 3rd Jun 2003 18:31
Try downloading the Huge Dungeon demo and take a look at what they have done.
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 3rd Jun 2003 19:40
room01.dungeon file
monster=orc.monster
monster=goblin.monster
monster=goblin.monster
description=
You are in a dank dungeon, the smell of cordite is in the air - somebody has been letting loose with a shotgun
[end description]
playmusic=dungeonatmos.mp3
exit=N:room02.dungeon
exit=S:room03.dungeon

Now the main code:


Pneumatic Dryll
Duffer
23
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 5th Jun 2003 02:10
A genuine text file (ie. *.txt) that you could generate in say Notepad - could you read it on the basis of strings (ie. each line of text) followed by Chr$(10) + Chr$(13)???

Or in other words, how do you go about nicking string variable from a text file line by line????

Login to post a reply

Server time is: 2026-07-11 19:06:14
Your offset time is: 2026-07-11 19:06:14