Passer au contenu principal

2022 Aug: API, Auto Docs & More!

· 7 minutes de lecture
Gabriel T. Nardy
nanos world developer (SyedMuhammad)

API Open Source, Documentation autogénérée & Et plus !

Un autre mois s'est écoulé, et voici un résumé des choses qui se sont passées pendant cela !

API Open Source

Ce mois-ci, avec l'aide de toute la communauté, nous avons créé l'API officielle nanos world, qui est un ensemble organisé de toutes les classes, classes statiques, classes utilitaires, structures, et toutes leurs fonctions et événements. Nous avons fait cela afin d'avoir un endroit officiel où tout le script de nanos world peut être obtenu.

Extension VSCode

Avec l'API, il était possible de professionnaliser l'extension de nanos world pour VSCode, créée par @Derpius. Maintenant il utilise l'API pour générer tous les talons de Lua !

De cette façon, toutes les mises à jour faites dans l'API reflètent directement sur l'extension pour VSCode, en étant toujours mis à jour !

N'oubliez pas de l'évaluer 😉.

Documentation intelligente

Nos docs passent par un refactoring complet sous le capot ! Maintenant, toutes les pages de Référence de script sont générées automatiquement en utilisant notre nouvelle API ! C'est un grand pas en avant car avant j'écrivais chaque fonction séparément dans chaque page. Maintenant, j'ai juste besoin de mettre à jour un seul JSON et la documentation est structurée correctement !

Non seulement l'automatisation, mais maintenant nous avons des fenêtres contextuelles interactives, qui affichent plus d'informations sur une classe/structure/fonction lorsque vous la survolez ! Cela aidera beaucoup de nouveaux arrivants à comprendre les bases de nanos world !

Nouvelle interface (Console & Chat)

J'ai mis à jour notre ancienne interface graphique pour la console et le chat ! Maintenant ils appartiennent au même style que les menus !

Nouvelles statistiques de profil

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).


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!


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!!!