How would I make a game like RetroStudio?

So, im making a game where you can create your own! Here’s the question: how would I make a publishing system? This is a very vital feature to application!

2 Likes

one word, Datastores. Compile all the game data that they have and then write a function to load it all again!

2 Likes

for som reason retro studio does not have Lua scripting support!! what a terrible studio : ((

I recommend you look at dex scripts

1 Like

Don’t worry, i’m gonna change that, ill use loadstring(), i believe it works.

It does, maybe make an explorer with changeable scripts using loadstring

I made a module called “Prime script” that makes loadstring like scripts, I’m pretty sure you’re interested in it

HA, I just changed my mind, loadstring() is very exploitable, I’m going to use the Lua in Lua VM module instead.

1 Like

Well I should also add that option too, good point

Storing an entire game is not typically a simple task.

Roblox offers datastores which can store objects in. You can run a loop through those objects and run it in an interpreted language sort of way.
That would pretty much be making an intermediate language (like bytecode) but with objects.

Another way to do it is storing a bunch of numbers. Each numbers represents a command. For each command, you execute something specific.

To put it simply (or tl;dr), you first have to find a way to compile the user’s code, then store it and run it.

The best example I can give is Java.
Java is first compiled into JVM which is Java’s bytecode VM. JVM then goes through each byte and executes something.

For example,

Let’s say this was our code:

echo "HI"

We need to compile that into something that can be stored in a datastore.
Let’s say we converted it to an array of objects. (although I warn you, this can be very inefficient and may use a lot of memory)

Let’s say that looks like this:

[
     {
          command: "echo",
          arguments: [ "HI" ]
     }
]

Now we can do whatever we want. Store it, load it, run it (by loop through each item and check what the ‘command’ is. We see ‘echo’, so we print out the arguments.)

/// EXTRA INFORMATION \\\
In languages that use a bytecode vm, the output would most likely look like this:

0 "HI"

Of course in a proper language, constants like “HI” would be handled differently.
We can read the 0 as an opcode for ‘echo’

We see a 0 and we’re like, hey, we need to print something! So, we read the next byte and see that it’s “HI”. Perfect. Now we can call print("HI")

1 Like

That is a bad idea. loadstring is not sandboxed and is not available on the client side. If you use loadstring, you’re giving everyone access to your datastores and anything server sided for that matter.

sry for necro, but what about serialization? Like convert everything to bytes, and then de-serialize when need?

I have the assets but I rather not share it. Lets just say you need to use your own coding knowledge or just get the experience of it.