4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.83k stars 849 forks source link

New Bike Demo #873

Closed zatsme closed 5 years ago

zatsme commented 5 years ago

Bike demo including Physical Bike, Ragdoll, Timing, Height adjusted camera and breakable joints.

See last post for latest zip

Hopefully it's helpful for beginners to get started 😄

4ian commented 5 years ago

Impressive! Love this :D If we had some nice textures for the ground and mobile controls, this could make a really fun game that could be part of the starters! (the idea of the starters is that they are a gameplay complete mini game, fun and that they have good quality graphics :))

4ian commented 5 years ago

Events seems very well done and commented, good job there too!

zatsme commented 5 years ago

Well if you like you can include it as an example for now and I'll make some graphics for it and add mobile controls, Tilt device for rotation and some buttons for pedaling and reset 👍

4ian commented 5 years ago

Did 39s btw... will have to practice a bit more ;)

4ian commented 5 years ago

Added for next version. Again great job on this, this is really awesome and super fun to use. Remind me of the hours I spent playing X-moto :) We should definitely have this as a starter with a few improved graphics and controls. Pretty sure tons of people would try it and maybe build fun games out of it!

zatsme commented 5 years ago

Great, will make some GFX and add the controls for mobile in the week, hopefully ready for the next release 😃

zatsme commented 5 years ago

Been playing with making the GFX better tonight and think I have a suggestion for the engine but thought I'd post it here as I found it because of this. Unless I'm missing something, the best way to make a level for this game is to create 1 or many sprites in the shape of the course, nothing else works well. So I have this:-

2019-01-15 1

So this looks ok but is a bit low res even though it's 5306x2340.

So my suggestion is for a new type of object which allows you to define a polygon and then to work like tiled sprite, this would make it much easier and more efficient for this kind of level/background. If we can make them in code then we can generate pretty decent levels for this and many other types of games. I guess the other (maybe proper) way of doing this is to have a SVG object so we can import from inkscape etc. This would probably be the most efficient way.

What do you think? 🤔

4ian commented 5 years ago

the best way to make a level for this game is to create 1 or many sprites in the shape of the course

Why wouldn't assembling smaller objects work? It's fast to render, fast to compute, cheap for the physics engine and won't break GPUs. And it's much more flexible because you can assemble and change the level by moving small, reusable blocks of it, like in a platformer game.

I see your idea for an object that is a "tiled sprite in a polygon" though. But I think here you're restricting yourself because you're trying to have a "nice tiling" for the whole level. It's not necessary! Create a few nice GFX for platforms, then assemble them. If the transitions between them is too abrupt/visible, add fake flowers, rocks, small bushes on top of it :)

zatsme commented 5 years ago

I was thinking of games like stickman downhill where you have the ground with trees jumps etc, which is no problem as you say. But underneath the track to fill to the bottom of the screen you have a uniform texrure which just looks good. I was trying to think of how we could do it in gd. Like this... https://www.google.com/url?sa=t&source=web&rct=j&url=https://m.youtube.com/watch%3Fv%3DvdPIOWL9qhE&ved=2ahUKEwj2j7C18vDfAhVPJlAKHbg_AgcQiE4wBHoECAcQAg&usg=AOvVaw1riT5o9jOIxEDcDy8iGKd6

4ian commented 5 years ago

I see. Then in this case you're right it's indeed a "tiled polygon" (with edges) that would be needed. Which would be a new object type I think. Note that even in this case, the polygons used by the physics engine should stay not too large to be efficient - polygon in physics have a maximum of 8 vertices I think. But you could imagine having hidden objects that are physics enabled to "draw" the road, like what you did in the example you shared, then on top of it, you have the polygon representing the track - but it's only for display :)

So you'll have both a lot of small physics objects, and a few larger "tiled polygon" objects to represent the track.

4ian commented 5 years ago

I think this could be achieved with a new object working with "meshes". See PIXI examples like: https://pixijs.io/examples/#/basics/textured-mesh.js

4ian commented 5 years ago

I've added a card for this: https://trello.com/c/7gxGSQk4/233-add-support-for-meshes-objects-arbitrary-textured-polygons on the roadmap so that the idea is not lost :)

zatsme commented 5 years ago

Great, that's what I meant! But I would only use them for graphics and have a thin line like now for the physics as I think it would be more efficient. I first tried to just use rectangles instead of the thin line I have now but the raycast I use to detect the height of the bike for camera zoom returns the centre of the hit object making the camera jerk all over the place as the bike moves down the course, so the thin line for the physical track seems to work best 😄 I'll make these graphics nicer using the tools we have right now and hopefully we can make this new type of object some time in the future 👍

blurymind commented 5 years ago

This is a fantastic idea! There is an implementation for Godot that does it in a way that replicates the level editor used for the Rayman games- allowing to also specify left right top and bottom tiled textures for the mesh. Not just middle

blurymind commented 5 years ago

https://twitter.com/ndee85/status/1028400151830953984?s=19

https://twitter.com/ndee85/status/1027521390151434240?s=09

Also see https://youtu.be/EOcUFtwF1Cg

https://youtu.be/jDUKLIHetgI

Lizard-13 commented 5 years ago

@zatsme Note that the raycast condition works on the object GD hitboxes, it ignores the physics shapes.

Box2D supports a raycast function, so maybe we can add that condition to the physics extension to be able to raycast physics shapes only... but thinking about it... the raycast should have a "layers" parameter, and we don't have a layer parameter type, so lets forget it for now :sweat_smile:

zatsme commented 5 years ago

@4ian Here's a new zip with better gfx, also I made the game more fun/playable at least I think so 😆 by scaling the gfx and physics better 👍

What do you think?

4ian commented 5 years ago

It's getting better and better :) A few things:

This will be really good, loves that it works on mobile now!!

4ian commented 5 years ago

Oh also, speaking of mobile, you can add an action to make the mobile quickly vibrate when the force is high ;)

zatsme commented 5 years ago

I think it's a bit frustrating that the force adds up, especially because sometime jump that are not that high are adding a lot to the force. Better having like a "gauge" that quickly go back to 0 (decrease it by something like 100 per second) and have a smaller value like 500/600 :) This way the player will avoid making super huge jumps but can still do a lot of them.

The force is not cumulative, it shows the highest force you have achieved during this round, it only kills you if you go over 1000 😄

It's supposed to be an indicator of how near maximum you have gotten, do you think it would be better a different way?

I'll start working on the other points 😄

zatsme commented 5 years ago

@4ian Hows this?

2019-01-19

zatsme commented 5 years ago

@4ian Here's the zip with changes, in the preview over network I get vibration on my phone but after android build there is no vibration when playing the game.

Is there an issue with the build service? or am I just tired 😄

zatsme commented 5 years ago

Just to confirm the issue I built the vibration example and there is no vibration 😕

Lizard-13 commented 5 years ago

Vibration is not supported in Android, as extensions have no way to add cordova plugins during build :( (The admob is a cheater because the plugin information is hardcoded in the engine itself).

zatsme commented 5 years ago

Does it work for iOS and is there no way around it apart from a local build?

Lizard-13 commented 5 years ago

No idea about iOS, the build service doesn't support it yet anyway. And to get vibration to work (AFAIK) building yourself is not enough, but also code the extension yourself using the API of the plugin you're going to install.

zatsme commented 5 years ago

@4ian Here's the updated zip with your suggestions, added force bar to the other bits 😄

Downhill Bike Race.zip

4ian commented 5 years ago

Looks great! Will add it for next version 💪

My personal best ;) image

Wend1go commented 5 years ago

This is strange. I'm using the window.navigator.vibrate() function which according to this link should be available on the android browser. But I could only really test it on my Ubuntu Touch smartphone where it worked flawlessly (I only have a very old Android 4.0.3 smartphone). https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API#Browser_compatibility I'm going to investigate on this.

EDIT: I found something: https://github.com/MobileChromeApps/mobile-chrome-apps/issues/526 Looks like we have to either ask Android for the permission via the manifest file or use the Cordova vibration plugin. @4ian What is your preferred option?

4ian commented 5 years ago

As:

we should use it :)

Now for the tricky part of how to implement this. The plugin for AdMob is hardcoded in the Exporter for Cordova as mentioned by @Lizard-13: https://github.com/4ian/GDevelop/blob/master/GDJS/GDJS/IDE/ExporterHelper.cpp#L283-L291

There is for now no way to specify for an extension a plugin to use for Cordova. I would need to add something in extensions to declare exporter specific options:

extension.addExporterSpecificOption("cordova", "plugin", "cordova-plugin-vibration")

or something like this (with the possibility to set the specific version of the plugin.

Lizard-13 commented 5 years ago

Some plugins (AdMob included) require to set extra variables too.

4ian commented 5 years ago

Yeah so I'd like to come up with something that is flexible enough

blurymind commented 5 years ago

this one has a good looking bike in it https://moonstar2d.itch.io/free-paid-vehicle-car-sprites- for the bike demo preview

motor bikes.zip

Now I realize that you would actually need something with pedals hmm

jjhesk commented 2 years ago

downhill.zip this is the fix for gd5 version.