#Loading world causes instant crash

1 messages · Page 1 of 1 (latest)

pallid mantle
#

My world titled Space. crashes the Cubzh instantly on load. Tested on both iOS and Windows.

The bad code is in the thread

#
Config = {
    Map = "a01000001.dot",
    Items = {
        "a01000001.dot"
    }
}

Config.ConstantAcceleration = {0,0,0}


Client.OnStart = function()

    Sky.AbyssColor = Color(0,0,0,0)
    Sky.HorizonColor = Color(0,0.1,0.2,0)
    Sky.SkyColor = Color(0,0,0,0)
    Clouds.On = false

    -- The sfx module can be used to play spatialized sounds in one line calls.
    -- A list of available sounds can be found here: 
    -- https://docs.cu.bzh/guides/quick/adding-sounds#list-of-available-sounds
    sfx = require("sfx")
    -- There's only one AudioListener, but it can be placed wherever you want



    reset = function()
        o.Position = Number3.Zero + 7
        o.Rotation = Number3.Zero
        o.Velocity = Number3.Zero
    end

    o = Object()
    Pointer:Hide()

    Dev.DisplayColliders = true
    Dev.DisplayBoxes = true
    Dev.DisplayFPS = true

    local dot = Shape(Items.a01000001.dot)
    o.CollisionBox:Fit(dot)
    dot.Physics = PhysicsMode.Disabled
    o:AddChild(dot)
    o.Physics = true
    o:AddChild(AudioListener)

    c={}
    c.vel = Number3.Zero
    c.accel = Number3.Zero
    c.rot = false
    c.rvel = Number3.Zero
    c.raccel = Number3.Zero

    World:AddChild(o)
    Camera:SetModeSatellite(o)
    o:AddChild(Camera)

    reset()
end


Client.Tick = function(dt)

    if o.Position.Length > 500 then
        reset()
    end



    c.vel = c.vel + dt * (c.accel.Y*o.Forward + c.accel.X*o.Right + c.accel.Z*o.Up) * 10
    --print("Vel: ", c.vel, "Pos: ", o.Position)
    
    c.rvel = c.rvel + (c.raccel*c.raccel*0.01) * dt
    o.Forward = (o.Forward + (c.rvel.X * o.Up + c.rvel.Y * o.Right)*dt):Normalize()

    o:ApplyForce(dt * (c.accel.Y*o.Forward + c.accel.X*o.Right + c.accel.Z*o.Up) * 10)
end



Client.DirectionalPad = function(x, y)
    c.accel.X = x
    c.accel.Y = y
end

Client.AnalogPad = function(x, y)
    c.raccel.X = y
    c.raccel.Y = x
end

Client.Action1 = function()
    c.accel.Z = 1
end

Client.Action1Release = function()
    c.accel.Z = 0
end

Client.Action2 = function()
    c.accel.Z = -1
end

Client.Action2Release = function()
    c.accel.Z = 0
end

Client.Action3 = function()
    c.rot = true
end

Client.Action3 = function()
    c.rot = false
end
#

unfortunately I do not have time to diagnose what part of the script caused the crash so I can't clean it up, sorry about that

granite kayak
#

Maybe ApplyForce?

#

oh i know

#

reset calls reset

#

lmao

#

or not?

#

i have strange tabulation in discord

#

sorry about that

#
Number3.Zero + 7
#

in reset

#

is weird

pallid mantle
#

try it before you speculate

#

that’s been fine for hours

granite kayak
#

how you adding 7 to number 3?

pallid mantle
#

shorthand for +Number3.One*7

granite kayak
#

uhh, we really can do this?

daring mesa
#

I can repro the crash as well! this was actually fixed in an internal branch, it'll make its way in the next release

pallid mantle
#

Cool, thanks

#

What is the issue?

daring mesa
#

double-checking that

#

it is related to Dev.DisplayBoxes specifically, you may comment that line in your code for now (edit code from outside the world)

pallid mantle
#

:O weirddd

pallid mantle
#

That's a powerful crash lol. If someone does anything you dislike in the game, just send them to a separate world with the crash bug!

#

wideeyes actually this can be used maliciously whether there is a bug or not

granite kayak
#

actually, you always can crash game

#

just spawn many objects?

pallid mantle
#

oh there's a confirmation screen

#

phew

#

I spoke too soon

#

Might want to fix this security vulnerability 😂

#

mostly just an annoyance, but still. Add one line of code to any world and it's locked to all but the creator

#

might be useful for people who want to keep worlds private when not in use 🤔

daring mesa
#

that's certainly not the only or last crash we'll have to fix! this one will be fixed in the next release (.66 I think), thanks for the report