System API

Core system functions and information.

Functions

kinetic.version

Get the Kinetic version string.

local version = kinetic.version
print("Kinetic version: " .. version)  -- "1.0.0"

Returns: string - Version number


kinetic.fps()

Get the current frames per second.

local fps = kinetic.fps()
print("FPS: " .. fps)

Returns: number - Current FPS

Example:

kinetic.on_frame = function(delta_time)
    local fps = kinetic.fps()
    
    -- Color based on FPS
    local color
    if fps >= 60 then
        color = {0, 255, 0}  -- Green
    elseif fps >= 30 then
        color = {255, 255, 0}  -- Yellow
    else
        color = {255, 0, 0}  -- Red
    end
    
    kinetic.draw.text({10, 10}, color, string.format("FPS: %.0f", fps))
end

kinetic.player_count()

Get the number of players currently in the game.

Returns: number - Player count


kinetic.notify()

Show a notification on screen.

Parameters:

  • title (string) - Notification title

  • message (string) - Notification message

  • duration (number) - How long to show (seconds)

Example:

Complete Example

Notification Types

While there's only one notify() function, you can use different titles to indicate type:

Tips

  • Keep notifications short - Users need to read them quickly

  • Use appropriate durations - 2-3 seconds for info, 5+ for errors

  • Don't spam - Too many notifications are annoying

  • Use clear titles - Users should know what the notification is about

Next Steps

  • Players API - Access player data

  • Drawing API - Draw on screen

  • Input API - Check keyboard/mouse input

Last updated