Yucon Code Framework || Keep your code efficient, effective, and organized

Yucon Framework

Introduction

I see many games go without proper optimization and organization all of the time. Many people use while wait() loops and such, which brings down leftover memory for other scripts, thus creating lag.

To make it worse for them, many developers can’t find the issues in the first place because their scripts are in random places and can be difficult to find.

Yucon is focused on solving both of these!

Some users may already be familiar with the style of it, as it is heavily based on AeroGameFramework and love2d engine.

Who is it for?

Yucon is for anybody who codes and has intermediate knowledge of Lua and/or LuaU.

However, if you consider yourself a good programmer, then this is for you! I’m sure you’re tired of looking for scripts, or hunting down memory leaks, or maybe even trying to figure out why your loops is are expensive to your frame rate.

Installation

That’s it. Simple as one-two-boom.

Usage

To create and edit scripts with ease, open the Yucon Editor by pressing the y-logo.

You should see something like this

Annotation 2020-06-17 161210

To the left is your main script editor. Click on one of the labels to open your script.
To the right is the script and plugin creator. Enter a name, and choose where you want it to go. It will rename variables to your script name and open the script almost instantly.

Here is a basic tutorial for Yucon:

And here is the demo place that was made in the video:
YuconDemo.rbxl (65.1 KB)

Documentation

Documentation is included in all scripts and plugins.

Base Server-Script

script:Preload [REQUIRED]
Fires when the script is first called and stored. Use to load any needed data.
Will yeild other scripts until the preload function is complete.

script:Step(delta) [REQUIRED]
Fires every framework tick (a little over heartbeat time)
Using this can help avoid using wait()
delta is the amount of time that passed between frames.

script:Start [REQUIRED]
Fires when the script is initialized. Use for main coding.

self:GetPlugin(pluginName)
Requests access to a plugin for use of it’s functions.

self:ListenToClientEvent(name,function)
Listens to a specified remote event, and connects to the function. Function passes player and it’s arguments.

self:ListenToClientFunction(name,function)
Listens to a specified remote function, and connects to the function. Function passes player and it’s arguments.

self:DisconnectClientEvent(name)
Disconnects from specified remote event.

self:DisconnectClientFunction(name)
Disconnects from specified remote function.

self:FireClient(player,name,...)
Fires a remote to a client.

self:FireAllClients(name,...)
Fires a remote to all clients.

self:InvokeClient(player,name,...)
Invokes a remote to a client.

self:InvokeAllClients(name,...)
Invokes a remote to all clients.

Base Client-Script

script:Preload [REQUIRED]

Fires when the script is first called and stored. Use to load any needed data.

Will yeild other scripts until the preload function is complete.

script:Render(delta) [REQUIRED]

Fires every frame

script:Step(delta) [REQUIRED]

Fires every framework tick

Using this can help avoid using wait()

delta is the amount of time that passed between frames.

script:Start [REQUIRED]

Fires when the script is initialized. Use for main coding.

self:GetPlugin(pluginName)

Requests access to a plugin for use of it’s functions.

self:ListenToServerEvent(name,function)

Listens to a specified remote event, and connects to the function. Function passes arguments.

self:ListenToServerFunction(name,function)

Listens to a specified remote function, and connects to the function. Function passes arguments.

self:DisconnectServerEvent(name)

Disconnects from specified remote event.

self:DisconnectServerFunction(name)

Disconnects from specified remote function.

self:FireServer(name,...)
Fires a remote to the server.

self:InvokeServer(name,...)
Invokes a remote to the server.

Base Plugin

(none, created by script creator)

The following plugins are included in Yucon:

  • CodePlus (Shared)
  • EventHandler (Shared)
  • ThreadHandler (Shared) (Originally made by @CloneTrooper1019, modified by me and ported to Yucon)
  • Tween (Shared)
  • DataStore2 (Server) (Originally made by @Kampfkarren, ported to Yucon)
  • GlobalValues (Server) (Possibly deprecated soon)
  • Webhook (Server)

The documentation is included inside of them.

Tips

  • To call a plugin using a script, use self:GetPlugin(pluginName) or self.Plugins.PluginName. Plugins do NOT run on their own, and need to be called by scripts (similar to modules in Lua).
  • To keep your code optimized, avoid using loops containing a yeild like wait(). Instead, take advantage of the step and render functions to create queuing systems.
  • Avoid using dashes and numbers in a script name! They may break the code.

Credit

You don’t have to credit me or the plugin, but it is nice.
The plugin is open source. You may modify it for your needs.
Do not re-distribute the plugin without proper consent.

Feedback

I would love to get as much feedback as possible! The more feedback the better, because it just makes the framework more accessible!

Make sure to let me know of anything that could be improved, patched, or added!

Thanks for reading, means a lot to me :heart:

Recent Updates

10/17/20

  • Fixed excessive type-checking
  • Fixed unchecked and unhandled coroutines
  • Fixed issues with embedded modules not being in the correct juxtaposition
  • Fixed a variety of game-breaking issues with remotes
  • You can now update the framework at any time by pressing the “import framework” button, you no longer get a “framework already installed” error
  • Debug tracebacking for Step, Render, and Start.

9/8/20

  • Added Step method to Client Scripts.
  • Added ThreadHandler to the Shared Plugins.
  • Deprecated and Removed FuncManip . Its functions are now included in ThreadHandler .
  • Added documentation to areas missing it, added ASCII art for Yucon.
  • A couple other tiny changes.

9/6/20

  • UI Improvements: Fresher Design, Upscale, Blurred Background, and the editor no longer closes when opening a script.
  • Hierarchy addition: If you don’t want to use :GetPlugin or something, you can use self.Scripts or self.Plugins to suit your coding style.
  • The SCP demo now uses the most recent version of Yucon, meaning it works again.
  • DataStore2 was added to the server plugins by default, as it’s a very popular data storage module.
  • WorkshopMapHandler was removed as it’s use case is too specific.
  • Added EventHandler to shared plugins.
  • Errors in Step and Render now appear in the output.

Only the three most recent updates are shown at once.

69 Likes

Does anybody have any projects they’ve created with the framework? If so, I would love to see :slight_smile:

8 Likes

Updates:

  • Fixes regarding random Yields and Errors in the output during playtest
  • Many optimizations by using LuaU syntax on variables.
  • Small changes
2 Likes

I recently used this for one of my projects! :smiley:

3 Likes

Looks pretty cool, but one thing I don’t like is the discrepancies between the code styles. Some functions use completely different code styles than others. The base functions are in the pascal case style. The CodePlus module is a mix between camel case and snake case. And the other modules are also varying. You should uniform the code style.

4 Likes

I think it would help alot if you provide code example for the functions on the documentation. I feel like theres something missing from the documentation, principally on the client / server communication. Other than that it’s a neat framework!

3 Likes

I will definitely have to fix this. Thanks!

1 Like

I may provide a tutorial soon :slight_smile:

1 Like

Updates (under testing, will apply in the next day or two):

  • Plugins now have access to remotes
  • Plugins cannot cross-reference each other anymore.
  • Minor optimization

In addition, I have released a small demo that uses Yucon: https://www.roblox.com/games/5243844165/SCP-Launcher?refPageId=0c50b14c-2cbc-422c-81ff-872e0103534d

1 Like

Can you release the source code for the Yucon demo? I thought this would be an example of how to use it.

Sure :wink:
You should find that it’s open-source now.

I would just like to ask why you think spawn brings down the leftover memory for other scripts, and would like to ask what you would use instead.

spawn runs on a separate thread priority in the Lua enviroment. Yucon takes advantage of coroutine to deliver a more reliable experience.

1 Like

But that still doesn’t answer the question of why you think it brings down the left over memory, is there any evidence to support this claim?

After doing some research, I can’t actually find the specifics. It’s likely I confused spawn with some other method.

The topic will be edited to change that information :slight_smile:

However, spawn is a bad practice, and I recommend using coroutine for many cases.

1 Like

It’s been quite a bit since the last update! Don’t worry, I got your back!

  • Removed LuaU’s => symbol, and replaced it with :. Sorry if your framework broke in the meantime, it is now fixed!
  • Optimized the code a bit more.
  • Included type array and type dictionary in all default plugins and scripts.
  • Fixed method names; they are all now PascalCase, rather than some that and some camelCase. Thanks to @Dysche for the idea.

Very interesting way to organize Server-side scripts and local scripts to execute module scripts. Moreover, the GUI for the plugin is easy to use. I’ll be using it in my inverse kinematics project and I’ll make sure to credit you when I publish a working version of my project with the plugin in the main branch of my GitHub.

Edit:
I have encountered some things which may make newer users have difficulties with the framework at the beginning which I summarized below:

TL;DR

  • Example use cases for Preload and Start (Step is self-explanatory and self testable)

  • Errors in step don’t output onto the command bar

  • The SCP launcher example is bugged and shows a black screen

I’ll work on it. Thanks for the feedback!

1 Like

nice framework i tried it and it worked well the only thing that i was expecting is your own framework datastore module like aero till then ill just wait for it

my recommended is that:

access modules with self.FOLDER_NAME.MODULE_NAME like something from aero
a good module datastore
make the gui better

Thanks!

Sure thing! Expect that soon, and thanks for that feedback.

I’ll keep the self:GetPlugin() system, but I may do a hierarchy system. Do you have more information on this that you think would fit Yucon?

I was thinking the same thing! In your opinion, what does the GUI lack the most?

Thanks for your feedback, I will be sure to work on it as soon as possible.