00:00
00:00
3amsoda
i like to draw and make video games

Joined on 1/10/21

Level:
10
Exp Points:
1,020 / 1,110
Exp Rank:
64,322
Vote Power:
5.23 votes
Rank:
Civilian
Global Rank:
84,932
Blams:
4
Saves:
65
B/P Bonus:
0%
Whistle:
Normal
Trophies:
5
Medals:
256
Supporter:
2y 7m 12d

newgrounds api in godot

Posted by 3amsoda - September 7th, 2021


There was a godot game jam this weekend, before uploading my game here I thought itd be good to figure out how to add newgrounds medals and scoreboards to it. you can check out my game w/ newgrounds api integration here


It was pretty simple, I uploaded the html files to my newgrounds file dump for anyone to use newgrounds-godot.zip


There 3 files, index.html, newgroundsio.js, and ng-integrate.js


  • index.html is the html template



  • ng-integrate.js is some of the example code from the newgrounds.io documentation refactored into methods for Godot to call.


Index.html should be set as the custom html shell (red arrow below)


newgroundsio.js and ng-integrate.js should be dropped in the build folder (blue arrow)


iu_412046_8489216.png


Set APP_ID and AES_ENCRYPTION_KEY in ng-integrate.js to your games ID and key.


Once thats done, you can call the api using godot's Javascript singleton.


Make sure you call "initSession" on the handler for a user mouse down input.

iu_412047_8489216.png


Then you call unlock medals and post to scoreboards like so:

iu_412048_8489216.png

iu_412049_8489216.png


hope this helps! feel free to dm me with any questions.


13

Comments

@psychogoldfish should think about putting it on the newgrounds.io website

Awesome stuff, dude!

Great work! Have you considered posting this in the game development forum? I'm sure it would help others using godot!

I was looking into adding this to Newgrounds.io but we have an existing link for this one:

https://github.com/rojekabc/godot-newgrounds-plugin

Anyone here want to weigh in on if we should link both, or if one should be preferred over the other? Not sure how well the original one works.

I can confirm my way works I think my most recent game is a pretty good use case. My solution isn't a plugin though its just an html shell that goes with the Godot build. So if the plugin works I'd say stick to that.

@TomFulp Skootakip and I just had a discussion about it in the NG.io thread
https://www.newgrounds.com/bbs/topic/1412560/4
long story short is that plugin didn't work for either of us straight out of the box, but Skootakip found out that it works if you leave out the cert file. (I haven't tried that approach since I took a different route to get my games working.)

Wow I really have to explore godot, i hear great things about it. Im learning unity3d should i switch now lol