DRL > Discussion
More intro-level layouts needed!
Kornel Kisielewicz:
By now you probably all know all the intro level layouts, there are only 5 of them. I think that it would be fun to raise that number to 10 or even 20! Instead of coming up with more, I decided to ask you folks for input?
So, here are the rules, this is a sample level:
--- Code: ---.......................................................
..............,,,,,,,,,,,,,............................
.....,,,,..,,,,,,,########,,,,,,,,,,,....,,,,,,,,,.....
.......,,,,,,,,,,,#,,,,,,#########,,,,,,,,,,,,,,,,,,,..
........,,,,,,,,,,#1,,,,,+,,,,,,,#3,,,,,,,,,,,,,,,,,,,.
......,,,,,,,,,####+###,,#2,,,,,,#######,,,,,,,,,,,,,..
.....,,,,,,,,,,#,,,,,,########,,,#,4,,*#,,,,,,,,,,,,...
.....,,,,,,,,,,#1,,,,,+,,,PH>#,,,+,,,,,+,,,,,,,,,,,....
.......,,,,,,,,#,,,,,,########,,,#,4,,*#,,,,,,,,,......
.....,,,,,,,,,,####+###,,#2,,,,,,#######,,,,,,,,,,,,...
......,,,,,,,,,,,,#1,,,,,+,,,,,,,#3,,,,,,,,,,,,,,,,....
......,,,,,,,,,,,,#,,,,,,#########,,....,,,,,,,,,,,....
........,,,,,,,,,,########,,,,,,,......................
..........,,,,,,,,,,,,,,,,,,,,,........................
..............,,,,,.....,,,,...........................
--- End code ---
* the level *must* be 55x15
* the level will be surrounded by the standard empty space
* only the markers below may be used
* the amount of markers needs to be the same, and all need to be present
* try not to make it too hard for players (e.g. immedate sergeants outside)
The legend:
--- Code: ---. - phobos rock
, - floor
# - wall
+ - closed door
> - stairs down
* - medkit
P - challenge dependant 1-st level reward (should be by the stairs)
H - guaranteed sergeant (*1)
1 - guaranteed former (*3)
2 - if DIFF > ITYTD former else floor (*2)
3 - if DIFF > HMP former else floor (*2)
4 - if DIFF > HMP sergeant else if DIFF > HNTR then former else floor (*2)
--- End code ---
Let's play :D
Shoop da Whoop:
--- Code: ---.......................................................
..............,,,,,,,,,,,,,............................
.....,,,,..,,,,,,,,#######,,,,,,,,,,,....,,,,,,,,,.....
.......,,,,,,,,,,,,#*,,,,###3,,,,,,,,,,,,,,,,,,,,,,,,..
........,,,,,,,,,,,#,,,,1+,###,,,,,,,,,,,,,,,,,,,,,,,,.
......,,,,,,,,,#####,,,,,#2,,###,,,,###,,,,,,,,,,,,,,..
.....,,,,,,,,,,#,,,#######,,,,,###,,,,#,,,,,,,,,,,,,...
.....,,,,,,,,,,#>HP+,,1,,+,,,4,,,+,,,4+,,,,,,,,,,,,....
.......,,,,,,,,#,,,#######,,,,,###,,,,#,,,,,,,,,,......
.....,,,,,,,,,,#####,,,,,#2,,###,,,,###,,,,,,,,,,,,,...
......,,,,,,,,,,,,,#,,,,1+,###,,,,,,,,,,,,,,,,,,,,,....
......,,,,,,,,,,,,,#*,,,,###3,,,,,,,....,,,,,,,,,,,....
........,,,,,,,,,,,#######,,,,,,,,.....................
..........,,,,,,,,,,,,,,,,,,,,,........................
..............,,,,,.....,,,,...........................
--- End code ---
The idea is: you can run straightforward to get out faster or you can try to get medpacks after some time. Thing before door is something like entrance "gates", with guard, heh.
General Patton:
The problem I see with that one is that even on ITYTD, it is impossible to stop formers from grabbing the medkits. Perhaps the medkits could be stuffed into little closets. This makes it almost guaranteed that you'll get them, which helps balance the fact that everything will wander into the first room where the entrance is too narrow to sidestep in.
--- Code: ---.......................................................
..............,,,,,,,,,,,,,............................
.....,,,,..,,,,,,#########,,,,,,,,,,,....,,,,,,,,,.....
.......,,,,,,,,,,#*+,,,,,###3,,,,,,,,,,,,,,,,,,,,,,,,..
........,,,,,,,#####,,,,1+,###,,,,,,,,,,,,,,,,,,,,,,,,.
......,,,,,,,,,#,,,#,,,,,#2,,###,,,,###,,,,,,,,,,,,,,..
.....,,,,,,,,,,#,,,#######,,,,,###,,,,#,,,,,,,,,,,,,...
.....,,,,,,,,,,#>HP+,,1,,+,,,4,,,+,,,4+,,,,,,,,,,,,....
.......,,,,,,,,#,,,#######,,,,,###,,,,#,,,,,,,,,,......
.....,,,,,,,,,,#,,,#,,,,,#2,,###,,,,###,,,,,,,,,,,,,...
......,,,,,,,,,#####,,,,1+,###,,,,,,,,,,,,,,,,,,,,,....
......,,,,,,,,,,,#*+,,,,,###3,,,,,,,....,,,,,,,,,,,....
........,,,,,,,,,#########,,,,,,,,.....................
..........,,,,,,,,,,,,,,,,,,,,,........................
..............,,,,,.....,,,,...........................
--- End code ---
Edit: Perhaps a way to keep the sergeant in the final room instead of wandering to the center would help balance the difficulty. Same goes for preventing going around the gate and hitting the second door on a diagonal, which is faster than a straight line through both doors. Plus it's too easy to corner shoot the UV/N! sergeant, at least too easy for also having guaranteed medkits.
--- Code: ---.......................................................
..............,,,,,,,,,,,,,............................
.....,,,,..,,,,,,#########,,,,,,,,,,,....,,,,,,,,,.....
.......,,,,,,,,,,#*+,,,,,###3,,,,,,,,,,,,,,,,,,,,,,,,..
........,,,,,,,#######,,1+,###,,,,,,#,,,,,,,,,,,,,,,,,.
......,,,,,,,,,#,,,+,#,,,#2,,###,,,,###,,,,,,,,,,,,,,..
.....,,,,,,,,,,#,,,#,#####,,,,,####,,,#,,,,,,,,,,,,,...
.....,,,,,,,,,,#>HP#,,1,,+,,,4,,,+,,,4+,,,,,,,,,,,,....
.......,,,,,,,,#,,,#,#####,,,,,####,,,#,,,,,,,,,,......
.....,,,,,,,,,,#,,,+,#,,,#2,,###,,,,###,,,,,,,,,,,,,...
......,,,,,,,,,#######,,1+,###,,,,,,#,,,,,,,,,,,,,,....
......,,,,,,,,,,,#*+,,,,,###3,,,,,,,....,,,,,,,,,,,....
........,,,,,,,,,#########,,,,,,,,.....................
..........,,,,,,,,,,,,,,,,,,,,,........................
..............,,,,,.....,,,,...........................
--- End code ---
Shoop da Whoop:
I think, you're right here.
It's hard to get 20 starting levels with enough differences. So it's better make them as different as possible, even having not so big number.
AStranger:
So I woke up this morning, saw this thread and thought, 'Hey it'd be cool if I could actually play the levels posted here'. I figured I could make a sandbox level that I could just paste into and be able to test the level. Unfortunately I couldn't get Level.place_tile to work with items and mobs, which got me thinking about writing a script to do the conversion. At that point I realized that more than just linux users might want to try this out so I settled on using racket, here is what I've come up with:
Spoiler (click to show/hide)
--- Code: ---#lang racket
;Phobos testing v0.1
(require racket/gui/base)
(define luaTop
(list "Levels(\"CUSTOM\",{"
"name = \"Phobos Test\","
"mortem = \"\","
"mortem_desc = \"in testing\","
"Create = function ()"
"Level.fill(\"wall\")"
"local translation = {"
"['.'] = \"rock\","
"[','] = \"floor\","
"['#'] = \"wall\","
"['+'] = \"door\","
"['>'] = \"stairs\","
"['*'] = \"floor\","
"['P'] = \"floor\","
"['H'] = \"floor\","
"['1'] = \"floor\","
"['2'] = \"floor\","
"['3'] = \"floor\","
"['4'] = \"floor\""
"}"
"local center = [["
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"............................................................................"
"]]"
"local map = [["))
(define luaMiddle
(list "]]"
"Level.place_tile(translation, center, 2, 2 )"
"Level.place_tile(translation, map, 9, 3 )"
""))
(define luaBottom
(list "end,"
"OnEnter = function ()"
"player.eq.weapon = item.new(\"pistol\")"
"end,"
"OnKill = function ()"
"end,"
"OnKillAll = function ()"
"end,"
"OnExit = function ()"
"levels.CUSTOM.mortem = \"fled alive the trials\""
"end,"
"})"))
(define frontal #t)
(define currentDiff 3)
(define diffVec
(vector
#hash(("*" . "Level.drop_item(\"smed\", coord.new(")
("P" . "Level.drop_item(\"garmor\", coord.new(")
("H" . "Level.drop_being(\"sergeant\", coord.new(")
("1" . "Level.drop_being(\"former\", coord.new("))
#hash(("*" . "Level.drop_item(\"smed\", coord.new(")
("P" . "Level.drop_item(\"garmor\", coord.new(")
("H" . "Level.drop_being(\"sergeant\", coord.new(")
("1" . "Level.drop_being(\"former\", coord.new(")
("2" . "Level.drop_being(\"former\", coord.new("))
#hash(("*" . "Level.drop_item(\"smed\", coord.new(")
("P" . "Level.drop_item(\"garmor\", coord.new(")
("H" . "Level.drop_being(\"sergeant\", coord.new(")
("1" . "Level.drop_being(\"former\", coord.new(")
("2" . "Level.drop_being(\"former\", coord.new(")
("4" . "Level.drop_being(\"former\", coord.new("))
#hash(("*" . "Level.drop_item(\"smed\", coord.new(")
("P" . "Level.drop_item(\"garmor\", coord.new(")
("H" . "Level.drop_being(\"sergeant\", coord.new(")
("1" . "Level.drop_being(\"former\", coord.new(")
("2" . "Level.drop_being(\"former\", coord.new(")
("3" . "Level.drop_being(\"former\", coord.new(")
("4" . "Level.drop_being(\"sergeant\", coord.new("))))
(define (pass-inspection aString)
((lambda (stringList)
(and (= (length stringList) 15)
(null? (filter (compose not
(curry = 55)
string-length)
stringList))))
(regexp-split #rx"\n" (regexp-replace #rx"\r" aString ""))))
(define (generate-level aButton anEvent)
(call-with-values (lambda () (values (send tehArea get-value)
(open-output-file (send fileName get-value)
#:mode 'text
#:exists 'replace)))
(lambda (mapArea newPort)
(cond [(and (pass-inspection mapArea))
(begin
(write-string
(string-append (string-join luaTop "\n")
mapArea
(string-join luaMiddle "\n")
(if frontal "Level.player(75,10)\n" "Level.player(2,2)\n")
(place-stuff mapArea (vector-ref diffVec currentDiff))
(string-join luaBottom "\n")) newPort)
(close-output-port newPort))]
[else
((lambda (popUp)
(new message%
[label "The map should be 55x15"]
[parent popUp])
(send popUp show #t))
(new dialog%
[label "Error - map size"]))]))))
(define (change-difficulty aPos aButton anEvent)
(begin
(send (vector-ref buttonVec currentDiff) enable #t)
(set! currentDiff aPos)
(send (vector-ref buttonVec currentDiff) enable #f)))
(define (spot->string aNum)
(string-append (number->string (+ 9 (remainder aNum 56))) "," (number->string (+ (quotient aNum 56) 3))))
(define (place-stuff aString aHash)
(apply string-append
(filter (negate null?)
(map (lambda (aCons)
((lambda (hashRet)
(if (= (string-length hashRet) 0) null
(string-append hashRet
(spot->string (car aCons)) "))\n")))
(hash-ref aHash (substring aString (car aCons) (cdr aCons)) "")))
(regexp-match-positions* #rx"[\\*PH1-4]" aString)))))
(define tehFrame
(new frame%
[label "Phobos base testing"]
[width 700]
[height 450]))
(define outerBox
(new vertical-panel%
[parent tehFrame]))
(define buttonBox
(new horizontal-panel%
[stretchable-height #f]
[parent outerBox]))
(define difficultyBox
(new horizontal-panel%
[stretchable-height #f]
[parent outerBox]))
(define goButton
(new button%
[label "Generate level"]
[callback generate-level]
[parent buttonBox]))
(define fButton
(new button%
[label "FRONT"]
[callback (lambda (aB anE)
(if frontal
(begin
(set! frontal #f)
(send aB set-label "BACK"))
(begin
(set! frontal #t)
(send aB set-label "FRONT"))))]
[parent difficultyBox]))
(define difficultyLabel
(new message%
[label "Difficulty:"]
[parent difficultyBox]))
(define buttonVec
(vector
(new button%
[label "ITYTD"]
[callback (curry change-difficulty 0)]
[enabled #t]
[parent difficultyBox])
(new button%
[label "HNTR"]
[callback (curry change-difficulty 1)]
[enabled #t]
[parent difficultyBox])
(new button%
[label "HMP"]
[callback (curry change-difficulty 2)]
[enabled #t]
[parent difficultyBox])
(new button%
[label "UV+"]
[callback (curry change-difficulty 3)]
[enabled #f]
[parent difficultyBox])))
(define fileName
(new text-field%
[style (list 'single)]
[label "Output:"]
[init-value "default.lua"]
[parent buttonBox]))
(define tehArea
(new text-field%
[style (list 'multiple)]
[font (make-object font% 14 'modern)]
[init-value (string-join (list "......................................................."
"..............,,,,,,,,,,,,,............................"
".....,,,,..,,,,,,,########,,,,,,,,,,,....,,,,,,,,,....."
".......,,,,,,,,,,,#,,,,,,#########,,,,,,,,,,,,,,,,,,,.."
"........,,,,,,,,,,#1,,,,,+,,,,,,,#3,,,,,,,,,,,,,,,,,,,."
"......,,,,,,,,,####+###,,#2,,,,,,#######,,,,,,,,,,,,,.."
".....,,,,,,,,,,#,,,,,,########,,,#,4,,*#,,,,,,,,,,,,..."
".....,,,,,,,,,,#1,,,,,+,,,PH>#,,,+,,,,,+,,,,,,,,,,,...."
".......,,,,,,,,#,,,,,,########,,,#,4,,*#,,,,,,,,,......"
".....,,,,,,,,,,####+###,,#2,,,,,,#######,,,,,,,,,,,,..."
"......,,,,,,,,,,,,#1,,,,,+,,,,,,,#3,,,,,,,,,,,,,,,,...."
"......,,,,,,,,,,,,#,,,,,,#########,,....,,,,,,,,,,,...."
"........,,,,,,,,,,########,,,,,,,......................"
"..........,,,,,,,,,,,,,,,,,,,,,........................"
"..............,,,,,.....,,,,...........................")
"\n")]
[label "Level:"]
[parent outerBox]))
(send tehFrame show #t)
--- End code ---
Simply save the code to a .rkt file and run it with DrRacket. The interface should be pretty straight forward. There is a text area for the level, buttons for changing the difficulty level, a button for front/back toggling, a file name text area and a generate button. Simply paste in the level, select your options and hit generate.
Caveats:
DrRacket runs on Linux/OSX/Windows, but you'll need it installed because I was way too lazy to create/post binaries. You can get it here http://racket-lang.org/.
I wrote this under Linux but briefly tested it under a virtual Windows. It seems to work correctly. It was written with DrRacket v5.0.1 but tested with v5.1.1(current). They both seem to work.
I didn't do the greatest error checking in the world, there is a rough check to see if the map is the right size and it doesn't check the filename, it just assumes it is correct.
If you use any other symbol than the ones already defined, I'm not sure what will happen. It should still generate a playable level, but I never tried.
I think I lined up the map/player placement correctly, but I could be wrong.
Here is some sample output from the second map from General Patton's post:
Spoiler (click to show/hide)
--- Code: ---Levels("CUSTOM",{
name = "Phobos Test",
mortem = "",
mortem_desc = "in testing",
Create = function ()
Level.fill("wall")
local translation = {
['.'] = "rock",
[','] = "floor",
['#'] = "wall",
['+'] = "door",
['>'] = "stairs",
['*'] = "floor",
['P'] = "floor",
['H'] = "floor",
['1'] = "floor",
['2'] = "floor",
['3'] = "floor",
['4'] = "floor"
}
local center = [[
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
]]
local map = [[.......................................................
..............,,,,,,,,,,,,,............................
.....,,,,..,,,,,,#########,,,,,,,,,,,....,,,,,,,,,.....
.......,,,,,,,,,,#*+,,,,,###3,,,,,,,,,,,,,,,,,,,,,,,,..
........,,,,,,,#######,,1+,###,,,,,,#,,,,,,,,,,,,,,,,,.
......,,,,,,,,,#,,,+,#,,,#2,,###,,,,###,,,,,,,,,,,,,,..
.....,,,,,,,,,,#,,,#,#####,,,,,####,,,#,,,,,,,,,,,,,...
.....,,,,,,,,,,#>HP#,,1,,+,,,4,,,+,,,4+,,,,,,,,,,,,....
.......,,,,,,,,#,,,#,#####,,,,,####,,,#,,,,,,,,,,......
.....,,,,,,,,,,#,,,+,#,,,#2,,###,,,,###,,,,,,,,,,,,,...
......,,,,,,,,,#######,,1+,###,,,,,,#,,,,,,,,,,,,,,....
......,,,,,,,,,,,#*+,,,,,###3,,,,,,,....,,,,,,,,,,,....
........,,,,,,,,,#########,,,,,,,,.....................
..........,,,,,,,,,,,,,,,,,,,,,........................
..............,,,,,.....,,,,...........................]]
Level.place_tile(translation, center, 2, 2 )
Level.place_tile(translation, map, 9, 3 )
Level.player(75,10)
Level.drop_item("smed", coord.new(27,6))
Level.drop_being("former", coord.new(37,6))
Level.drop_being("former", coord.new(33,7))
Level.drop_being("former", coord.new(35,8))
Level.drop_being("sergeant", coord.new(26,10))
Level.drop_item("garmor", coord.new(27,10))
Level.drop_being("former", coord.new(31,10))
Level.drop_being("sergeant", coord.new(38,10))
Level.drop_being("sergeant", coord.new(46,10))
Level.drop_being("former", coord.new(35,12))
Level.drop_being("former", coord.new(33,13))
Level.drop_item("smed", coord.new(27,14))
Level.drop_being("former", coord.new(37,14))
end,
OnEnter = function ()
player.eq.weapon = item.new("pistol")
end,
OnKill = function ()
end,
OnKillAll = function ()
end,
OnExit = function ()
levels.CUSTOM.mortem = "fled alive the trials"
end,
})
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version