Released in Defold 1.2.147
I keep working on the game and noticed some inconsistency and area for improvements in Facebook platform documentation.
I need Facebook Analytics to track installs from FB Ads + for custom game events. First of all, I missed the fact that FB support is already implemented in the engine and was looking for some extension and failed to find any But it’s my bad, no complaints here.
- The manual looks old, here are Editor 1.0 screenshots and approach. Not critical, but worths updating
- Nothing said about Facebook Analytics. I think it would be very nice to have a separate paragraph related to Analytics (so it will be possible to find it from search by exact request). With such info:
- what needs to be done to make it work (actually it’s enough to just set your Facebook App ID in game.project and you’re all set, but this was totally not obvious for me)
- what platforms are supported for analytics (I’m still not sure if it’s possible to send events from HTML5 build outside of Facebook Canvas, what about “Web” app type in FB dashboard? Is FB Pixel JS lib integrated to Defold’s HTML5 build?)
- it worths mentioning, that attempt to call methods to “facebook.***” on the not-supported platforms will cause an error (facebook is nil), so you need to use “sys.get_sys_info().system_name” to check the platform
- what events will be sent automatically (I was sure that I need to send “facebook.EVENT_ACTIVATED_APP” manually because it’s listed in the API docs and there is no notice saying “hey, Launch event will be tracked automatically, no need to carry about it”)
- and finally would be nice to briefly say how to see your events in FB Dashboard and make sure you did everything right (in theory it’s enough to just build and launch the app, being connected to the internet ofcourse; and then check events in the “Event Debugging” panel in FB Dashboard)
So, from this manual I’ve at least knew where to put my FB App Id. But what’s next? From my previous experience I knew that there should be some kind of “activation” event to track new installations and app launches. So I went to the API docs https://www.defold.com/ref/facebook/#facebook.post_event:event-value--params-
And again - there were few frustrating things:
- I saw “facebook.EVENT_ACTIVATED_APP” param name and thought “Aha! Gotсha! I need to send this event on the app start!” And there was nothing saying I actually should not.
- So I tried to write “facebook.post_event(facebook.EVENT_ACTIVATED_APP)” and noticed that there is no such constant. Went back to the docs - the const is listed in “post_event” description, but is not listed in “constants”. So it looks outdated and I guess it should be removed from the “post_event” desc (as well as few other consts)
- There is https://www.defold.com/ref/facebook/#facebook.enable_event_usage method that “enables events usage”, but it’s not said if it’s enabled by default or should be triggered manually. For me personally it’s very frustrating to see such triggers without pointing to the default state (later I figured out, that yes, it’s enabled from the box)
- What about “EVENT_LEVEL_ACHIEVED”? It’s supposed to be one of “standard” events, but I don’t see it in consts list.
- https://developers.facebook.com/docs/analytics/send_data/events#implementing-events - here in “Events constructor” I see a toggle for “Use value to sum”, and as I see in generated codes it simple adds or removes “value” parameter. But in Defold’s “post_event” the “value” parameter is not optional. And it’s said “This should represent the value of the event, such as the level achieved” - but logically sum achieved levels number sounds as a bad idea… Just a bad example with the level? So, just put 0 here? Should not it be totally skipped for events where I don’t need to sum value?
Finally I’ve found the list of events supposed to be sent automatically: https://developers.facebook.com/docs/analytics/send_data/events#autologged, decided that probably Defold does this without any additional actions, built the app, launched it on the device and observed “App Launch” event in the dashboard.
I spent about two hours trying to understand what is the right way to implement analytics and was surprised both with the docs incompleteness/inconsistency and by the fact that no-one asked about it on forum before. I believe nowadays FB Login is not very demanded thing, but Facebook Analytics is, including but not only because of FB Ads. I’d be happy to help with making it more clear to other newbies
P.S. there are 50 new levels and some design improvement in the game: http://anvil-games.com/defold/catapult/index.html - I’d appreciate any feedback
Thank you for the feedback. I will look into improving the manual, probably next week.
This game seems like perfect for “watch an ad to unlock a random character skin” with the coolest ones teased.
Maybe add some “white air streak trails” behind the character as it flies around.
Thanks for the feedback! Various characters is definitely what we are going to add at some point
As for trails - yeah, I was thinking about it too, any ideas how can this be made in Defold? I know two approaches to draw trails - generate the trail from triangles in runtime or try to make it via particle system. Not sure if first approach is even possible in Defold at the moment (I remember someone said you can’t manipulate generate polygons in runtime). As for particles - it’s hard to make trails smooth with this approach, it probably will be looking fractional.
So, any ideas?
Try particles just to see how they look (these don’t have to be pointy they could be small white dots, you could also make some flat particles and stretch them based on velocity… experiment and see what looks good). Apply a negative inherit velocity to make them shoot away from the character. I’d render these particles below game sprites so you probably would want to give them a sprite material and then put their z below the sprite z, or make a custom render predicate or two…
For the game object approach I would make a factory create a triangle shape pointed away from the character and have that z below the player. Defold already pools GOs for you so you can create/destroy them freely. So you spawn a trail GO, and then animate it to scale it down to nothing with a callback function within that to destroy the GO. That way you don’t need a script on each trail GO to deal with that… should work! And should make a nice white pointy streak following the player. You should be able to get the direction to point the arrow shape based on the player’s physics simulation
I’ll try, thx
I have updated the Facebook manual and added a separate section for Facebook Analytics:
This is unfortunately a left-over that should have been removed from the docs. EVENT_ACTIVATED_APP, EVENT_DEACTIVATED_APP and EVENT_SESSION_INTERRUPTIONS will be removed from the docs in 1.2.149.
This is missing from the docs but available as facebook.EVENT_ACHIEVED_LEVEL. It will be added to the docs in 1.2.149.
These events are logged automatically by the Facebook SDK that we use.
Perfect, thanks for the update!
Great game by the way!
Fixed in 1.2.149