ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Tue Oct 16, 2018 9:50 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Feb 01, 2013 12:18 am 
Offline

Joined: Fri Jan 25, 2013 9:54 am
Posts: 1
Salutations,

Been a long time watcher, first time writing, blah blah blah...

Anyway, I can do like a bit of tweaking and I don't mind a little copy pasta in coding, but I have found myself unable to find much on the engine.generator.map.* classes.

Setting the zone's generator's class to Roomer, Forest, Maze, Cavern, Empty, or Static seems to work right off the bat (though I have barely a clue as of yet on how to use them).

This question is concentrating on the classes that I can't find much on:
  • engine.generator.map.Building
  • engine.generator.map.GOL
  • engine.generator.map.Heightmap
  • engine.generator.map.Octopus
  • engine.generator.map.Rooms
  • engine.generator.map.RoomsLoader
  • engine.generator.map.TileSet
  • engine.generator.map.Town

What are each of these?
How do I use them?
Are they supposed to be used, or are they rightfully ignored?

Also, how would I write a generator of my own?
I don't mean the the actual map generating code, but everything else after doing that:
What would the algorithm return?
Where do I put it?
Where is it supposed to return to?

For a simple user-defined generator, how do I make a map from a uniform random number generator?
Code:
-- The simplest random map generator possible

local RNG = require("engine.rng") --I assume you need to do this to use the rng module

--- Randomly chooses each tile.
-- Each type of tile has an equal chance to appear at every point on the grid.
-- @param arguments What does the function get passed to it?
-- @return What does it return?
function utterly_random_generator(arguments)
   --insert code here
end


So far it seems I can modify the map generation using the file "\data\zones\dungeon\zone.lua", so if you show examples I would ask you use that (unless I am way off base and it is not applicable):
Code:
return {
   name = "Old ruins",
   level_range = {1, 1},
   max_level = 10,
   decay = {300, 800},
   width = 50, height = 50,
   persistent = "zone",
   generator =  {
      map = {
         class = "engine.generator.map.Roomer",
         nb_rooms = 10,
         rooms = {"simple", "pilar"},
         lite_room_chance = 100,
         ['.'] = "FLOOR",
         ['#'] = "WALL",
         up = "UP",
         down = "DOWN",
         door = "DOOR",
      },
      actor = {
         class = "engine.generator.actor.Random",
         nb_npc = {20, 30},
--         guardian = "SHADE_OF_ANGMAR", -- The guardian is set in the static map
      },
   },
   levels =
   {
   },
}


Many thanks!

(Man, this is long...)


Top
 Profile  
 
PostPosted: Fri Feb 01, 2013 12:45 am 
Offline
Module Developer

Joined: Tue Dec 14, 2010 3:23 am
Posts: 163
Location: Where I need to be
So to see the files and such look at game\engines\default\engine\generator and that will have all the actual generators. For implementing them I suggest taking a look at tome. Generally you just need to add some extra parameters. They are supposed to be used so go a head. If you have a particular one you want to just ask. For writing your own there is one function that you need. its "generate" you pretty just get handed an array or tiles. Then you generate stuff. making anything complicated will be very tricky though. As with any t-engine stuff ask on irc.rizon.net #tome for real time help.

_________________
Those who complain are just Volunteering to fix the problem

<yufra> every vault designer should ask themselves exactly that: What Would Grey Do?


Top
 Profile  
 
PostPosted: Sat Feb 02, 2013 4:01 am 
Offline
Sher'Tul

Joined: Mon Sep 30, 2002 9:52 pm
Posts: 1120
Location: Germany
About some generators from the engine:
  • engine.generator.map.Building
    It's used to build a big building by subdividing a big room with horizontal or vertical walls into smaller rooms. It's used in the dreams zone.
  • engine.generator.map.GOL
    Game Of Life. It was used in tome2 for the Illusory Castle , but it's not used in the current game afaik.
  • engine.generator.map.Heightmap
    At first a heightmap is generated (each map square is represented by a numeric value, e.g. altitudes), and then these values are compared to the thresholds of a list of tiles (e.g. low values become plains, middle values become hills, high values become mountains). It was used in an old version of Daikara (or the ME equivalent).
  • engine.generator.map.Octopus
    Hearth of the Gloom - one big cavern with branching smaller caverns
  • engine.generator.map.TileSet
    It uses pre-defined tiles to randomly fill the level, but there are checks for consistency (opening only next to an opening). The tiles can be of different sizes (multiples of a base size). It's used to build maze like levels in Escape from Reknor, Thieves Tunnels, the first level of Ancient Elven Ruins. The second level with the boss shows how to use it with different sized tiles and a starting tile
  • engine.generator.map.Town
    Builds a town with smaller buildings or vaults. See Halfling ruins or orc prides.

There are also some generators for some specific zones in tome/class/generator/map/


Top
 Profile  
 
PostPosted: Sat Mar 16, 2013 5:45 pm 
Offline

Joined: Sat Mar 16, 2013 4:48 pm
Posts: 3
I can't seem to find these generators at all, actually. My game\engines directory only has an empty 'Cores' directory and a file called te4-1.0.1.teae. There doesn't seem to be this directory anywhere: game\engines\default\engine\generator. Have I not installed the T-engine correctly or something? Thanks.


Top
 Profile  
 
PostPosted: Sat Mar 16, 2013 8:47 pm 
Offline
Spiderkin

Joined: Sat Feb 11, 2012 1:12 am
Posts: 543
They're in the te4-1.0.1.team file, it's just a renamed zip archive.


Top
 Profile  
 
PostPosted: Thu Apr 24, 2014 1:38 pm 
Offline
Archmage

Joined: Tue Jun 18, 2013 7:24 pm
Posts: 449
This thread ought to be stickied... I was trying to find something on various generators without success. Also, is BSP.lua used anywhere by the game?

_________________
Working on a T-Engine game
Veins of the Earth

Veins of the Earth ModDB page


Top
 Profile  
 
PostPosted: Fri Apr 25, 2014 12:00 am 
Offline
Sher'Tul

Joined: Mon Sep 30, 2002 9:52 pm
Posts: 1120
Location: Germany
BSP.lua is used inside of engine.generator.map.Building to subdivide the big building.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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