Runner Tutorial: No Spawning Platforms

dmloader.js:336 ERROR:CRASH: Failed to write Crashdump file.
printErr @ dmloader.js:336
put_char @ dmengine.js:1
write @ dmengine.js:1
write @ dmengine.js:1
doWritev @ dmengine.js:1
___syscall146 @ dmengine.js:1
QDa @ dmengine.js:5041
FDa @ dmengine.js:5042
GDa @ dmengine.js:656
Yea @ dmengine.js:396
aya @ dmengine.js:1236
$xa @ dmengine.js:1234
ccallFunc @ dmengine.js:1
window.onerror @ dmloader.js:687
window.onerror @ VHVQAF3CGZHK3JYO4WY2HC.js:289
error (async)
listenAll @ VHVQAF3CGZHK3JYO4WY2HC.js:282
(anonymous) @ VHVQAF3CGZHK3JYO4WY2HC.js:334
(anonymous) @ VHVQAF3CGZHK3JYO4WY2HC.js:337
(anonymous) @ VHVQAF3CGZHK3JYO4WY2HC.js:385
dmloader.js:336 [missing WebGL] Exception thrown, see JavaScript console
printErr @ dmloader.js:336
Module.setStatus @ dmloader.js:495
window.onerror @ dmloader.js:688
window.onerror @ VHVQAF3CGZHK3JYO4WY2HC.js:289
error (async)
listenAll @ VHVQAF3CGZHK3JYO4WY2HC.js:282
(anonymous) @ VHVQAF3CGZHK3JYO4WY2HC.js:334
(anonymous) @ VHVQAF3CGZHK3JYO4WY2HC.js:337
(anonymous) @ VHVQAF3CGZHK3JYO4WY2HC.js:385
dmloader.js:498 Uncaught ReferenceError: params is not defined
at Object.runApp (dmloader.js:498)
at HTMLButtonElement.document.getElementById.onclick (dashboard.edecb7e9ffcdc59447cc.js:1)
runApp @ dmloader.js:498
document.getElementById.onclick @ dashboard.edecb7e9ffcdc59447cc.js:100:

I also noticed this text on the game “box”:

“Unable to start game, WebGL not supported”

What happens on this site?

https://get.webgl.org

Hmm. While your browser seems to support WebGL, it is disabled or unavailable. If possible, please ensure that you are running the latest drivers for your video card.

For more help, please click this link.

This might help, but I need to try it later:

https://www.santoshsrinivas.com/enable-webgl-on-chrome-on-a-macbook-pro-2011/

Enabling WebGL in Google Chrome for MacBook Pro worked.

Web pages disappear over time, so here is a retake what I needed to do for people reading this message years after posting it:

Type chrome://flags/ in the URL bar to various experimental features.

Then enable the following options (use the search feature to identify):

  • Override software rendering list
  • WebGL Draft Extensions

(There is no option “WebGL 2.0” for me as mentioned in the original web page, so it may have disappeared.)

Where is the “self.spawns” mentioned in level / controller.script in the tutorial? Are there some default tables in Defold? I’m still new to Defold, so I can’t find everything yet. What are the other default tables or variables all the game objects have?

Nevermind, it is defined in the code:

self.spawns = {}

So, you can just create new variables with

self.something =

(Sorry for spamming by using multiple messages.)

I come from C++ (and others) background, so I have to change my way of thinking from this one:

class person
{
  public:
    string name;
    int age;
};

I would like to start testing Lua syntax using Defold first and maybe Mac Terminal later. How do you define your own test script, so that it will be executed when you start your project?

I installed a Lua implementation using MacPorts, so now I can test Lua as much as I want.

Any script that is attached to a game object that is part of a loaded collection (either bootstrap collection or collection proxy) will be executed when the project is running. Scripts can also load Lua modules. Check the manual for details.

I was looking at the source code, when a question was raised. In one of the versions of the hero.script it says:

local gravity = -20

local jump_takeoff_speed = 900

function init( self )

    msg.post( ".", "acquire_input_focus" )

    self.position = go.get_position()

    self.velocity = vmath.vector3( 0, 0, 0 )

    self.ground_contact = false
end

Why is for example gravity outside init and self.position inside init? What I mean is why can’t you define all the variables regarding hero inside the init function? Or are the variables outside, so programmer won’t change them?

The Lua in Defold manual gives you all of this information and more, and it is a quick read.

Sorry, ross.grams, I’m not there yet to understand what you are referring to.

Follow his link there and it’ll teach you a bunch of good to know stuff about Lua programming, tailored to Defold context.

I also recommend you read:

and

As these two will explain things regarding your previous question - the one about why/where you put variables in scripts.
local vs self.vars etc.

The coins seem to be a bit off in my version of the game. Is it me or the tutorial? Probably me, because I can’t be the only one who has finished the tutorial.

runner-2018-03-10-001.zip (1.5 MB)

Tomi, read this section on the difference between local, global and script scoped variables: Lua programming in Defold

It explains the difference between a variable declared as local outside the lifecycle functions (ie init, update and so on) and a variable declared in self. If you still don’t understand the difference then please ask here again.

It’s likely a mistake you’ve made. Have you done a bit of poking around yourself trying to figure it out? It could perhaps be that the sprite component of the coin.go is offset from 0,0.