Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Moderator: Userbase Moderators
|
|
|
|
-
ByTheBookGames
- Fighter Fly

- Posts: 36
- Joined: Tue Jun 04, 2019 8:35 pm
Postby ByTheBookGames » Wed Mar 09, 2022 1:37 pm
Hello! I had more of a "core way lunalua engine works with SMBX" question, if anybody knows the answer off the top of their heads. As far as I can tell, whenever a new level is loaded within SMBX, all the lua scripts reset. There are, of course, ways of getting data to persist across these refreshes, like with the newer GameData.___ and so forth, but the .lua files themselves still restart every time a new level loads. I'm wondering if there are any lua files that do not reset and are always running even when transitioning from one level to another? (Maybe any of the base engine scripts like main.lua?) Or if there are ways of making a lua script behave this way? I figured the answer is no, but just wanted to confirm if anyone knew. Thanks to anyone who takes the time to read this and/or offer help. Very appreciated!
|
|
|
|
|
|
|
|
|
-
deice
- Volcano Lotus

- Posts: 596
- Joined: Fri Jul 23, 2021 7:35 am
Postby deice » Wed Mar 09, 2022 6:43 pm
even if it were possible to create such a script (and to my knowledge, it isn't, at least not without bundling your own lunadll like a2xt did for example) i sort of fail to see the would-be applications of it? lua files being loaded coincides with smbx reallocating a lot of memory, so nothing that was exposed to you within one level would remain accessible in another, that's just the nature of the smbx. if you have a specific issue you want to solve, i recommend simply asking about it as i'm sure there's a perfectly normal and conventional way of solving it.
|
|
|
|
|
|
|
|
|
-
ByTheBookGames
- Fighter Fly

- Posts: 36
- Joined: Tue Jun 04, 2019 8:35 pm
Postby ByTheBookGames » Wed Mar 09, 2022 9:14 pm
deice wrote: ↑Wed Mar 09, 2022 6:43 pm
to my knowledge, it isn't, at least not without bundling your own lunadll like a2xt did for example)
Thank you for your reply deice, I appreciate it. I wasn't aware of a2xt's custom lunadll, that's fascinating, is there a post or place you'd recommend visitng for more information on how they did that, why, and to what effect?
deice wrote: ↑Wed Mar 09, 2022 6:43 pm
i sort of fail to see the would-be applications of it?
I've developed an online multiplayer system catered for a long-term project I'm working on that utilizes SMBX's and PGE's engines. The networking system connects through luasocket, and custom lua scripts that use luasocket. Because of the way the memory reseting and lua script reseting works, I have to reestablish a connection between the clients and host every time a new level is loaded, which also causes issues with potentially lost shared data, which creates a mess of needing checks and updated data across a huge set of arrays. So, the application this question had in mind is incredibly specific and niche, and I do not expect it to be relevant to many others, but your expertise in the area was helpful to confirm my suspicions and help me focus on potential workarounds. Thanks.
|
|
|
|
|
|
|
|
|
-
deice
- Volcano Lotus

- Posts: 596
- Joined: Fri Jul 23, 2021 7:35 am
Postby deice » Thu Mar 10, 2022 6:53 am
ByTheBookGames wrote: ↑Wed Mar 09, 2022 9:14 pm
Thank you for your reply deice, I appreciate it. I wasn't aware of a2xt's custom lunadll, that's fascinating, is there a post or place you'd recommend visitng for more information on how they did that, why, and to what effect?
a2xt was released i believe around 2015, before lunalua was a thing and the whole api was still in a somewhat early state of development. the way they did it was just redistributing their own modified exe file of smbx 1.3 with their own lunadll bundled with it. i believe the source code for this custom dll is available in the a2xt devkit? but my memory is a little hazy. since i wasn't involved with a2xt, i don't know the specifics of why (other than letting some of the contributors code level mechanics using c++ instead of the obtuse autocode), and sadly i don't know where you can get any more info on this. maybe attempting to contact kil or docopopper is an option, but i can't really offer any further insight.
ByTheBookGames wrote: ↑Wed Mar 09, 2022 9:14 pm
I've developed an online multiplayer system catered for a long-term project I'm working on that utilizes SMBX's and PGE's engines. The networking system connects through luasocket, and custom lua scripts that use luasocket. Because of the way the memory reseting and lua script reseting works, I have to reestablish a connection between the clients and host every time a new level is loaded, which also causes issues with potentially lost shared data, which creates a mess of needing checks and updated data across a huge set of arrays. So, the application this question had in mind is incredibly specific and niche, and I do not expect it to be relevant to many others, but your expertise in the area was helpful to confirm my suspicions and help me focus on potential workarounds. Thanks.
i see. while i'm not involved with the development of smbx2, intuitively i can say that attempting to use lunalua for that probably isn't a great idea? with a project of such scope, it's probably a better idea to create either a fork of xtech (while you'd have to forego use of lunalua, this allows you to add custom assets into the engine itself) or something along those lines. smbx 1.3 actually had (somewhat wonky) netplay, so the 1.3 source code might be able to provide at least some examples of how to handle these things within the game logic itself.
|
|
|
|
|
Return to “LunaLua Help”
Users browsing this forum: No registered users and 0 guests
|