slopes.lua: SMBX's collision, rewritten!

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

Novarender
Tweeter
Tweeter
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

slopes.lua: SMBX's collision, rewritten!

Postby Novarender » Thu Jul 25, 2019 9:59 pm

Have you ever been writing code and trying to do your own thing when suddenly SMBX barges in and overrides something?
And then you go to ask for help but they can't help you because it has to do with SMBX's collision system, and they tell you to do some kind of alternative work around, and it's not satisfactory,
and if you really want to do it your way, then you can't 'unless you want to rewrite SMBX's collision'? Well...

I did just that!

Introducing...

Image


Slopes.lua is a script I wrote that replaces SMBX's current physics system. It allows for slopes of any angle, very short collision lines, and advanced anti-clip. With most collision systems you can clip through something if you're going fast enough, well with this it doesn't work like that.
So, if it's so great... what's the cost?
Well, because SMBX overrides so much stuff, I decided to disable much of the basegame stuff and write my own system on top of it-- including the collision system and other things. This collision system is designed to integrate perfectly into a large system I'm developing, which I'll talk about more below. Because I'm making my own game-system, this isn't something you can use on your own episode (it isn't useful) yet. However, this is only in beta-- there is still much to be done, and it's perfectly possible to make it compatible with the normal engine and then you could use it wherever you want.

Slopes.lua features collision on a line-by-line basis. That is, it doesn't go by a grid or by blocks but rather by individual lines, which things like blocks can be made out of. In the level I'm posting, you can draw lines with the cursor and then collide with them, creating a fun little gimmick to play around with in this sort of demo.
None of this is finalized, so I consider it to be in beta. There shouldn't be any major glitches in it, but you might encounter some minor glitches. Or maybe not, who knows.
You can move inside a line by entering it through the endpoint, this is intended. It's possible to prevent this, but not necessary at a larger scale. For areas that you'd want individual lines I would have a separate script that makes the lines fully solid.
In this collision system, speed is vital and every little thing counts.
As a side note, you can draw up to around a thousand lines or so before it starts slowing down.

Here is a gif of the script in action:
Image

And here's the download for the level and included stuff:
-------------------------------------------------------------------------------------------------------------
https://www.dropbox.com/sh/5zw3qmp18uwc ... opUua?dl=0
-------------------------------------------------------------------------------------------------------------

Not much else to say other than that the script is a bit messy right now, especially the level script, and that Mario's animation does not change. I did make custom music for this level, I hope it doesn't get annoying.

Earlier I mentioned that this would be part of a bigger system. I'm developing something that will use this and many other things to form one big tool...

Image

Expect to hear more from me in the future, if you have any questions please ask away.
And one last thing, if you want updates on the stuff I'm working on, about MMX or the projects I'm going to use it for... here's the invite link to my server. This marks our official release day of the server.
https://discord.gg/Wpf4xeZ

GOD_SAMA
Buster Beetle
Buster Beetle
Posts: 94
Joined: Fri May 31, 2019 12:04 pm
Flair: just a roaming hylian

Re: slopes.lua: SMBX's collision, rewritten!

Postby GOD_SAMA » Fri Jul 26, 2019 11:59 am

nukethe smbx from orbit and start over with this m8
i agree dude
cant wait for mario maker x :D

MegaDood
Charged Spiny
Charged Spiny
Posts: 1831
Joined: Wed Nov 01, 2017 2:43 am

Re: slopes.lua: SMBX's collision, rewritten!

Postby MegaDood » Sat Jul 27, 2019 1:15 am

Thank you! This is something I might honestly need for an upcoming level of mine! Would I be able to make a singular level and upload it with the slopes.lua applied with it working properly?

Novarender
Tweeter
Tweeter
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

Re: slopes.lua: SMBX's collision, rewritten!

Postby Novarender » Sat Jul 27, 2019 3:48 pm

MegaDood wrote:
Sat Jul 27, 2019 1:15 am
Thank you! This is something I might honestly need for an upcoming level of mine! Would I be able to make a singular level and upload it with the slopes.lua applied with it working properly?
Well yes, technically, but it would all be made of lines and you can't place normal things like blocks and NPCs. BGOs would be fine, but anything else not really. If you want there to be pre-existing lines when you start the level, you have to add them to variable s in the level script as shown there.

Added in 4 minutes 35 seconds:
Also Mario's animation would not change, and sound effects would not play. If you want these, you'd have to implement these yourself or something similar. I might consider releasing a basegame-friendly version, though.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari