First game problems

The reason a server is needed is because browsers block accessing certain features when a page using those features is ran locally as a security measure. I sometimes use http://www.rejetto.com/hfs/ as a quick server when needed.

Aha, thank you, everyone, for the explanation…
But the problem still remains that even when I uploaded the game to itch, it won’t run…

And itch.io is a website, with a server and I uploaded the complete zip file with the index.html as requested by them and with all the assets and js files that the defold build gave me.

Can you please confirm what happens when you select Build HTML5 and Run from the menu. What is shown in the chrome dev console?

So I clicked this:

image

The bottom of the editor says this:
image

Then my default browser (Edge) opens up to this:

And if I try to use the same link in Chrome I get this:

And the console says this:

And in the Defold Editor, there are no Errors or console logs whatsoever:

There :slight_smile: might seem a bit childish to post this way, but yeah, I hope this explains everything.

P.S.
If I click this though:

image

A game window opens up:

and I get this log in the console of the editor:

image

Do you still have that heap size value set in game.project? Remove it or set it to a much higher value.

2 Likes

Thank you @britzl !!
I still had my heap size set, so I just removed it and set it to 0.
And now I got it to work in all the ways :slight_smile:
Even works on itch now! :smiley:
Yeah I know it’s a horrible game but I had to start learning somewhere xD

Next up, I need to optimize it a bit and try the tutorial from @Mathias_Westerdahl :slight_smile:

Thanks again! This community is awesome and really helpful! :smiley:

5 Likes

congrats on leaping over the first major obstacle =] Hope your further journey is smoother.

Also if you’re in a mood of watching 10-minute bits, here’s a Defold tutorial playlist for you: https://www.youtube.com/playlist?list=PLXsXu5srjNlz1HvCPytEVZggLqWBoF1pz

Make a game, explore the project, get a better feeling of Defold.

4 Likes

Back at it :smiley:
So I got it all working nicely thanks to all the help. Even made a nice shader from the awesome tutorial.

Now I decided to jump into the next big thing: 3D

I remember seeing a tutorial about importing a 3D book int Defold or something… can’t find it now.
But I did find this:

and this

But somehow even after getting the object in and assigning a simple material (model.material and a blue sprite) the object was not visible at runtime. And the other thing I can’t seem to figure out is the camera… I got it imported and it works, but the rotation is awkward and behaves weird… And the modeler is stuck in orthographic view even though it’s technically 3D, how come? Can I change that?

P.S.
What I am trying to achieve:

What I have:

Quite happy about 3 days progress from not knowing the engine to this :smiley:

3 Likes

here’s a project by @d954mas for you to play with - https://github.com/d954mas/save-shelter-defold

Sounds like it may help.

Maybe @ross.grams knows what’s wrong with the camera?

1 Like

I have a game design suggestion for you. Make the game about making “bridges” between safe lanes with obstacles in-between. So right now the gameplay is kind of slow. But you can click kind of fast to move more quickly forward. So imagine you are trying to move quickly from safe horizontal strip to safe horizontal strip with horizontally or in pattern moving obstacles in-between along with areas blocked off vertically. Otherwise making the back and forth movement much faster and having a quickly depleting health bar when not moving may help too.

Lerg example is easily to understand.

I see what you mean, sort of like an endless runner type thing :slight_smile: Nice idea, but not exactly what I am going for with this game.
If you checked out the fold version then yes, the game is a bit slow, but that is because I wasn’t focusing on playability yet, just wanted to make the game playable and visible online. But if you check the original Unity version, the gameplay starts off slow but gets very fast and interesting beyond 20 :slight_smile:
The main problem I haven’t figured out on the design part of the game is how to tell the player that he/she needs to get to 20, and then he gets a bigger platform again…
The idea is (not implemented in Defold yet) that the player moves faster all the time and it becomes increasingly harder to not click to fast or miss it.
Fun Fact: the current highest score was set by a friend of mine, she managed to get to 76 on her phone, which is insane since my personal best is 56…

@Oleg_The_Evangelist Thanks, but that project seems a bit too complex for now :slight_smile: But it’s definitely a great example of how 3D can be used in Defold

@d954mas That one looks more manageable and I will probably take some snippets of camera code it that’s ok?

I played around a bit and changed it from the top down perspective, to this interesting view, which is basically what I am looking for :smiley:

1 Like

Yeah, it is pretty awkward to do 3D stuff since the editor is limited to a 2D view. This looks pretty simple though. You can pretty much keep your gameplay 2D, on the normal X/Y plane, and just move your camera up in Z and angle it a bit.

With Rendercam, try these camera settings:
Orthographic: false (un-checked)
Near Z: 1
Far Z: 1000
View Distance: 500

Then set the camera object’s Z position to 500, and its X rotation to 30

[Edit] For a less crazy FOV, un-check ‘Fixed Area’, check ‘Fixed Height’, and set the FOV to 45 or so.

2 Likes

Wow, thanks, that worked like a charm :smiley:

I even figured out the lighting, using the project @d954mas posted :slight_smile:

This thing is starting to look more and more like my original :sunglasses:

But yeah, now that I think I got all the things I needed figured out, I guess I have to Remake some of it and fix the problems that appeared when I was just quickly coding the main functionality of the game.

But I did notice that sometimes the spawning of the floor object takes a while… I am using a factory to spawn the objects and if I start clicking quickly there are no new tiles as if they spawn with a delay and then they catch up to me…

Is there a reason for the delay in the factory creating the new object?
I use a msg call from my character object to call the function in the factory, like this:
image
And then I execute the create in the factory like this:

image

Not sure why the lag would appear… Perhaps I can try binding the msg call to the click, but all that does is that I will need to get all the needed information from the player object…

P.S. Here is the delay I am talking about… the objects do spawn and catch up to the player cube when the game ends… It is just a few tents of a second, but it’s clearly noticeable and at a normal FPS rate it shouldn’t be…

3 Likes

Message passing is usually handled in the same frame and game object creation as well, although the object will not be visible until the next frame. What if you skip the message and use factory.create directly?

Not sure I understand how I would do that @britzl
I use the message to send over the info where and what size to instantiate the object at all.
So skipping message is not something that would work (unless I misunderstood something).

And yes I also thought it would be in the same frame but the delay is way more than a frame. since the player can do 3-4 jumps before the first floor object appears…

What I meant was that as an experiment to replace the msg.post() with a direct factory.create() call just to see if it’s message passing or object creation that is the problem. I understand that a lot of logic will break but it would be as a test, not an actual change that you’d keep.

Was this an issue with the 2D version as well?

Oh I see, will try to do it to see what happens.

And no, I didn’t notice that in the 2D version.
Playing the 2D version again and trying my best, but can’t replicate it…