Skip to main content

2022 Aug: API, Auto Docs & More!

Β· 6 min read
Gabriel T. Nardy

Open Source API, Auto-generated Documentation & More!

Another month has passed, and here is a summary with the things that happened during that!

Open Source API​

This month we, with the help of the entire community, created the Official nanos world API, which is an organized set of all Classes, Static Classes, Utility Classes, Structs, and all their Functions and Events. We made this in order to have an official place where all the scripting of nanos world can be obtained.

VSCode Extension​

With the API, it was possible to professionalize the extension of nanos world for VSCode, created by @Derpius. Now it uses the API to generate all the Lua stubs!

This way, all updates made in the API reflect directly on the extension for VSCode, being always updated!

Don't forget to rate it πŸ˜‰.

Smart Documentation​

Our docs pass through a complete refactor under the hood! Now all Scripting Reference pages are generated automatically using our new API! This is a big step forward as before I was writing each function separately in each page. Now I just need to update a single JSON and the docs gets structured properly!

Not only the automatization, but now we have some interactive popups, which display more information of a Class/Struct/Function when you hover it! This will help a lot newcomers understanding the basics of nanos world!

New UI (Console & Chat)​

I've updated our remaining old design UIs for the Console and the Chat! Now they belong to the same style as the menus!

New Profiling Stats​

I've added a real time profiling view to display performance information of the game and scripting. It displays the accumulated time spent on an operation and the average in the frame in the last second.

It is really useful for debugging and finding bottlenecks in both core game and in your packages! It displays individual events for each packages and the time they are taking to execute.

Trigger Whitelist​

Now Trigger can have a list passed in the constructor to only trigger for specific classes! This helps scripters to care more about performance and reduces the amount of validation needed in Lua side to check if an entity triggered is of the type we want!

-- Triggers only Characters and Vehicles
local trigger = Trigger(
Vector(), -- location
Rotator(), -- rotation
Vector(100), -- extent
TriggerType.Sphere, -- trigger_type
true, -- is_visible
Color(1, 0, 0), -- color
{ "Character", "Vehicle" } -- overlap_only_classes
)

SceneCapture Render Only​

SceneCapture got new methods to render only actors set manually through parameters. This allow transparent backgrounds when rendering just a specific Entity (a Character for example).

SceneCapture.AddRenderActor(actor)
SceneCapture.RemoveRenderActor(actor)
SceneCapture.ClearRenderActors()

Melee Improvements​

The Melee class got several improvements including new methods and events to make it even more flexible. You can now set a list of Attack Animations and Impact Sounds depending on the surface it hits! Also it got a new event Attack when the attack happens. Not to mention several bug fixes and improvements have been made on Melees too!

Melee.AddAnimationCharacterUse(asset_path, play_rate, slot_Type)
Melee.SetImpactSound(surface_type, asset_path, volume, pitch)

New Traces​

I added two new Trace methods Trace.LineSingle() and Trace.LineMulti() replacing the old Trace. Those new methods now receive a trace_mode parameter which supports several parameters being passed as bitwise flags, this new way of passing parameters is great for future updates as it doesn't add breaking changes and also reduces the amount of parameters needed in the method.

You can for example pass it like:

-- Traces complex collisions, returns the entity as the Entity table value and draws a debug line in the world.
TraceMode.TraceComplex | TraceMode.ReturnEntity | TraceMode.DrawDebug

Performance Improvements​

I am constantly working on improving the performance, this is one of my main priorities. And now with the new profiling stats, we are being able to find the bottlenecks faster!

We've got great improvement on performance while Aiming and on Blood decals/particle spawns. Now Blood takes into consideration all levels of Effects Scalability settings to spawn more/less depending on that.

I am aware of a "problem" causing performance hit when spawning some dozens of thousands of entities (Entity Tick time) and I'm thinking on a solution to solve that. The problem comes because each entity is "ticked" every frame, so thousands of entities means thousands of more ticks per frame.

Native LoadPackage​

I did an great improvement on Package.LoadPackage() method to make a native load of Lua code. So anything you return in the loaded file will be properly receiving in the loader side! Before it was doing an ugly and weird serialization/deserialization of the returned data, and now it behaves like the native operator!

CEF Improvements​

I am still constantly improving and adjusting the edges of integration with CEF. This last month I fixed several bugs and crashes and worked on performance improvements, there are still some points to be improved and there is one bug in my concern to be corrected.

Also, I'm always going to keep our CEF version up-to-date, it was just updated to 104.4.26 so our version did to!

New Game Settings​

Our Settings got new options which can be changed:

  • draw network debug in the world
  • display network stats in the screen
  • auto realign camera
  • fov can be altered by gameplay

Auth Website Redesign​

@MegaThorx worked on big refactoring on our Auth website, it now supports Dark Mode and a new UI/UX for better usability!

Tons of Bug Fixes​

It worth mentioning the tons of bug fixes and improvements we got this month, it's all written in the changelogs in our Discord.

Some examples are: a bug causing a Deadlock in the server when using Triggers (the server was freezing), a bug causing crashes when using coroutines, duplicating logs, UX problems, Server Cache not working (loading taking minutes), Main Menu crashes, and much more!

Community Highlights​

A huge shoutout for the French πŸ‡«πŸ‡· community hich has grown a lot on the server! And especially to Mouloud that is creating amazing packages for nanos world!

Conclusion​

A lot of things being improved and bugs being fixed, the creation of API and Docs's self-generation are life changing (especially for me as it's now much easier to update docs with new things) and also for all scripters that can rely on the VSCode extension which is 100% backed on the official API.

Once again I reinforce the importance of posting and voting for ideas in our Feedback Hub. E.g. it's clear that the greatest need for everyone at the moment are the Dimensions 😜.

And also don't be reluctant to post bugs in our Issue tracker. The chances of your bug being fixed increases by 10000% if you post it there.

That's it for this month, once again thank you all for the support!!!