Worldmaps and how they work

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
XLambda
Wyrmic
Posts: 237
Joined: Wed Jan 25, 2012 5:39 pm

Worldmaps and how they work

#1 Post by XLambda »

I've been trying to understand the ToME world map and how it works for a while. It's still very confusing, and the fact that the Age of Ascendancy map is darn huge makes it even worse. Here are a few questions, if anyone could help answering them I would be really grateful. :)

1) How exactly do the 'playerpop' and 'zone-pop' spot definitions work? I remember seeing the former called during world creation, setting the wilderness coordinates of the player. However, that apparently only works by setting a default wilderness in the birth descriptor.

2) Is there any way to change or disable the calendar on the world map? Maybe even from inside a running game rather than at world-gen? I looked through the code and don't really understand how that whole system works.

3) Is there a simple way to set wilderness coordinates for the player? Especially considering there might be multiple worldmaps, and the ToME code doesn't really seem to be built for that.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Worldmaps and how they work

#2 Post by HousePet »

1) Those are just coordinates that can be called from their label. So the code that makes them do stuff is elsewhere and probably not automated.

2) No idea.

3) That should be easy to do, but I have no idea where that is stored.
My feedback meter decays into coding. Give me feedback and I make mods.

rexorcorum
Graphical God
Posts: 482
Joined: Wed Jan 05, 2011 8:05 am
Location: There and Back again

Re: Worldmaps and how they work

#3 Post by rexorcorum »

I think asking around in the Modules Subforum is your best shot or/and poking at the various modules themselves - Classic ToME, VoTE (is there a world map there at all? don't know) and the others - there were a few made 2 years ago for the Module contest.
~ [ RexOrcorum, a.k.a "rexo": Official Visual Magus, Addon Beautifier, Achiever, Knight of the 561 Trees, Dark Interfacer ] ~
darkgod wrote:~ [ DarkGod whips rexorcorum with Suslik (& many others as well) ] ~

XLambda
Wyrmic
Posts: 237
Joined: Wed Jan 25, 2012 5:39 pm

Re: Worldmaps and how they work

#4 Post by XLambda »

HousePet wrote:1) Those are just coordinates that can be called from their label. So the code that makes them do stuff is elsewhere and probably not automated.
Ah, I see. Yeah, that makes a lot of sense.
HousePet wrote:3) That should be easy to do, but I have no idea where that is stored.
Hm, I think I found it. I'll have to experiment with that a bit, and find a clever way to handle the whole thing.
rexorcorum wrote:I think asking around in the Modules Subforum is your best shot or/and poking at the various modules themselves - Classic ToME, VoTE (is there a world map there at all? don't know) and the others - there were a few made 2 years ago for the Module contest.
That's actually an excellent idea, I'll do that. For some reason I had completely forgotten about the Module contest.

Zireael
Archmage
Posts: 449
Joined: Tue Jun 18, 2013 7:24 pm

Re: Worldmaps and how they work

#5 Post by Zireael »

If I were you, I'd look at how Zizzo did it in his ToME 2 port. I'm using his code for the worldmap and it seems much more robust than ToME 4's (less prone to stranding you :D)

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: Worldmaps and how they work

#6 Post by Zizzo »

Zireael wrote:If I were you, I'd look at how Zizzo did it in his ToME 2 port. I'm using his code for the worldmap and it seems much more robust than ToME 4's (less prone to stranding you :D)
*blush* [bows] :oops: :wink:

Actually, though, the answers to your questions depend a lot on whether you're asking from the perspective of a module writer or an addon writer:
XLambda wrote:2) Is there any way to change or disable the calendar on the world map? Maybe even from inside a running game rather than at world-gen? I looked through the code and don't really understand how that whole system works.
This, for instance; if you're writing a module, I don't think you actually even have to have a calendar at all, and it only logs the date when you tell it to. The T4 module creates its calendar in either mod.class.Game:runReal() or mod.class.Game:newGame(), apparently based on whether you're starting a new character or loading a savefile, and it logs the current calendar date in mod.class.Game:onTurn(). [And I just noticed that the T2 module is missing corresponding code... :oops: ] Ooh, I see a Clever Hack™ if you're working at the T4 addon level: the relevant code in T4's Game:onTurn() is:

Code: Select all

        if self.zone then
                if self.zone.on_turn then self.zone:on_turn() end
        end

        -- [...]

        if not self.day_of_year or self.day_of_year ~= self.calendar:getDayOfYear(self.turn) then
                self.log(self.calendar:getTimeDate(self.turn))
                self.day_of_year = self.calendar:getDayOfYear(self.turn)
        end
So if you have a zone in which you don't want calendar messages, you could give it an on_turn() method that sets game.day_of_year to game.calendar:getDayOfYear(game.turn), which would trick Game:onTurn() into thinking it's already logged the calendar message.
XLambda wrote:3) Is there a simple way to set wilderness coordinates for the player? Especially considering there might be multiple worldmaps, and the ToME code doesn't really seem to be built for that.
There again, if you're writing a module, it's your responsibility to keep track of the player's wilderness coordinates, and you get to decide where they live and how they're accessed. Both the T4 and T2 modules keep them in game.player.wild_x and game.player.wild_y; if you have multiple worldmaps, you could keep corresponding coordinates for each one in game.player.

From a module writer's perspective, the engine doesn't actually make a distinction between a worldmap and any other kind of zone AFAICT; it's the module code's job to handle them differently as needed. Your Game:changeLevel(), for instance, would be responsible for switching between worldmap coordinates and ordinary coordinates when entering or leaving a worldmap.
"Blessed are the yeeks, for they shall inherit Arda..."

Post Reply