Re: Earwax

The typical approach is what's already been described -- a data structure for each thing on a map containing minimum and maximum x, y, and z coordinates, which in turn represents the size of that thing. The problem, of course, is exits/connections. The most obvious strategy for that is to base them on cardinal directions, but the problem is that you then can't have exits (say) midway on the northern wall without complicating that strategy. If I may take us back about 5-6 years, the strategy Danny and I used in DMPA and DMNB used the following strategy:

  1. Define a room.

  2. Create walls in the room.

  3. Add a door in the wall where you'd like connections to be at.

To accomplish the creation of maps, we used a simple command language; map files were written like so:

room
roomx 0
roomy 0
roomz 0
roomlengthx 50
roomlengthy 50
roomsound sounds/room10.ogg
roomname bridge
roomtype normal2
roomenv bridge
endroom
wall
wallx 0
wally 0
wallz 0
walllength 50
wallside 0
endwall
wall
wallx 0
wally 0
wallz 0
walllength 50
wallside 1
endwall
wall
wallx 50
wally 0
wallz 0
walllength 50
wallside 0
endwall
wall
wallx 2
wally 50
wallz 0
walllength 50
wallside 1
endwall
door
doorx 1
doory 50
doorz 0
dooropen sounds/dooropen.ogg
doorclose sounds/doorclose.ogg
enddoor

(And so on.)
This little system was crude; it was not a full programming language, nor did it contain any kind of syntactic ruleset or grammar. Any tokens that weren't recognized were ignored (neither of us knew how to write DFAs/NFAs and parsers back then). Around 2017-2018 we wrote a game engine in Python, which I am considering releasing, though I don't know if I will since it won't offer much benefit, and is most likely going to spark controversy and flamewars and such which I'd like to avoid. But I digress. The parser for this format was called the "old format" because we later switched to Lua, but being able to read these older map formats was useful because we already had content for that format and neither of us was willing to port the map definitions. The parser looked something like:

def loadoldmap(mapname):
    # ...
    room.cleanrooms()
    file = open(os.path.abspath("")+"/"+mapname)
    newstr = file.read()
    list = newstr.split("\n")
    for a in range(0, len(list)):
        if list[a]=="console":
            console1 = console.console()
            for m in range(a, len(list)):
                if list[m][:8]=="consolex":
                    console1.x = float(list[m][9:])
                if list[m][:8]=="consoley":
                    console1.y = float(list[m][9:])
                if list[m][:8]=="consolez":
                    console1.floor = float(list[m][9:])
                if list[m][:11]=="consolename":
                    console1.name = list[m][12:]
                if list[m][:11]=="consoletype":
                    console1.type = list[m][12:]
                if list[m][:14]=="consolestation":
                    console1.stations.append(list[m][15:])
                if list[m]=="endconsole":
                    if console1.name=="":
                        console1.name = console1.type
                    vars.objects.append(console1)
                    break
    # ...

Like I said, this was crude, but it was the way we used to do it, so perhaps it may offer inspiration.



-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Jayde via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Jayde via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Jayde via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector

Reply via email to