Golf Royale - My first babylon js game!

Hi all,

Myself and @mentalnote have been posting on the forum for a little while now getting help from various staff and community members. Just want to officially say thank-you to the awesome community here and especially the devs.

Now what have we been working on?

It is a real-time mini-golf game where the aim is to get the hole as fast as possible in as few shots as possible. What makes it cool is you are playing against up to 25-50 other players to see who can make shots while moving at high speed and generally sling the ball all around the golf course. So, think golf + racing, haha.

The other really cool thing imo, is we built a level editor where players can make their own course for others to play (editor also fully in bjs).

We also spent a decent amount of time on performance, so you should be able to play it on most devices. Mobiles devices, well, Android and iOS, are supported too!


Wow! Runs smooth, and there are lots of players online now :smiley:

Yep, we used the full gamut of babylon optimsation techniques, SPS is in full effect during gameplay :grinning:

1 Like

What I really want though is super cheap shadows!

Awesome :smiley: Could I ask how and where you used SPS in brief? Curious about this technology and haven’t explored it much yet

All level geometry is stored in SPS, allowing all level geometry to effectively be drawn as a single mesh. This allows us to skip many checks that are slow on low fps machines. Additionally our game is particularly suited to SPS because there is a relatively high amount of mesh reuse in the levels.

1 Like

Hey, nice idea! This show promise, a couple of points though.

1 - Mobile navigation is a little bit hard.
2 - Graphically speaking, the red texture seems like there is a texture missing. Also, you could do some further enhancement the UI of the game.

Why did you opt for SPS and not Instances?

Mobile nav/controls are clunky I’ll admit, I mostly use the mobile version to test perf tbh!

As for textures and UI I am no artist, so if you want to point me to an example of something pretty I can try to clone that’d be great haha.

Why did you opt for SPS and not Instances?

I tested instances, clones, and SPS. I tried every trick on this page Optimize your scene - Babylon.js Documentation

I have a setting file where I can toggle on using instances, clones, SPS, freezing active meshes, freezing matrices, not updating bounds etc. After testing on many devices I can say, in our case, SPS gave the best performance.

If I were to speculate why SPS gives better performance over instances in our game I would think it is because instances still incur all the costs of matrix computation, bounds update, active mesh update per mesh afaik. The actual rendering of meshes never appears to be the bottleneck in our case, just all the updates/checks around having a mesh in general.

You may say, well, why not freeze meshes and set bounds not to update and make meshes always active? I did, SPS was still faster in my case.

1 Like

This game is really addictive! Well done. You also did a good job balancing the score weighting with time/par. It feels very fair, which probably suggests it isn’t really :wink:

I broke the game :wink:

Somehow I got a physics glitch where I was stuck in the jump. Can’t remember the name of the level, but it’s one of the very hard ones.

By the way, maybe you have already posted this, but how did you code the server side? Using NullEngine?

Ah yes, clipping into geometry is quite common unfortunately with ammojs + some custom physics we are doing it seems quite prone to it. We will be working on this as/if the game grows. In the meantime, you will see in your screenshot “r” to reset. That will pop you back at the start :slight_smile:

1 Like

This is lit

Honestly one of the best things I have seen made yet.

this has potential to go viral.


I haven’t had so much pure fun in a long time :slight_smile:


Some more mobile feedback: The game ran smooth (felt like constant 60fps) on my high-midrange tablet from 2018. Even though the graphics chip was not even one of the most powerful back then. So that’s great!

Unfortunately due to the controls I didn’t manage to get to the hole, unlike on PC.

I have a simple idea for improving the mobile controls, although you might have tried that already. If so, just ignore the suggestion.

You could get rid of the virtual joystick and just detect swipe movement along both the x and y axes, and discard any strongly diagonal movements. If the swipe was up/down, then putt. If the swipe was left/right, then swipe the camera. If you go from an up/down movement to a left/right one, cancel the putt. I think that could work. I have no idea for the zoom controls, but I don’t find them that important in practice, so I guess you could do that using a slider or something.

edit: and is it possible to reset the graphics mode? On PC the game is now running with a really small resolution because I had a lag when taking the screenshot. edit: Apart from clearing cookies, of course

Haha yeh, the “dynamic resolution” thing I put in is pretty dumb, once it downgrades your resolution you have to refresh to restore it. If it is still persisting beyond that I might have to turn it off and investigate some more - or get you to open the console log.

I see what you are saying about mobile controls, that does sound more mobile friendly. The current mobile controls require a landscape orientation and two thumbs held like a conventional controller to have any chance of sinking the ball (well, that’s how I play it on mobile anyway). That said, I think the game is just not overly suited to a coarse pointing device such as a finger. I will put more love to mobile if we get more mobile players though, currently only 2% of players are on mobile though.

This is pretty rad!! adding @PirateJC to add it to bjs website!


This is super fun to play!

Added to the community page and games page:

1 Like

This is awesome!!! I love the massively multiplayer aspect of it. a really really cool take on minigolf

Great Game!
Maybe it’s just my evil persona but actually beeing able to pushing other balls from the cliff would also be funny …

Nice one :point_up: