WebDev

SMF Arcade => SMF Arcade Support + Plugins => Topic started by: Chen Zhen on November 01, 2020, 06:49:30 PM

Title: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Chen Zhen on November 01, 2020, 06:49:30 PM
SMF Arcade 2.6.3 is now available in the download section.

The download link is here:
https://web-develop.ca/index.php?action=downloads;area=stable_smf_arcade

The changelog can be seen here:
https://web-develop.ca/index.php?page=arcade_changelog


Thanks to all that help contribute by beta testing, reporting issues/errors in the forum and for giving suggestions regarding its development.

We hope you & your users will enjoy the updated SMF gaming platform.

Please report any bug reports or issues in this section of the forum.
Title: Re: SMF Arcade 2.6.2 - Stable Has Been Released!
Post by: Phantom_Hugger on November 02, 2020, 01:47:33 AM
Thanks for the post Chen.
I have it installed for the first time on my forums.
When installing game packs, is it pretty simple to do?
Is it a package?
Sorry, I'm new here  ;D
Any help will be appreciated.
Thank you in advanced. :)
Title: Re: SMF Arcade 2.6.2 - Stable Has Been Released!
Post by: Chen Zhen on November 02, 2020, 12:04:03 PM
The game packs in the download section are mostly the old flash games.

This site has some HTML5 games and there is a list available in this board where the sites listed have thousands available.

You download them individually but can upload multiples by using ctrl and browsing a path on your pc/mac where you downloaded them to.
Title: Re: SMF Arcade 2.6.2 - Stable Has Been Released!
Post by: Chen Zhen on November 02, 2020, 12:05:35 PM
Make sure to enable the HTML5 upload in your arcade admin settings
Title: Re: SMF Arcade 2.6.2 - Stable Has Been Released!
Post by: Phantom_Hugger on November 02, 2020, 05:53:36 PM
Thank you so much @Chen  ;D I really appreciate it.
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Chen Zhen on November 02, 2020, 08:44:28 PM

Please note that a post release update was released today that deals with a database query issue for the retro games list.
This release has only 1 bug fix.

Everyone is advised to update to SMF Arcade v2.6.3.
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Diego on November 03, 2020, 12:13:12 AM
Any chance I can get $save into integrate_arcade_score

I wanna see if the user got a new record or he's the new champ
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Diego on November 03, 2020, 01:34:12 AM
Can't edit my post.
I found a lil bug

// IBPArcade v2.x.x Games support
elseif (isset($_REQUEST['act']) && strtolower($_REQUEST['act']) == 'arcade')
{
$_REQUEST['action'] = 'arcade';

if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'newscore')
$_REQUEST['sa'] = 'ibpsubmit2';

require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}
// IBPArcade v3.x.x Games support
elseif (isset($_REQUEST['autocom']) && $_REQUEST['autocom'] == 'arcade')
{
$_REQUEST['action'] = 'arcade';
// patch for HTML52-v3
if (isset($_POST['gname']) && isset($_POST['gscore']) && !empty($_SESSION['game_data_backup']) && !empty($_SESSION['game_data_backup'][$_POST['gname']]) && substr($_SESSION['game_data_backup'][$_POST['gname']]['submit_system'], 0, 5) == 'html5')
{
list($_REQUEST['sa'], $_REQUEST['do'], $_REQUEST['act'], $_POST['score'], $_POST['game'], $_POST['game_name'], $_POST['time'], $_POST['gamesessid'], $_POST['autocom']) = array('ibpsubmit2', 'newscore', 'Arcade', $_POST['gscore'], $_SESSION['game_data_backup'][$_POST['gname']]['id'], $_SESSION['game_data_backup'][$_POST['gname']]['internal_name'], time(), $_SESSION['arcade_html5_token'][1], '');
require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}

if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'savescore')
$_REQUEST['sa'] = 'ibpsubmit3';
elseif (isset($_REQUEST['do']) && $_REQUEST['do'] == 'verifyscore')
$_REQUEST['sa'] = 'ibpverify';

require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}
elseif (isset($_REQUEST['play']) && !isset($_REQUEST['game']))
{
$_REQUEST['game'] = $_REQUEST['play'];
unset($_REQUEST['play']);
$_REQUEST['sa'] = 'play';

require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}
elseif (isset($_REQUEST['highscore']) && !isset($_REQUEST['game']))
{
$_REQUEST['game'] = $_REQUEST['highscore'];
unset($_REQUEST['highscore']);
$_REQUEST['sa'] = 'highscore';

require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}
elseif ((isset($_REQUEST['game']) || isset($_REQUEST['match'])) && !isset($_REQUEST['action']))
{
require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}


Well for starters I think this can be done via hooks, not sure how but you can check Light Portal mod for reference is the only mod I remember that uses that hook.

And secondly, for things like this
isset($_REQUEST['play']) && !isset($_REQUEST['game'])You should also check that the user is also inside action=arcade, otherwise it might bust another mod using play, game, highscore, etc in the url too
Unfortunately it happened to me in my mod an I was quite confused  ;D
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Chen Zhen on November 03, 2020, 05:47:46 PM
Quote from: Diego on November 03, 2020, 12:13:12 AMAny chance I can get $save into integrate_arcade_score

I wanna see if the user got a new record or he's the new champ

If I understand you correctly, that hook already gives the necessary data alongside of some SMF defaults.
On your local test forum try dumping the data from the arrays to see what info is available.
$_SESSION['arcade']['highscore']['position'] is used to house the person's placement.
The $_SESSION['arcade']['highscore'] array has other data available.. you can dump that to see what it has as well.

Here is an example:
function myhook_arcade_score($game, $member, $score)
{
 global $user_info, $txt;

 $name = !empty($user_info['name']) ? $user_info['name'] : $user_info['username'];
 $gameName = !empty($game['name']) ? $game['name'] : '';
 $gameScore = !empty($score['score']) ? $score['score'] : 0;
 if (!empty($gameScore) && !empty($gameName))
 {
 if ((int)$_SESSION['arcade']['highscore']['position'] == 1)
 {
 $message = sprintf('%s is the new champ of %s with a score of %s.', $name, $gameName, round($gameScore, 2));
 echo $message;
 }
 else
 {
 $message = sprintf('%s scored %s on %s.', $name, round($gameScore, 2), $gameName);
 echo $message;
 }
 }
}



With regards to your request for using a hook in the index file, I will have to peruse the latest versions of SMF to see if it's possible.

QuoteYou should also check that the user is also inside action=arcade, otherwise it might bust another mod using play, game, highscore, etc in the url too
Unfortunately it happened to me in my mod an I was quite confused  ;D

I will look into what you mentioned there as it may be something I should have foresaw but overlooked.
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Diego on November 03, 2020, 10:13:16 PM
Thanks, I didn't see any reference to $_SESSION, will look into it.
Is there any game available for simple tests like this one? Or which ones are you using mainly for testing the arcade?
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Chen Zhen on November 03, 2020, 10:39:43 PM
I will put a reference to the session variable on the arcade info page.

To test your score hook all you need to do is find a game that allows you to save a score quickly.

Take downhill ski from the arcade as an example.. start the game, avoid one obstacle to show a point and then purposely crash into something. There are other games that may be even quicker to save a score for testing.
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Diego on November 04, 2020, 10:55:24 AM
Thanks.
I found another thing.
remove_integration_function('integrate_load_theme', 'Arcade_whos_online');
This has the correct function name but the wrong hook name :P
Title: Re: SMF Arcade 2.6.3 - Stable Has Been Released!
Post by: Chen Zhen on November 04, 2020, 02:58:46 PM

Yes you're correct that last one needs to be fixed.

Regarding your post about the hook..

The action of arcade can be added to the hook but the other conditional statements are for specific game save types.
Those can not be added to the action hook because of this preceding condition & its resolve in SMF:
elseif (empty($_REQUEST['action']))

I likely didn't bother with the action hook in the past because of having to edit the file anyhow due to the save types.
SMF 2.0 does not have a hook prior to that in the index however SMF 2.1 does have one dubbed integrate_pre_log_stats.

I can't remember if I attempted to use that hook in the past and did not get the desired results because of it returning to the index file. It may also be a recently added hook but I'm not sure because at the moment I do not have the inclination to search GitHub for when it was added.
However I will test it to see if the save type conditions have the desired result for popup/full screen, mobile & the game container.
SMF 2.0 will still need the first 3 conditions.. the devs are not adding any more hooks to that branch.

Thanks for all the reports, keep them coming!
EhPortal 1.39.6 © 2024, WebDev