# Antigravity study demo V2

Hello all.

Just sharing some study I’ve been doing inspired by the awesome PG Babylon.js Playground
@Cedric thank you for the amazing demo and the node material that is giving me sleepless nights. Still amazed with it.

Play AG Racing here

Wishful thinking I will be adding player GUI in game, menus, in game collisions, particles, audio… if I don’t get lost in the math behind the track generation and the node material that is cracking me up.

14 Likes

Ho man! That’s so great!
Yes please keep up the good work.
It makes me so happy to see the PG being used .
Can’t wait to see your progress

1 Like

I don’t want to be a bother but I would love to get a in depth explanation in this magic if possible. https://nme.babylonjs.com/#01HFES#76https://nme.babylonjs.com/#01HFES#77 ( Vertex Output only)

I understand the track positionings and matrix computations on the src code but the node material math… specially around the vertex output is giving me nightmares. I reversed (tried) engineering the math but would love some guidance to understand this better. For example, where did the vector values to calculate the x,y,z comes form, namely Vector2(32.0,0.50), Vector2(224.0,0.50), Vector2(32.0,0.50), Vector2(32.0,0.50)?
I see a BABYLON.RawTexture.CreateRGBATexture being created to populate the information for the vertex output textures samplers but still confused how this influences the output.

Also a problem I think I could understand better how to sole would be for very lengthy tracks I see the segments being very stretched, on my ignorance I assuma adding more segments to the track on generating the initial mesh would solve this but does not seams like it. I am assuming something I am missing in the node material.

I know I can ignore and move along to the gameplay and other neat stuff on the gameplay but I am stuborn by nature and cannot move forward until clearly understand the logic behind this.

Again thanks for your amazing work on this PG.

IIRC, these values are used to sample the matrix textures.
32/256, 224/256 give a U value between 0 and 1.
Make a layout on paper with how the datas are set in the texture and it will get clearer

Thanks for the quick response. I don’t think I still clearly understand the behaviour here but I’ll keep digging/experimenting

I want to add extra info to the track in the node material ( shader) for behaviours such as jumps. Also want to clearly get this stuff to be able to add ‘shortcuts’ to the track and some dynamic routings.

1 Like

Ok I think I got it. Feel free to correct me if I am wrong here.

You pass the RGBA texture containing the information for the vertex positionings ( PG src computeMatrix) once done in the shader ( node material) you extract that data from it. Following trackSamplerN from (x/32, y/96, z/160, position/224).

IIRC it contains orientation and position. but that’s the principle, yes.

1 Like

Woooo, this is fun!

1 Like

This is a follow up on the Antigravity Racer Game using my baby tooling Webnatives.app

I have in place for development:

• Live Editor ( extended with awesomeness of the BJS debugging tools)
• GUI drag and drop editor ( will try to do a demo video soon);
• I18N support;
• One click build and push to live with no need to update live links.

I am having a blast with this

• “Triple BJS all the way!”
5 Likes

Nice!

• Updated with a “ton” of optimizations following this wonderful guide Optimizing Your Scene | Babylon.js Documentation.
• Added small intro counter and final race screen for testing flow.
• Added device orientation handling and proper resize methods.
Running smooth on devices ( no touch control to play on it though, not a priority right now).

Same link as the one in the original post to test it. I would love to get as much feedback on it as possible. I am all in in this project.

2 Likes

4 Likes

Dev log:

• Small polish to quick play flow;
• In game behaviours for different player vehicles;
• End screen on race complete;
• Vehicles Trails using the BABYLON.TrailMesh;
• Glow added to in game scene;

Controls:
a | ArrowLeft : turn left
b | ArrowRight: turn right
w | ArrowUp: SpeedUp
c : change camera view

Bonus : f key to fire some cubes ( WIP)
Test it here

Dev log (0.0.12):

Next:

• Audio ( Menus and in game audio);
• Game modes;
• Improved gameplay and AI;
• Multiplayer;

This is an important one for me as a lot have been done to stabilize the framework and development pipeline keeping BJS renderer integrity as a whole.

Controls:
a | ArrowLeft : turn left
b | ArrowRight: turn right
w | ArrowUp: SpeedUp
c : change camera view
space: Use booster

Play here

Edit track live:
Free camera with arrow keys, using Gizmos (Gizmos | Babylon.js Documentation).

Feedback is always welcome

4 Likes

Dev log (0.0.13):

• Added audio ( background score and SFX audio, just stole engine sound from the Space pirates Project GitHub - BabylonJS/SpacePirates);
• Editor optimizations;
• About section update to thank the BJS team and some special mentions.

Next:

• Game modes ( Quick Play, Time Trial, Championship… and more);
• Multiplayer ( still figuring out which multiplayer model should I go first, real time racing, track sharing, deferred time trial );

Controls:
a | ArrowLeft : turn left
b | ArrowRight: turn right
w | ArrowUp: SpeedUp
c : change camera view
space: Use booster

Play here - SOUND ON

1 Like

It’s even cooler with sound! I like the chromatic aberration effect when it crashes

I think time trial would be the easiest mode to do multiplayer

1 Like

Slow progress but working with BJS is so much fun I keep learning and optimizing stuff.

Dev log (0.0.14):

• Added game modes Quick Play | Championship;
• Track Editor aka Sandbox improvements;
• Replaced StandardMaterial with BackgroundMaterial for GUI for unlit reasons ( still checking perf on this change). Bonus for who can find a ‘bug’ in game related to this.

Next:

• Multiplayer ( still figuring out which multiplayer model should I go first, real time racing, track sharing, deferred time trial ); Will be using Colyseus for this due to it’s simplicity.

Controls:
a | ArrowLeft : turn left
b | ArrowRight: turn right
w | ArrowUp: SpeedUp
c : change camera view
space: Use booster

Play here - SOUND ON

PS: I am trying to get an true artist to help me push the visuals on this. Already in touch with former colleague to see if this is possible. Lets see what can I achieve with a \$0 USD budget

1 Like

Dev log (0.0.15)

• Online multiplayer ( Colyseus.io - semi authoritative)
limitations
• No track selection
• No rematch and no player profile
• Server only handles 1 room concurrently and 4 players so if you see a connection error its a feature
• No bots so that someone it’s wanting to play at the same time as you.

Next:

• Start to think about content and polishing things.

Play here - SOUND ON

3 Likes

Dev log (0.0.16)

… Polishing a game is hard work…

1 Like

Same here. I am starting to believe it is probably 80% of the total dev time (pareto).

1 Like