'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
'º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ASCII TERRAIN ENGINE ÛÛßßÛÛ ÛÛßßÛÛ º
'º ÛÛ Û ÛÛ ® Generator Module v1.0 ¯ ÛÛ ÞÛÛ ÛÛÛÛÛ º
'º ÛÛ Û Û Û ÛÛ (to be integreated in ATE) ÛÛÜÞÛÛ ÛÛÜÜÛÛ º
'º Û Û Û Still rough but usable ßß º
'º ÛÛ Û Û Û ÛÛ ------------ ÛÛßßßß ÛÛ ÛÛ º
'º ÛÛ Û Û ÛÛ By Virtusoroca-Brazil, 2020 ÛÛßßÛÛ ÛÛÜÜÛÛ º
'º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ Made in QB64 ÛÛÜÜÛÛ ÛÛ º
'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
'================================================================= 1. SYSTEM SETTINGS
ScreenX = 800: ScreenY = 1200
CharX = 50: CharY = 100
'FontSize = 16
'================================================================= 2. SUBPROCEDURES DECLARATIONS
DECLARE SUB Reload
(ScreenX
, ScreenY
, CharX
, CharY
) DECLARE SUB ProceduralGeneration
(CharX
, CharY
, MoundAscii$
, MoundFColor
, MoundBColor
, PlainAscii$
, PlainFColor
, PlainBColor
, WaterAscii$
, WaterFColor
, WaterBColor
, MoundChance
, MoundBoldness
, WaterLevel
) '================================================================= 3. VARIABLES DECLARATION
'================================================================= 4. MAIN PROCEDURE
PrintMenu
Reload ScreenX, ScreenY, CharX, CharY
ProceduralGeneration CharX, CharY, MoundAscii$, MoundFColor, MoundBColor, PlainAscii$, PlainFColor, PlainBColor, WaterAscii$, WaterFColor, WaterBColor, MoundChance, MoundBoldness, WaterLevel
'========================================================= 4.1. UserDefined
MoundAscii$ = "²": MoundFColor = 6: MoundBColor = 7
PlainAscii$ = "Û": PlainFColor = 2: PlainBColor = 0
WaterAscii$ = "Û": WaterFColor = 3: WaterBColor = 0
MoundChance = 0: MoundBoldness = 55: WaterLevel = 1
'===================================================== 4.2. BayArea
MoundAscii$ = "²": MoundFColor = 2: MoundBColor = 7
PlainAscii$ = "Û": PlainFColor = 2: PlainBColor = 0
WaterAscii$ = "Û": WaterFColor = 3: WaterBColor = 0
MoundChance = 0: MoundBoldness = 55: WaterLevel = 1
'===================================================== 4.3. Archipelago
MoundAscii$ = "^": MoundFColor = 6: MoundBColor = 2
PlainAscii$ = "Û": PlainFColor = 2: PlainBColor = 0
WaterAscii$ = "Û": WaterFColor = 3: WaterBColor = 0
MoundChance = 0: MoundBoldness = 35: WaterLevel = 2
'===================================================== 4.4. Swamp
MoundAscii$ = "°": MoundFColor = 2: MoundBColor = 0
PlainAscii$ = "°": PlainFColor = 6: PlainBColor = 0
WaterAscii$ = "°": WaterFColor = 6: WaterBColor = 3
MoundChance = 10: MoundBoldness = 25: WaterLevel = 2
'===================================================== 4.5. Icelands
MoundAscii$ = "^": MoundFColor = 29: MoundBColor = 27
PlainAscii$ = "Û": PlainFColor = 27: PlainBColor = 0
WaterAscii$ = "Û": WaterFColor = 11: WaterBColor = 0
MoundChance = 30: MoundBoldness = 0: WaterLevel = 1
'===================================================== 4.6. Barren
MoundAscii$ = " ": MoundFColor = 14: MoundBColor = 6
PlainAscii$ = ".": PlainFColor = 14: PlainBColor = 6
WaterAscii$ = "": WaterFColor = 14: WaterBColor = 6
MoundChance = 5: MoundBoldness = 45: WaterLevel = 2
'===================================================== 4.7. AlienPlanet
MoundAscii$ = " ": MoundFColor = 21: MoundBColor = 18
PlainAscii$ = "^": PlainFColor = 0: PlainBColor = 18
WaterAscii$ = "°": WaterFColor = 18: WaterBColor = 5
MoundChance = 5: MoundBoldness = 45: WaterLevel = 5
'=====================================================
'CASE "-": FontSize = FontSize - 1
'CASE "+": FontSize = FontSize + 1
SaveImageFile CharX, CharY
'=============================================================
'================================================================= 5. SUBROUTINES
'================================================================= 5.1. PrintMenu
FOR MenuColumnX
= 1 TO 50 '================================================================= 5.2. Reload
SUB Reload
(ScreenX
, ScreenY
, CharX
, CharY
) ' font& = _LOADFONT("PerfectDOSVGA437Win.ttf", FontSize, "monospace")
' _FONT font&
' CharX = INT(ScreenX / _FONTHEIGHT)
' CharY = INT(ScreenY / _FONTWIDTH)
Tile(X, Y).block = 0
Tile(X, Y).check = 0
Tile(X, Y).num = 0
Tile(X, Y).sum = 0
Tile(X, Y).x = X
Tile(X, Y).y = Y
'================================================================= 5.3. ProceduralGeneration
SUB ProceduralGeneration
(CharX
, CharY
, MoundAscii$
, MoundFColor
, MoundBColor
, PlainAscii$
, PlainFColor
, PlainBColor
, WaterAscii$
, WaterFColor
, WaterBColor
, MoundChance
, MoundBoldness
, WaterLevel
) '============================================================= 5.3.1. MoundChance
Tile(X, Y).ascii = MoundAscii$: Tile(X, Y).fcolor = MoundFColor: Tile(X, Y).bcolor = MoundBColor
Tile(X, Y).num = 1
Tile(X, Y).check = 1
LOCATE X
, Y:
COLOR Tile
(X
, Y
).fcolor
, Tile
(X
, Y
).bcolor:
PRINT Tile
(X
, Y
).ascii;
'============================================================= 5.3.2. MoundBoldness
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X - 1, Y - 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X - 1, Y + 0).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X - 1, Y + 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 0, Y - 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 0, Y + 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 1, Y - 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 1, Y + 0).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 1, Y + 1).num
IF Tile
(X
, Y
).sum
>= 1 THEN '===================== Higher the sum restrictions for MoundBoldness, higher the WaterLevel Tile(X, Y).ascii = MoundAscii$: Tile(X, Y).fcolor = MoundFColor: Tile(X, Y).bcolor = MoundBColor
Tile(X, Y).num = 1
Tile(X, Y).check = 2
LOCATE X
, Y:
COLOR Tile
(X
, Y
).fcolor
, Tile
(X
, Y
).bcolor:
PRINT Tile
(X
, Y
).ascii;
'============================================================= 5.3.3. Plains (surrounding Mounds)
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X - 1, Y - 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X - 1, Y + 0).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X - 1, Y + 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 0, Y - 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 0, Y + 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 1, Y - 1).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 1, Y + 0).num
Tile(X, Y).sum = Tile(X, Y).sum + Tile(X + 1, Y + 1).num
IF Tile
(X
, Y
).sum
>= WaterLevel
THEN Tile(X, Y).ascii = PlainAscii$: Tile(X, Y).fcolor = PlainFColor: Tile(X, Y).bcolor = PlainBColor
Tile(X, Y).check = 3
LOCATE X
, Y:
COLOR Tile
(X
, Y
).fcolor
, Tile
(X
, Y
).bcolor:
PRINT Tile
(X
, Y
).ascii;
'============================================================= 5.3.4. Water (fill the rest in) [for WaterLevel see MoundBoldness)
Tile(X, Y).ascii = WaterAscii$: Tile(X, Y).fcolor = WaterFColor: Tile(X, Y).bcolor = WaterBColor: Tile(X, Y).block = 1
LOCATE X
, Y:
COLOR Tile
(X
, Y
).fcolor
, Tile
(X
, Y
).bcolor:
PRINT Tile
(X
, Y
).ascii;
'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 5.4. SaveImageFile
SUB SaveImageFile
(CharX
, CharY
) WRITE #1, Tile
(A
, B
).x
, Tile
(A
, B
).y
, Tile
(A
, B
).fcolor
, Tile
(A
, B
).bcolor
, ASC(Tile
(A
, B
).ascii
), Tile
(A
, B
).block
'================================================================= 6. END OF PROGRAM