(04-29-2018, 07:25 AM)indru91112 Wrote: @marcus Is there any video tutorial for Gloom like you did for Raycasting and Platformer?
Not yet, I'm afraid
But the basics are quite simple. Here follows a small tutorial.
- Start the gloom map editor
- Without changing any settings, just click on the map to draw some lines (walls)
- Save the map somwhere as my_map.txt
- All the walls will be saved together with a value, and since you didn't change anything in the settings, this value will be 1. This value is important.
- Now create a new program in the same folder as my_map.txt and cut and paste this code:
Code:
import "gloom.lib"
import "Keycodes.lib"
import "Speed.lib"
set redraw off
if not GLOOM_Init(75.0, 640, 480) then end
if not GLOOM_LoadMap("my_map.txt") then end
load image 1, "my_wall.png"
_GLOOM_InitMap GLOOM_LoadedMapWidth(), GLOOM_LoadedMapHeight()
_GLOOM_BuildLoadedMapWalls
playerX# = float(GLOOM_LoadedMapWidth()/2)
playerZ# = float(GLOOM_LoadedMapHeight()/2)
playerAngle# = 0.0
do
if keydown(VK_LEFT)
playerAngle = playerAngle - 2.0
endif
if keydown(VK_RIGHT)
playerAngle = playerAngle + 2.0
endif
if keydown(VK_UP)
playerX = playerX + cos(playerAngle)*0.04
playerZ = playerZ + sin(playerAngle)*0.04
endif
if keydown(VK_DOWN)
playerX = playerX - cos(playerAngle)*0.04
playerZ = playerZ - sin(playerAngle)*0.04
endif
_GLOOM_PushOut playerX, playerZ, 0.3
set color GLOOM_FogR(), GLOOM_FogG(), GLOOM_FogB()
cls
_GLOOM_Render playerX, playerZ, playerAngle
redraw
_SPD_HoldFrame 60
until keydown(VK_ESC, true)
Before running the program, right click on this image and save it in the same folder as the map and your program:
Now the program should run fine.
I said that the value, 1, set for every wall in your map was important. It's important because it means that every wall in your map will use image 1. That's why we load the wall image as:
load image 1, "my_wall.png"
If you open the gloom map editor again, load your map, change the value next to "Value" to 2 and draw some lines, these new lines will be saved together with the value 2. And if you, in your program, load another image:
load image 2, "my_other_wall.png"
, the new walls will use that image.
That's the basics
- In the gloom map editor, use the value next to "Value" to decide what image (texture) to use for every new line (wall) that you draw
- In your program, load images with the same IDs as the values used in the map editor
If there's anything you don't get about the code, feel free to ask

The biggest difference compared to the raycaster editor is that the gloom map editor itself doesn't save any information about images. It only saves a value per wall. When you call "GLOOM_BuildLoadedMapWalls" you tell the library to build the loaded walls and to treat their values as image IDs. The gloom library is a bit more "low level" than the raycaster library.