Another Fork in the Road
To build the little world that players will be plinking at things in, my two main choices are either importing a BSP that I can create with one of the many utilities currently available for existing FPS’s or creating the game world manually. The makers of DarkBASIC also sell a 3D World Studio program that would probably be the best route to go, but that option comes with a price tag of about $50. Using a Quake level builder would probably speed things up, and the 3D World Studio’s price tag isn’t bad at all, however I think I’m going to go with manually building the game world. I’d benefit more from focusing my efforts on learning DarkBASIC rather than spreading the learning love in multiple directions.
The Great Little Tutorial that Kinda Sorta Could
The Huge Dungeons tutorial on the official site gave me all the information I needed to build my game world. It demonstrated how to convert a 2D ASCII map into a 3D world. If I keep the design completely simple, I can avoid needing any third party tools of any kind to create the world environment. I think what helped most about the tutorial code is that it doesn’t work right and only barely does what it’s supposed to. Figuring out where and why it’s broken helped me better understand how it worked.
So now the game within a game begins. I made my notes and shelved the tutorial in order to begin coding. Once the FPS is finished, I plan to go back and compare the tutorial code with how I coded mine to see where the similarities and differences are.
The building blocks of my dungeon…
I’ve decided on a small map, 30×30, in order to both keep resources down and keep the project from getting unwieldy. Creating the map was a fun little exercise in Notepad, and to read it I defined an array to store the type and number for each cell of the map.
| THE MAP |
THE CODE TO READ IT |
..................#####.......
..................# #.......
............########D####.....
....######### #.....
....# D # #.....
....# # D #.....
....### # ######
......# # # #
......####D## D #
........# # # #
........# #######D##D## #
........##D##.....# # ######
.........# #......# # #
.........# #......# # #
.........# #.....## ## #
.#########D####### # #
.# # ###D######## #
.# D # # #
.# # # #D#
.#### # # # #
....# # D #
....# # # # #
....# ##### # #### #
....# # # ###
.#### # # # #
.# ############ # D #
.# S # #
.# ############ ###
.####...........############..
..............................
|
`Variables and User-Defined Type
`================================
CELLX = 30
CELLZ = 30
STARTMAP$ = "MEDIA/MAP01.TXT"
OBJECTID = 1000
TYPE CELLINFO
OBJTYPE AS STRING
OBJNUM AS WORD
ENDTYPE
DIM CELLS(CELLX,CELLZ) as CELLINFO
`Load Map into Array
`================================
OPEN TO READ 1, STARTMAP$
FOR Z = 1 TO CELLZ
FOR X = 1 TO CELLX
READ BYTE 1,TMP
IF TMP > 30
CELLS(X,Z).OBJTYPE = CHR$(TMP)
CELLS(X,Z).OBJNUM = OBJECTID
OBJECTID = OBJECTID + 1
ELSE
X = X - 1
ENDIF
NEXT X
NEXT Z
CLOSE FILE 1
|
…
The next step is going to be creation of the objects from the data we have. I’ll post an update with that shortly as I am in the process of writing that now. These blogs actually serve as a nice diversion when I want to take a break from the project itself. The other alternative is Civ 5, but I know if I dare fire that up I’ll get nothing done for the rest of the night.