ID:1601703
 
(See the best response by Dariuc.)
Problem description:
Some questions about the roguelike and generating dungeons on BYOND:
1-How is the map if I do not set any .dmm? I set maxx and maxy to 40 and maxz to 5. My assumption was that it would be 5 levels of a 40x40 map and that I could do this kind of thing...

for(var/z=1 to maxz)
for(var/y=1 to maxy)
for(var/x=1 to maxx)
if(x ==1 || y == 1 || x == world.maxx || y == world.maxy)
new/turf/permanent(locate(x,y,z))
else new/turf/wall(locate(x,y,z))


...and fill the map, but it won't work. Then I tried to include a .dmm empty with the dimensions I wanted and filled from there. It did not work too.

I thought that each level on the map was a area and all I needed to do was to replace this area with something like /area/cave. But I might be totally wrong so please, correct me.

2- I'm using the text mode for my roguelike but it isn't pretty. I want to make something cool like the Brogue style. But I can't seem to fit the maptext perfectly on the turf size. This is problably because I don't know the size of the font...

I also read that I should use CSS in the maptext but I can't understand how to make everything in one tag, so can you show me how to change the color and size of the maptext in one css tag?

Any tips about style of roguelikes on BYOND is appreciated.
Best response
Gland Mopa wrote:
Problem description:
Some questions about the roguelike and generating dungeons on BYOND:
1-How is the map if I do not set any .dmm? I set maxx and maxy to 40 and maxz to 5. My assumption was that it would be 5 levels of a 40x40 map and that I could do this kind of thing...

The way you assumed is correct. 5 maps of 40x40 squares. The z location in an atom's location would be the map it is on. So for instance, you are on the first map of the .dmm file, in the center, the player's location would be 20,20,1. To move to another Z level you would just increment the player's z variable.

mob
proc/Port()
var/turf/t=locate(20,20,5)
if(t)
src.loc=t
src<<"You teleported to the 5th realm!"


> for(var/z=1 to maxz)
> for(var/y=1 to maxy)
> for(var/x=1 to maxx)
> if(x ==1 || y == 1 || x == world.maxx || y == world.maxy)
> new/turf/permanent(locate(x,y,z))
> else new/turf/wall(locate(x,y,z))
>

...and fill the map, but it won't work. Then I tried to include a .dmm empty with the dimensions I wanted and filled from there. It did not work too.

I thought that each level on the map was a area and all I needed to do was to replace this area with something like /area/cave. But I might be totally wrong so please, correct me.
Areas work uniquely from other atoms in the sense that each area is counted as 1 entity, no matter where it is placed. So you can have the same area on different maps, and they all count as one.

An example of this would be creating territory for players to dispute over. You could paint the map with the territory then count how many turfs the player has converted to keep track of their territory disputes.


You could attempt to place default turfs on a blank map, then change them to whatever you like to test map generation.

I also stumbled across a lib for generating maps randomly that might be able to give you a pointer in the right direction.

http://www.byond.com/developer/Dan/maze

I've never really handled working with a purely text game to the point that I need to adjust the view, but I would imagine it works much like any other game.

You can set the view like so:
world
view="10x10"//or whatever size.


Then you can lock the size of the window in the interface if you wish, once you find the size that seems to work for you.
If you set world/maxx and world/maxy you'll get a map filled with /turf. The default mob/Login() places the mob at the first nondense tile it can find, starting at (1, 1, 1). You might be placing the mob at (1, 1, 1) and then replacing that turf.

Dungeon generation is an interesting problem. I wrote a library to do some of it a while ago, which you might find useful. Procedural generation of dungeons is more an art than a science - the best approach depends heavily on what you want your dungeons to look like. Things to pay attention to:

1) Reachability. You want everywhere on the map to be accessible starting from where the player starts.

2) Do you want dead ends?

3) Do you want loops?

The approach I've taken with my library is to generate a number of 'rooms' at random non-intersecting locations on the map. Each room is then converted into one or more 'regions' - collections of turfs that can all be reached from each other. Then I select a random border turf in two different regions and draw a path between them, collapsing the two regions into one. When I'm done generating those paths and have only one region, I draw some extra paths by selecting random border turfs and drawing a path between them. Other approaches also work - for example, you can do some interesting things with metaballs to generate 'cavern' maps. I suggest looking up information on 'procedural generation'.
Thanks for all the answers!

Maybe today or tomorrow I am going to start a topic on Design Philosophy about roguelikes in BYOND.
t is a turf, he can just do Move(t). Which one is 'right' depends heavily on how you want things to behave - if you want normal movement behaviour - Enter() and Entered() to be called, failing if it's dense (perhaps because another player is in there), etc., call Move(). If you just want to put the mob there, irrespective of density, just set the loc.

For actual online games with multiple players, I'd recommend having a starting /area, putting it on a few turfs in the starting area of the map, and Move()ing there:

area/start

mob/Login()
..()
Move(locate(/area/start))