ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Wed Dec 13, 2017 1:34 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Jun 10, 2013 12:38 pm 
Offline
Sher'Tul

Joined: Sat Mar 01, 2003 4:01 pm
Posts: 1067
One can use the 'levels' field in zone.lua to have the levels of a zone use different sizes, layouts, generators...

This is quite useful, but what if one wanted to create a very deep zone where each level changed followed a pattern/function?

For example, making a dungeon smaller or larger with each level or alternating level layouts/map generators,
Doing this manually for a large amount of levels is possible, but frustrating.

So I'm asking for 'width' and 'height'(and other fields where it makes sense) to allow functions, and also for a way to change the generators/other properties of specific level using a function. In both cases of course level would be a required argument...

For example, say I wanted every even level of my zone to have no NPCs, then I could use...

Code:
adjust_level = function(zone, level) if level % 2 == 0 then zone.generator.actor.nb_npc = {0,0} end
...


(this is of course pseudocode, it shouldn't actually alter the zone but only the parameters for the level to be generated)

_________________
ToME online profile: http://te4.org/users/zonk
Addons (most likely obsolete): Wights, Trolls, Starting prodigy, Alternate save/resistance system


Last edited by Zonk on Tue Jun 11, 2013 6:51 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Jun 11, 2013 4:20 pm 
Offline
Uruivellas

Joined: Thu Nov 18, 2010 6:42 pm
Posts: 744
I agree, this would be a nice feature.

In the meantime, I've put in code to make level by level adjustments for Infinite500 via the on_setup (called when the zone is loaded) and on_leave (called when leaving each level) functions in the zone definition table:

Code:
on_setup = function(self)
      self.width = 50 + rng.range(0,40)
      self.height = math.ceil(4900/self.width)
      self:updateBaseLevel()
      self.generator.map.rooms = {"random_room", {"pit",3}, {"greater_vault",5 + 4*self.base_level/(self.base_level+15)}} --I5 more vaults at higher player levels
   end,

Code:
on_leave = function(lev, old_lev, newzone)
      --set up for next level generation
      game.zone.width = 50 + rng.range(0,40)
      game.zone.height = math.ceil(4900/game.zone.width)
      game.zone.generator.map.rooms = {"random_room", {"pit",3}, {"greater_vault",5 + 4*game.zone.base_level/(game.zone.base_level+15)}} --I5 more vaults at higher levels
   end,

It's a little bit of a kludge, but I don't see any reason you couldn't specify a completely new generator table for each level. (Perhaps just randomly pick from a list of generator specs, for example.)

_________________
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.


Top
 Profile  
 
PostPosted: Tue Jun 11, 2013 6:47 pm 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10144
Location: Angolwen
http://git.net-core.org/darkgod/t-engin ... f373481ec7

_________________
[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 ;)


Top
 Profile  
 
PostPosted: Tue Jun 11, 2013 6:52 pm 
Offline
Sher'Tul

Joined: Sat Mar 01, 2003 4:01 pm
Posts: 1067
That was fast, thanks :)

_________________
ToME online profile: http://te4.org/users/zonk
Addons (most likely obsolete): Wights, Trolls, Starting prodigy, Alternate save/resistance system


Top
 Profile  
 
PostPosted: Tue Jun 11, 2013 6:56 pm 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10144
Location: Angolwen
http://git.net-core.org/darkgod/t-engin ... 21fb904f99 ;)

_________________
[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 ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group