Skip to content

FlxGameJolt Update #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open

FlxGameJolt Update #461

wants to merge 11 commits into from

Conversation

GamerPablito
Copy link

@GamerPablito GamerPablito commented May 1, 2025

fixes #406
I've implemented the new functions the GameJolt API v1.2 has to offer, including batch requests and better load of the images.

Copy link
Member

@Geokureli Geokureli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • In the future please make a feature branch on your fork, rather than using GamerPablito:dev, but this is fine
  • Keep the old FlxGameJolt and deprecate it
  • You should update the FlxPongAPI demo, which is our demonstration of the FlxGameJolt api. this will allow people to learn the new system, and it will allow me to test this branch

Comment on lines 3 to 25
/**
* The way the scores are fetched from your game API.
*
* @param score The display text of the Score.
* @param sort The Score value.
* @param extra_data If some extra data is attached to this Score, it'll be shown here.
* @param user The username of the User who achieved this Score, if it's a registered User.
* @param user_id The user ID of the User who achieved this Score, if it's a registered User.
* @param guest The name of the user who achieved this Score, if it's a guest user.
* @param stored A short description about when the Score was achieved by the User or Guest.
* @param stored_timestamp A long time stamp (in seconds) of when the Score was achieved by the User or Guest.
*/
typedef FlxGameJoltScore =
{
score:String,
sort:Int,
extra_data:String,
user:String,
user_id:Int,
guest:String,
stored:String,
stored_timestamp:Int
}
Copy link
Member

@Geokureli Geokureli May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style of comment isn't as helpful as the following, which shows a description for each field on hover:

Suggested change
/**
* The way the scores are fetched from your game API.
*
* @param score The display text of the Score.
* @param sort The Score value.
* @param extra_data If some extra data is attached to this Score, it'll be shown here.
* @param user The username of the User who achieved this Score, if it's a registered User.
* @param user_id The user ID of the User who achieved this Score, if it's a registered User.
* @param guest The name of the user who achieved this Score, if it's a guest user.
* @param stored A short description about when the Score was achieved by the User or Guest.
* @param stored_timestamp A long time stamp (in seconds) of when the Score was achieved by the User or Guest.
*/
typedef FlxGameJoltScore =
{
score:String,
sort:Int,
extra_data:String,
user:String,
user_id:Int,
guest:String,
stored:String,
stored_timestamp:Int
}
/**
* A score fetched from the gamejolt server.
*/
typedef FlxGameJoltScore =
{
/** The display text of the Score. */
var score:String;
/** The Score value. */
var sort:Int;
/** If some extra data is attached to this Score, it'll be shown here. */
var extra_data:String;
/** The username of the User who achieved this Score, if it's a registered User. */
var user:String;
/** The user ID of the User who achieved this Score, if it's a registered User. */
var user_id:Int;
/** The name of the user who achieved this Score, if it's a guest user. */
var guest:String;
/** A short description about when the Score was achieved by the User or Guest. */
var stored:String;
/** A long time stamp (in seconds) of when the Score was achieved by the User or Guest. */
var stored_timestamp:Int;
}
Screenshot 2025-05-06 at 7 36 08 AM

Also note: Wherever possible you should copy the documentation of these fields directly from gamejolt's api. specifically, the phrasing "The way the ___ are fetched" is not ideal, that describes a process, when these typedefs describe objects

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply these changes to every typedef

user_id:Int,
guest:String,
stored:String,
stored_timestamp:Int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is described as a "long" does it need to use Int64

Comment on lines 70 to 76
* Creates a new section for URL creation. The `requestBatch()` function requires this for its entries to work correctly.
* @param command The command of the call section.
* @param action The action (if there's any) of the call section.
* @param params The parameters the call will take in count when requested.
* @param encode Whether to encode along with a signature at its end or not.
* @return The resulting section.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the following doc format:

Suggested change
* Creates a new section for URL creation. The `requestBatch()` function requires this for its entries to work correctly.
* @param command The command of the call section.
* @param action The action (if there's any) of the call section.
* @param params The parameters the call will take in count when requested.
* @param encode Whether to encode along with a signature at its end or not.
* @return The resulting section.
*/
* Creates a new section for URL creation. The `requestBatch()` function requires this for its entries to work correctly.
* @param command The command of the call section.
* @param action The action (if there's any) of the call section.
* @param params The parameters the call will take in count when requested.
* @param encode Whether to encode along with a signature at its end or not.
* @return The resulting section.
*/

Note: 3 spaces after @param, all param names have spaces so the descriptions start on the same column, 2 spaces after @return

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed the note at the bottom

Note: 3 spaces after @param, all param names have spaces so the descriptions start on the same column, 2 spaces after @return

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already rewritten the entire FlxGameJolt class, and the descriptions finally fit according to how did you describe it to me, check it out

Comment on lines 198 to 217
/**
* Sends multiple calls in a single request to the GameJolt API to process.
* @see https://gamejolt.com/game-api/doc/batch/
* @param calls The list of calls to send to the batch. You can set up to 50 calls per batch. NOTE: Use `buildURLSection()` with its parameter `encode` set to `true` for the creation of every call you want to add here.
* @param parallel Whether to run every call at once (true) or in the order they were set (false).
* @param break_on_error Whether to return an error message in the main response body if one or more calls fail or not.
* @param onComplete Callback that will contain the requested data, if the request ends successfully.
* @param onError Callback that will contain the error information of the request, if the request fails.
* @param onProgress Callback that will be called while the request is loading results.
* @return The request instance.
*/
public static function requestBatch(calls:Array<String>, parallel:Bool = false, break_on_error:Bool = true, ?onComplete:Array<FlxGameJoltResponse>->Void,
?onError:String->Void,
?onProgress:Float->Float->Void):URLLoader
{
var params:Array<Param> = calls.map(c -> {key: "responses[]", value: c.urlEncode()});
params.push({key: "parallel", value: '$parallel'});
params.push({key: "break_on_error", value: '$break_on_error'});
return initRequest(buildURL("batch", params), data -> data.responses, onComplete, onError, onProgress);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the format I gave, never put a tab character unless it's to indent a line

@GamerPablito
Copy link
Author

  • In the future please make a feature branch on your fork, rather than using GamerPablito:dev, but this is fine
  • Keep the old FlxGameJolt and deprecate it
  • You should update the FlxPongAPI demo, which is our demonstration of the FlxGameJolt api. this will allow people to learn the new system, and it will allow me to test this branch

I will keep this in mind

@GamerPablito
Copy link
Author

The only thing left is to update the FlxPongAPI demo to fit with the new functions.
I'm on it rn.

@Geokureli
Copy link
Member

I unresolved a conversation you closed, please read it and apply the requested changes

Comment on lines 3 to 17
/**
* The way the score tables are fetched from your game API.
*
* @param id The ID of the Score Table.
* @param name The name of the Score Table.
* @param description The description of the Score Table.
* @param primary Whether if this is the Primary Score Table in your game (1) or not (0).
*/
typedef FlxGameJoltScoreTable =
{
id:Int,
name:String,
description:String,
primary:Bool
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply the same doc format I requested for FlxGameJoltScore

Comment on lines 3 to 21
/**
* The way the trophies are fetched from your game API.
*
* @param id The ID of the Trophy.
* @param title The title of the Trophy.
* @param description The description of the Trophy.
* @param difficulty The difficulty rank of the Trophy.
* @param image_url The link of the image that represents the Trophy.
* @param achieved Whether this Trophy was achieved or not, it can be a string if it was (with info about how much time ago it was achieved) or bool if not (false).
*/
typedef FlxGameJoltTrophy =
{
id:Int,
title:String,
description:String,
difficulty:String,
image_url:String,
achieved:String
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply the same doc format I requested for FlxGameJoltScore

Comment on lines 3 to 33
/**
* The way the user data is fetched from the GameJolt API.
*
* @param id The ID of the User.
* @param type The cathegory the User is cataloged like in GameJolt.
* @param username The username of the User. (Also available for guests).
* @param avatar_url The link of the avatar of the User.
* @param signed_up A short description about how long the User have been in GameJolt.
* @param signed_up_timestamp A long time stamp (in seconds) of when the User signed up.
* @param last_logged_in A short description about the last time the User was found active in GameJolt.
* @param last_logged_in_timestamp A long time stamp (in seconds) of the last time the User logged in GameJolt.
* @param status The actual status of the User.
* @param developer_name The display name of the User. (Also available for guests).
* @param developer_website The website of the User.
* @param developer_description The description of the User.
*/
typedef FlxGameJoltUser =
{
id:Int,
type:String,
username:String,
avatar_url:String,
signed_up:String,
signed_up_timestamp:Int,
last_logged_in:String,
last_logged_in_timestamp:Int,
status:String,
developer_name:String,
developer_website:String,
developer_description:String
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply the same doc format I requested for FlxGameJoltScore

@GamerPablito
Copy link
Author

Ok, here you go, I fixed descriptions and other stuff as well, I hope this time the changes will suffice your expectations

@GamerPablito GamerPablito requested a review from Geokureli May 17, 2025 10:59
@GamerPablito
Copy link
Author

GamerPablito commented May 21, 2025

I guess nothing else needs to be added at this point.

@Geokureli
Copy link
Member

Geokureli commented May 21, 2025

You still never did this:
Screenshot 2025-05-21 at 11 00 28 AM

Which I reiterated several times: including here:
Screenshot 2025-05-21 at 11 02 00 AM

and as i said before:
Screenshot 2025-05-21 at 11 00 58 AM

@GamerPablito
Copy link
Author

Ok, what do you think about this change?

@GamerPablito
Copy link
Author

I'm currently trying to update the FlxPongApi thing at this time.
I'll let you know when changes are done!

@GamerPablito
Copy link
Author

@Geokureli check the changes pls

@Geokureli
Copy link
Member

Geokureli commented May 27, 2025

I keep requesting the same changes, I feel like you're just not fully reading what I've said, I can go in and make these changes myself when I have time, but please reread what I've said numerous times

@GamerPablito
Copy link
Author

I've corrected the spacing in descriptions, I've set them up like you said they have to be, idk what else am I missing, I did everything you told me so far to do. Maybe try to be more specific?

@Geokureli
Copy link
Member

Geokureli commented May 29, 2025

I don't know how to be any clearer than this:

never put a tab character unless it's to indent a line

and

Note: 3 spaces after @param, all param names have spaces so the descriptions start on the same column, 2 spaces after @return

In all of the places I said to use spaces rather than tabs, you have used tabs. I even gave an example

I also mentioned that this will not be merged until I can test it in an updated FlxPongApi demo

Are ya happy now?
@GamerPablito
Copy link
Author

Ok, I've removed the tabs and replace them by spaces as you said.
Is that it?

Copy link
Member

@Geokureli Geokureli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various doc changes

@Geokureli Geokureli dismissed their stale review June 2, 2025 15:04

applied changes

@Geokureli
Copy link
Member

I'll try to get to this, soon, but I'm kinda swamped right now

@GamerPablito
Copy link
Author

It's ok, thanks for correcting my descriptions btw.
Hope you get to test FlxPongAPI pull request soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FlxGameJolt is using an outdated version of the gamejolt api
2 participants