xmap - the thinking man's overworld

Share and discuss custom LunaLua code and content packs for SMBX2.
deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

xmap - the thinking man's overworld

Postby deice » Wed Apr 20, 2022 7:47 pm

hello everybody. i come to you with this thread having both updated chocomap somewhat and added some more cool things to spruce your vanilla world map up with. i give you:

xmap.lua
( download | changelogs and documentation | example episode )

xmap is a library that automatically loads several world map libraries for you. all of them have to be in the same folder and they can then be accessed through xmap, for example:

Code: Select all

local xmap = require("xmap")
local chocomap = xmap.chocoMap

function onStart() chocomap.addCameraBoundary(...) end
the currently available libraries are:
  • chocoMap v1.3
  • coinSign v1.01
  • wanime v1.0
  • xmusic v1.0
  • xpath v1.09
  • xtile v1.0
descriptions follow below

chocomap.lua
the beloved world map re-renderer. minor fixes and tweaks come with it's merger into xmap, but it's mostly as it's known.
brief feature showcase: show
customize overworld elements and freely use lua drawing on the overworld. details on settings and stuff moved to the documentation.
Image
Image
Image
coinsign.lua
nsmb star coin gates, that's pretty much it.
brief feature showcase: show
lock paths leading out from levels behind a required star coin count. can also easily be customized to take different currency counters into account. requires the "sign.png" inside the same folder by default.
Image
wanime.lua
handy effects for the overworld.
brief feature showcase: show
create and easily manipulate disposable objects on the world map which can be configured to your liking.
Image
xmusic.lua
marginally more control over the overworld music.
brief feature showcase: show
overrides the music playing on the overworld and lets you more easily manually play music. works with files in your episode folder that override the default music as well as music.ini, but doesn't allow arbitrary music ids or entirely custom music.
to make it work, you must call:

Code: Select all

xmusic.seize()
inside "map.lua". (preferrably in onStart())
this is because this library will interfere with other libraries which seize the sound stream and thus is not automatically active. if you do have other such libraries loaded, it's recommended to ignore this while using xmap.

(no gif as this is strictly an audio library and thus has no visual demonstration lol)
(special thanks to jukebox.lua for music.ini reading code)
xpath.lua
paths but awesome.
brief feature showcase: show
lets you manually open paths, and gives you the option to reduce the wait time between them appearing as well as to easily manipulate under what conditions paths actually get opened. to use, you have to place:

Code: Select all

require("xpath")
at the top of your episode's global "luna.lua" file.
Image
Image
xtile.lua
lunar magic overworld events eat your heart out.
brief feature showcase: show
lets you make (optionally permanent) changes to the overworld's tile structure. very versatile but doesn't let you create new tiles or go over the hard limit designated by smbx.
Image
(note regarding documentation: indentation signifies hierarchy (i.e. where you put the dots, except for methods where it lists arguments), [...] signifies numerical table indexing, rest should be explained)

leave feedback and report any bugs you find. hope you enjoy, more to come (?)
Last edited by deice on Tue Aug 06, 2024 7:30 am, edited 11 times in total.

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Thu Apr 28, 2022 2:35 pm

xpath has been updated (now works properly with paths leading out from direct overworld warps) and a new library, xtile, has been added. check 'em out in the original post.

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Mon May 09, 2022 3:19 am

updates and bugfixes to chocomap (please update if you were using removeCameraBoundary(), a new change was made to it to circumvent a very nice lua feature) and xpath, as well as another new library have been added. more details in the links inside the OP.

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Sun May 15, 2022 6:42 pm

xpath has been changed to disable the jump button while the player is walking to fix a bug regarding warps. also to fix a bug where music doesn't change immediately under some conditions, a new library (xmusic) has been added. check the OP for hard hits

Mal8rk
Snifit
Snifit
Posts: 215
Joined: Mon Oct 25, 2021 11:04 pm
Flair: English Speaking Spanish Speaker
Pronouns: He/Him
Contact:

Re: xmap - the thinking man's overworld

Postby Mal8rk » Tue Jun 07, 2022 1:00 pm

If this had diagonal paths, this would be an easier to use smwMap

Still very cool though

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Tue Jun 07, 2022 1:21 pm

POPME wrote:
Tue Jun 07, 2022 1:00 pm
If this had diagonal paths, this would be an easier to use smwMap

Still very cool though
i do appreciate the compliment but diagonal paths are unfortunately impossible for me to implement into this library as it relies on smbx's vanilla overworld logic under the hood, which means there can only be 4-directional movement.

(also, this and smwmap have different goals and use cases so personally i wouldn't compare them)

JamesR624
Spiny
Spiny
Posts: 29
Joined: Wed Aug 09, 2017 4:24 pm

Re: xmap - the thinking man's overworld

Postby JamesR624 » Tue Jun 07, 2022 5:52 pm

This is amazing! I was wondering if it would be possible to include example files (.wld, .lua, .txt, .png, etc) so we can get an idea of exactly how we're supposed to format things, like for example, the syntax for how to add things to map.lua or perhaps some example png's and txt's for the syntax of those files ofr wanime.lua?

I think this library might accomplish the small thing I am trying to do but I cannot for the life of me figure out how to properly format the files themselves from just the linked documentation sadly.

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Wed Jun 08, 2022 11:27 am

JamesR624 wrote:
Tue Jun 07, 2022 5:52 pm
This is amazing! I was wondering if it would be possible to include example files (.wld, .lua, .txt, .png, etc) so we can get an idea of exactly how we're supposed to format things, like for example, the syntax for how to add things to map.lua or perhaps some example png's and txt's for the syntax of those files ofr wanime.lua?

I think this library might accomplish the small thing I am trying to do but I cannot for the life of me figure out how to properly format the files themselves from just the linked documentation sadly.
that's not a bad idea at all actually, i've updated the OP with a link to an example episode i've quickly thrown together.

i've also updated the download for the main script because somehow it appears that the default "sign.png" was missing from it. if anyone reading intends to use coinsign but gets an error, you might want to redownload.

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Thu Jul 28, 2022 8:59 am

a minor update has been made to xpath. onPathOpened and onLevelOpened are now registered as custom events by default, meaning you can override them within other libraries as well.

SEDYON
Koopa
Koopa
Posts: 19
Joined: Thu Jan 20, 2022 5:56 am
Flair: Play Earthbound, you won't regret it
Pronouns: he/him
Contact:

Re: xmap - the thinking man's overworld

Postby SEDYON » Sat Aug 06, 2022 4:45 am

Hello, the download is not working! MediaFire is constantly generating a new download key.

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Sat Aug 06, 2022 6:02 am

Boo128 wrote:
Sat Aug 06, 2022 4:45 am
Hello, the download is not working! MediaFire is constantly generating a new download key.
a very weird issue. all of my other files were working just fine so it seemed mediafire had a specific problem with that file in particular.
i've reuploaded it and it should be working now. thank you for notifying.

baenyth
Koopa
Koopa
Posts: 16
Joined: Mon Sep 07, 2020 6:34 pm
Pronouns: she/her

Re: xmap - the thinking man's overworld

Postby baenyth » Fri Oct 28, 2022 10:56 am

Xmap is disabling the custom tiles I'm using. Not the levels or paths, just the tiles. Is this intentional? If so, is there a way to undo it?

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Fri Oct 28, 2022 11:57 am

baenyth wrote:
Fri Oct 28, 2022 10:56 am
Xmap is disabling the custom tiles I'm using. Not the levels or paths, just the tiles. Is this intentional? If so, is there a way to undo it?
xmap unfortunately does not support the vanilla functionality of automatically detecting tile size based on image size. you can work around this by making text files for those tiles which specify the required parameters. if i get the time, i'll probably address that in a future update.

baenyth
Koopa
Koopa
Posts: 16
Joined: Mon Sep 07, 2020 6:34 pm
Pronouns: she/her

Re: xmap - the thinking man's overworld

Postby baenyth » Fri Oct 28, 2022 12:31 pm

Do you mean like config files? Because those aren't working for me.

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Fri Oct 28, 2022 12:47 pm

baenyth wrote:
Fri Oct 28, 2022 12:31 pm
Do you mean like config files? Because those aren't working for me.
yes. could you provide a screenshot of your episode folder? the configuration files have to be written in all-lowercase, have to have a .txt extension and be in the episode folder (same as the rest of the custom overworld assets). for example, if you want to resize tile-1 to be 64x64, you'd create a file inside your episode folder called "tile-1.txt" and place:

Code: Select all

width=64
height=64
inside.

baenyth
Koopa
Koopa
Posts: 16
Joined: Mon Sep 07, 2020 6:34 pm
Pronouns: she/her

Re: xmap - the thinking man's overworld

Postby baenyth » Fri Oct 28, 2022 3:25 pm

Alright, here's a screenshot of my folder with the tile files:

Image

And here's what each file looks like:

Image

And here's what my world still looks like with the files:

Image

I'm starting to think it might not be the tile config files. I think some of the tiles didn't change in size. Any other ideas to what it might be?

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Fri Oct 28, 2022 3:30 pm

baenyth wrote:
Fri Oct 28, 2022 3:25 pm
I'm starting to think it might not be the tile config files. I think some of the tiles didn't change in size. Any other ideas to what it might be?
indeed it's not the config files, the issue seems to be that the images aren't loading. the only thing that i can think of is that you might be using gif images instead of png images (xmap does not support the legacy gif format). if you are, you can use "gifs2png" inside "data/pge" to batch-convert them or open them in an image editor and save them again as png files.

baenyth
Koopa
Koopa
Posts: 16
Joined: Mon Sep 07, 2020 6:34 pm
Pronouns: she/her

Re: xmap - the thinking man's overworld

Postby baenyth » Fri Oct 28, 2022 4:09 pm

It worked! Thank you very much!

deice
Volcano Lotus
Volcano Lotus
Posts: 587
Joined: Fri Jul 23, 2021 7:35 am

Re: xmap - the thinking man's overworld

Postby deice » Fri Nov 18, 2022 6:38 am

i've received a report and confirmed the presence of possible framedrops when using xmap. namely, chocomap will exhibit performance issues when your world map has a large number of tiles (around 6.5k is where it starts to become pretty noticeable).

it is possible to mitigate this for the most part by going into chocomap.lua line 424 and replacing

Code: Select all

Tile.get()
with

Code: Select all

Tile.getIntersecting(playerCamera.x, playerCamera.y, playerCamera.x + SCRWIDTH, playerCamera.y + SCRHEIGHT)
however, this takes advantage of an smbx2 feature where it will automatically set the physical size of a tile to the size of its image, and thus might not work properly for custom animated tiles.

i intend to wait for the next smbx2 update to see any changes made regarding the overworld before i get into more seriously testing this along with other possible optimizations and then releasing an official update.

Alucard648
Tweeter
Tweeter
Posts: 153
Joined: Sun Aug 16, 2015 3:45 am

Re: xmap - the thinking man's overworld

Postby Alucard648 » Sat Nov 19, 2022 12:00 am

deice wrote:
Fri Nov 18, 2022 6:38 am
i intend to wait for the next smbx2 update to see any changes made regarding the overworld before i get into more seriously testing this along with other possible optimizations and then releasing an official update.
Which will take ages to do.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari