Help with Zones

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
Overlord
Yeek
Posts: 10
Joined: Sun Mar 03, 2013 3:07 pm

Help with Zones

#1 Post by Overlord »

Hello im looking for some help on zones.
I've read the how toos and couldnt see how to make a static map but have certain areas random rooms or actually i need them to be random static rooms again.

Example: (added alot of spaces to look right)
####MM####
#HHH HHH#
#HHH HHH#
#HHH HHH#
M M
M M
#HHH HHH#
#HHH HHH#
#HHH HHH#
####MM####

H:= a 3x3 random area could be a house could be a shop.
#:=Town walls
M: random chance of being a Town wall or Town Gate.

The reason i want the random areas to be a static map just inserted is because as far as im aware its the way to have npc's defined and placed with the room.

Any help will be appreciated and i suppose we could add this info to the wiki npc/zones module how too

urmane
Cornac
Posts: 40
Joined: Sun Jan 01, 2012 5:57 pm

Re: Help with Zones

#2 Post by urmane »

You can look at the ruins of kor pul zone to see how a mostly static map has a subgenerator for randomness in it.

Grey
Loremaster
Posts: 3517
Joined: Thu Sep 23, 2010 10:18 pm
Location: London, England
Contact:

Re: Help with Zones

#3 Post by Grey »

Looks to me like you just need a static map that you then alter yourself after generation. Essentially making your own generator.

However you might be able to make something with the Reknor style of level generator.

Not sure what you mean about placing NPCs - can you elaborate?

Also, when you want to show an ASCII map on the forums use code tags! It preserves character spacing.
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes

Overlord
Yeek
Posts: 10
Joined: Sun Mar 03, 2013 3:07 pm

Re: Help with Zones

#4 Post by Overlord »

Ok Thanks ill check both those out

The NPC is a character i can talk to and i want the NPC in a specific place so by what your both saying it sort of goes:

Big Static map with substatic maps dotted around inside it.
One of the substatic maps will have the NPC

lets say the big static map is a forest and there are 4 possible locations for a hut with a NPC character inside. The other 3 places will simply be a large rock. is that possible? i also cant have more than one of the hut type.

sorry about the ASCII map i dont tend to post on forums made an exception for this cool engine :oops:

EDIT: Ok I've made a static map not got the random parts working but as was pointed out a subGenerator is needed does anyone know if i can use more then one on a zone?

From blighted ruins map.

Code: Select all

subGenerator{
	x = 0, y = 9, w = 50, h = 41,   
-- Seems this is the magic bit i could use this 
--to randomise a set area, just i need to use 4 is that possible?...

	generator = "engine.generator.map.Roomer",
	data = {
		nb_rooms = 10,
		rooms = {"random_room"},
		['.'] = "FLOOR",
		['#'] = "WALL",
		up = "UP",
		door = "DOOR",
		force_tunnels = {
			{"random", {25, 8}, id=-500},
		},
	},
	define_up = true,
}
and i would use these in the blue boxes in the pic. Will make the static rooms ready tomorrow but first some much needed sleep :roll:
Image

Overlord
Yeek
Posts: 10
Joined: Sun Mar 03, 2013 3:07 pm

Re: Help with Zones

#5 Post by Overlord »

:D ok this is done and working as expected!
Image
Blue boxes show 5x5 random zone and the missing tiles is just tiles ive not made yet but its fully random and only one of each.

If anyone is interested in having mutiple static maps randomly assigned to a few locations then i will leave the map file i made with comments.

Code: Select all

-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org L

-- Table contains all the possible maps to be used. all 5x5
myTable = { "zones/akarastent", "zones/blacksmith", "zones/gheedscart", "zones/wasteland" }


--tile defines
defineTile("A", "WOODWALL1")
defineTile("B", "WOODWALL2")
defineTile("C", "WOODWALLSTART")
defineTile("D", "WOODWALLEND")
defineTile("E", "WOODWALLCORNER1")
defineTile("F", "WOODWALLCORNER2")
defineTile("G", "WOODWALLCORNER3")
defineTile("H", "WOODWALLCORNER4")
defineTile("I", "MLTENT1", nil, "KASHYA", nil, def)
defineTile("J", "MLTENT2")
defineTile("K", "MLTENT3")
defineTile("L", "MLTENT4")
defineTile("M", "MLTENT5")
defineTile("N", "MLTENT6")
defineTile("O", "MLTENT7")
defineTile("P", "MLTENT8")
defineTile("Q", "MLTENT9")
defineTile("R", "ROCKFEATL")
defineTile("S", "ROCKFEATR")
defineTile("T", "ACT1STASH")
defineTile("U", "GRASSTPON")
defineTile("V", "COBEND1")
defineTile("W", "COBEND2")
defineTile("X", "COBCORNER1")
defineTile("Y", "COBEND3")
defineTile("Z", "COBEND4")
defineTile("1", "COBCORNER3")
defineTile("2", "MTENT1")
defineTile("3", "MTENT2")
defineTile("4", "MTENT3")
defineTile("5", "MTENT4")
defineTile("6", "CART1")
defineTile("7", "DIRT")
defineTile("8", "CAMPFIRE")
defineTile("9", "DIRT", nil, "WARRIV", nil, def)
defineTile("?", "DIRT", nil, "DECKARD", nil, def)
defineTile("#", "WALL")
defineTile("+", "LOCK")
defineTile(".", "GRASS")
defineTile("-", "FLOOR")

startx = 7
starty = 1
endx = 1
endy = 1
--Randomly select a possible map
subgen1 = math.random(table.getn(myTable))
--Now find which one it matches
choice = myTable[subgen1]
table.remove(myTable, subgen1) --Remove that mapfrom the list if you do not want the same map to appear at another location

subGenerator{
   x = 2, y = 2, w = 5, h = 5,   --location.
   generator = "engine.generator.map.Static",
   data = {
    map = choice, --load from our 'choice' var
	zoom = 5,
   },
}

--exactly the same again.
subgen2 = math.random(table.getn(myTable))
--Now find which one it matches
choice = myTable[subgen2]
table.remove(myTable, subgen2) --Remove that mapfrom the list if you do not want the same map to appear at another location

subGenerator{
   x = 17, y = 2, w = 5, h = 5,    --location.
   generator = "engine.generator.map.Static",
   data = {
    map = choice, --load from our 'choice' var
	zoom = 5,
   },
}

--exactly the same again.
subgen3 = math.random(table.getn(myTable))
--Now find which one it matches
choice = myTable[subgen3]
table.remove(myTable, subgen3) --Remove that mapfrom the list if you do not want the same map to appear at another location


subGenerator{
   x = 17, y = 12, w = 5, h = 5,   --location.
   generator = "engine.generator.map.Static",
   data = {
    map = choice, --what ever our subgen is.
	zoom = 5,
   },
}
 
 --since ive removed from the list only 1 remains. else ud do the same as the last one.
choice = myTable[1]

subGenerator{
   x = 2, y = 12, w = 5, h = 5, --location.   
   generator = "engine.generator.map.Static",
   data = {
    map = choice,  --what ever our subgen is.
	zoom = 5,
   },
}

-- ASCII map section
return [[
FAAAAAAAAAAAAAAAAAAAAAAE
B......................B
B.#####.RS.OPQ...#####.B
B.#####....LMN.U.#####.B
B.#####....IJK...#####.B
B.#####.XV..7....#####.B
B.#####.WT..7....#####.B
C777777.....7...7777777C
.7.D..7....97?..7...D.7.
77.B6.77777787777.6.B.77
...C.......777......C...
D............7.........D
B.#####...23.7.Y.#####.B
B.#####...45.7Z1.#####.B
B.#####......7...#####.B
B.#####..........#####.B
B.#####...RS..6..#####.B
B......................B
GAAAAAAAAAAAAAAAAAAAAAAH]]

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Help with Zones

#6 Post by darkgod »

Diablo clone ? :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Overlord
Yeek
Posts: 10
Joined: Sun Mar 03, 2013 3:07 pm

Re: Help with Zones

#7 Post by Overlord »

Haha it had to happen at somepoint! :lol:

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Help with Zones

#8 Post by darkgod »

True enough ! :)
How far along are you ?
You can join us on irc.rizon.net on channel #tome if you want to talk a bit, ask questions :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Overlord
Yeek
Posts: 10
Joined: Sun Mar 03, 2013 3:07 pm

Re: Help with Zones

#9 Post by Overlord »

yeah im not very far at all ive pretty much just started although i have the monsters for the first two acts ive not given them any realistic stats. My next stage is just to get the areas of act 1 down so its mostly just graphical at the moment but thats the slow bit i had to remake that large tent in 3d max because the game is isometric i cant use much from it.

Thanks been checking that irc out for the last two days pretty cool i know where to beg for help :D

chezzo
Higher
Posts: 55
Joined: Thu Aug 16, 2012 10:52 pm
Location: Philadelphia, Pennsylvania, USA
Contact:

Re: Help with Zones

#10 Post by chezzo »

Post your code, please! We need some more code examples like we need food and air.

Post Reply