Jump to content

Recommended Posts

Is there a lifespan to how long a variable in Lua will retain its value in memory, or with this being a 'persistent universe' do variables never lose their value once assigned?

Share this post


Link to post
Share on other sites

Shouldn't this fall outside the scope of NDA, since it's a general question of how Lua functions within the framework of a persistent mmo?

Or can Lua be limited/controlled by a game's engine, and thus it being a proprietary thing specific to Dual Universe's engine that would mean it falls under NDA?

Share this post


Link to post
Share on other sites

A Lua variable is like any other variable.

 

It resides in RAM.

 

In order for you to keep the information in that variable, you must save it somewhere.

 

Share this post


Link to post
Share on other sites

Yeah, but it would stay in RAM so long as the server remained running, wouldn't it? I would imagine it'd be the same as any other program that allocates memory to a particular variable and holds that memory slot so long as the program is running, else there would be a memory violation exception... but I've never dealt with server/client architecture, so I'm not entirely certain if that would be true for this mmo or if there would be garbage collection methods in place for Lua variables?

Share this post


Link to post
Share on other sites

I don't know of any game engine or server infrastructure written in Lua.

 

Unengine certainly isn't written in Lua.

 

I don't think persistence of data has been addressed by Novaquark publicly, so any further information is NDA.

Share this post


Link to post
Share on other sites

There's a lot of games that use embedded Lua to do stuff in-game, despite the game being written in like C/C++ or something. Easy example: ComputerCraft mod for Minecraft. Minecraft was written in Java, but the mod allows in-game Lua execution... and I'm guessing some framework behind the scenes to translate particular Lua methods to Java for the events to occur in the game. However, in the example of that mod for Minecraft, the Lua variables only get allocated memory during execution of the Lua... as soon as execution is complete, the variables are empty and that memory is flushed. It basically functions as a one-time run script, as opposed to a native part of the game's engine that would be held in RAM so long as the game is running.

 

Lua's been discussed in multiple Dev Blogs (else we wouldn't know about it), so should be fair game to discuss.

Share this post


Link to post
Share on other sites

There are a couple of different ways of saving data within Lua.  You can write the variable to a file, or you could upload it to a database.

 

This is basic Lua that you can be found in any tutorial.

 

If Novaquark has implemented a method to save data persistently, they haven't mentioned it publicly.

 

Whether that feature exists, or not, I'm very happy with the alpha and believe its worth the price of admission.  Questions along these lines can easily be answered withing the NDA forums or the NDA discord channel.   

 

Share this post


Link to post
Share on other sites
8 hours ago, Oblivionburn said:

Is there a lifespan to how long a variable in Lua will retain its value in memory, or with this being a 'persistent universe' do variables never lose their value once assigned?

LUA scripts run client side, so my guess is that variable lifespan is as long as client running script is connected to the game and in close proximity to control element.

Share this post


Link to post
Share on other sites
4 hours ago, spaceforger said:

LUA scripts run client side, so my guess is that variable lifespan is as long as client running script is connected to the game and in close proximity to control element.

Does it? They've talked about industry machines using Lua that continue to run even when you're not logged in and nobody's around, which makes me think it's being handled server-side. It would make sense for it to be a client-side thing, but for stuff to continue to happen in the world for objects that are utilizing Lua scripts... I dunno, man. It's all very interesting to me.

Share this post


Link to post
Share on other sites
1 hour ago, Oblivionburn said:

Does it? They've talked about industry machines using Lua that continue to run even when you're not logged in and nobody's around, which makes me think it's being handled server-side. It would make sense for it to be a client-side thing, but for stuff to continue to happen in the world for objects that are utilizing Lua scripts... I dunno, man. It's all very interesting to me.

machines run if you are offline but there are enough resources, not LUA scripts run while you are offline and yes, i am 100% sure because devs said that running millions of scripts server side is too costly ;) that's why LUA script is only applied when client is online AND in close proximity to control element

Share this post


Link to post
Share on other sites
9 hours ago, spaceforger said:

i am 100% sure because devs said that running millions of scripts server side is too costly ;)

Ah, I must've missed that. Thanks for the clarification!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...