Onset
Acecool Dec 27, 2019 @ 11:13am
C Style Lua?
I would be interested in bringing my knowledge, and gamemodes + framework from GMod. But I have it coded in GLua or CLua which allows the use of continue instead of requiring inverted logic if surrounding things inside of a loop, &&, ||, etc...

Are there any plans for this?

Personally, it makes things look a LOT better than having English words for logic. It also creates unique ways to identify them, in case it does need to be converted. But I have a few other projects I'm working on.

I could bring quite a bit to the game - and logic is universal, so I'd just have to update some code for the new function names and it should be good.

Also, are there any plans on upgrading the structure? Right now it seems everything is linked via hook style system and you have to define each and every single hook. Why not have a GM style table, with all of the defaults you can overwrite instead?

Why aren't the hooks named?

I have only just seen this game and have yet to purchase it because some of these things are important to know prior to...
< >
Showing 1-2 of 2 comments
Talos  [developer] Dec 29, 2019 @ 3:15pm 
Hey there.

Not planning on modify the Lua source code. However I agree that having "&&" instead of "and" is more convenient.

I don't know what you mean by hooks. But in Onset you can use this function https://dev.playonset.com/wiki/AddEvent to add your function handler.
Events are listed here:
https://dev.playonset.com/wiki/Template:ServerEvents
https://dev.playonset.com/wiki/Template:ClientFunctions

Let me know if you have any other questions.
Acecool Dec 30, 2019 @ 9:43pm 
By hooks, I mean similar to Garry's Mod, or other languages that allow you to broadcast and capture. GMod allows you to use named hooks so you can easily remove them, if necessary.

The AddEvent system - does it allow you to only add one of each kind, or multiples? The benefit of the hook system is you can add multiple. The first one to return a value is the one that overrides. So the main game function can be base behavior, then you can modify the behavior in certain situations.



Also, do you plan on having an auto-refresh style system implemented? If so, you could make it better than GMod by only reloading the single file which changed.

I had to create this type of system manually in GMod by enabling auto-refresh for the hook ( although, I could've constantly monitored hundreds of files for timestamps - and it would've worked but it would've been much slower ), then disabling the second refresh in my auto loader so it wouldn't refresh all files. Instead, it would find the one file that changed ( or more in case someone was that quick and hit a save-all button in an editor ), package them and network them if necessary and run / evaluate the code.

The way I made it work really well - even though this isn't necessary, but this allows for dynamically loading of game-modes, etc... Since Lua stores everything in tables and has special meta-table functions.. I stored each aspect in a separate table.

Base code > Base Game-Mode > Current Game-Mode > Addons / Overrides

and I'd have a simple controller in the GM / GAMEMODE table which I converted into a meta-table and added index / newindex checks. Newindex to properly sort the data to the appropriate table location based on path. And index to determine which to call.. Which was actually quite simple... > most has highest priority. If it doesn't exist, go lower.

It let you swap out the currently loaded game-mode without having to reload base gamemodes, unless those changed. It requires a little more work to keep track of hooks added for a specific game-mode, and if you want to keep a game-mode in memory ( for a mini-game environment ) then it would create a nested table within the Current Game-mode table, and a simple variable would track which one was active.

Meaning, you could load as many game-modes as you could possibly want and dynamically swap through them without having to reload any new files.

The biggest issue in GMod for this type of system is the 2000 file limit, which may have been removed, but I never re-tested. Because my auto-loader included files in a specific way, and my framework was organized in a very simple way - I could simply read the content of the files and make 2 files for the server to run on ( I could've done this for addons, but I didn't - so the addons were limited to 1998 files if the limit was still there ). And, I could easily enable or disable this one feature. I don't think I ever uploaded this variant to bitbucket.

So a simple server file, and a client file. The exact load-order was there. I started working on another project to map code for Sublime Text ( which would also help automatically generate wiki content, map the files to easily navigate without scrolling, minor error-checking [ not on the level of proper linting yet ], and more ) - so I ended up not finalizing the security measures or alternate transfer protocols to allow storing and downloading via http with a key - but all of those designs are complete, and solid.



Anyways - Do you plan on using tables to categorize functions? Right now they all just seem to be in the global namespace. AddEvent. etc.. etc.. etc..

Why not set up a library such as draw, math, networking, etc..? -- Not only would it help developers quickly, and easily find functions to use - but it would add a greater level of organization to the project.

gui could be for elements such as text boxes, and other interactables. draw could be for simple things such as drawing rectangles, lines, and so on. You could even add drawing text in here.
< >
Showing 1-2 of 2 comments
Per page: 1530 50