Posted: 10th May 2021 18:35
Hello everybody!!

Here on the forum I learned that can export a project to HTML5 and then convert it via UWP and run on Xbox. I don't quite understand what's going on with HTML5 in the UWP, so maybe the questions do not sound right.

Three questions came up. Please tell me:

1. In HTML5 format, the speed of my browser game drops dramatically. When converting HTML5 via UWP and launching the game on Xbox, the game speed will be the same as HTML5 in the browser or will it grow ?

2. In HTML5 format in the browser, the commands for saving to the results file do not work. When converting HTML5 via UWP and launching games on Xbox will it work
commands to save to a results file?

3. It will be good for playing on Xbox if the Xbox-gamepad is supported. How to poll Xbox-gamepad - are there such commands on AppGameKit Classic?
Posted: 10th May 2021 23:37
i know next to nothing about xbox but, if the browser is a "real" browser, the Load/SaveSharedVariable commands should work as cookies.

and, in case you run into similar issue where the cookies wouldn't save, see tboy's advice here which worked for me).
Posted: 11th Jun 2021 3:27
Here on the forum I learned that can export a project to HTML5 and then convert it via UWP and run on Xbox.

WOW

very interesting

I have been considering playing around with that UWP for Xbox, and if my HTML5 builds will work, then that is definitely on the to-do list. (now I need an Xbox 1, because my old 360 is not going to work)

"

I saw a mention of it crawling in DEBUG mode, but turning that off makes it go faster, so make sure you are not converting in debug mode.

"



EDIT
I just checked out those threads, and it seems to be a problem getting the controllers to work.

When I was setting some of my world records using MAME, I had hacked a USB keyboard with an old ATARI 2600 controller for the input device and it worked fine.

The thought here is if the keyboard inputs work, then there may be a crude work around for the controllers.

I do not have an Xbox One to play around with, but I am definitely going to be getting one to see what I can come up with. (probably will fail, but should be fun to try)

I guess I can play around with Windows 10 until I get the console.

EDIT 2

I discovered that if you plug in a usb keyboard into the Xbox One the AppGameKit keyboard commands work. So if you have keyboard controls in your game they should work fine on the Xbox One.


Yep , the USB keyboard hack should work fine.

I must have forgotten about that thread or somehow missed it. (didn't have an Xbox One though, so may have skipped it back then, but they are cheap used now, so...)
Posted: 11th Jun 2021 14:41
So.. I just installed Visual Studio 2019 with all the bells and whistles, but JAVASCRIPT for UWP does not seem to find any matches when following the instructions provided in the other threads????

DO I really need to use an old 2015 version to make this work????

EDIT

OKAY the 2015 download is for DVD only... most new computers do not have a disc drive!

However the 2017 version is a download (I only installed the Universal Windows package this time! less than 2 gigs vs the 8+gigs for the 2019), and it will let you create a JAVASCRIPT UWP project.
New Project >>> Blank App - Web Context (Universal Windows)

I still do not have the xbox yet, but if it will work on windows 10 using the UWP then it should work on Xbox.

... so I'll let you know how it goes if I can get things working.
Posted: 11th Jun 2021 16:11
BUMPITY BUMP BUMP BUMP

YES!!!!!!!!!!!

My test worked!!! (using Visual Studio 2017 (UWP package install)

Just follow the instructions provided in this thread...

https://forum.thegamecreators.com/thread/217231

The only exception was the drag and drop into the directory didn't work, but copy/paste does if you highlight the main directory for the app (at the top of the list) before you click paste.

Now I need to get an Xbox and get back to work on Gladiator Quest !!!! WOOOOHOOOO!

THANKS apocolyp4 !!!!


On a side note: this is a much better way (IMO) to test the HTML5 builds rather then emulating a server via XAMPP etc. which is how I used to test them.
Posted: 14th Jun 2021 16:07
OKAY ... EUREKA!

I have the Xbox Controllers detected in HTML5 Builds using the commands already available in AppGameKit .

I'll now begin to work on a simple app to demonstrate for those who have the Xbox One. (or later ...X/S )

The commands we have are fine... the main triggers are the Z and RZ

Buttons..

A = 1
B = 2
X = 3
Y = 4

Left Top Trigger = 5
Right top trigger = 6

Left Button = 7
Right Button = 8

9-12 = reserved?

Game Pad Left = 13
Game Pad Up = 14
Game Pad Right = 15
Game Pad Down = 16

Raw Joystick inputs for joysticks, and that Z index is for the main triggers (left and right)

It will give you an error that the JOYSTICK 0 does not exist at line whatever if you do not have the code wait, because it needs you to press a button to detect the controller as slot 1 (I only have one controller to test with but this one is working fine for the first index)

Here is all I had to add at the top of my code (prior to calling any GET RAW JOYSTICK.. commands to get it to work for HTML5 (the HTML likes the 'Z' input to be triggered for joystick detection )

+ Code Snippet
  


CompleteRawJoystickDetection() 

do
	if GetRawJoystickExists( 1 ) = 1 then exit
	Print ( " " )
	Print ( "   Joystick not detected...please press/hold the left trigger " )
	sync()
loop 



As you can see, I simply give the command to detect the joystick, then send it in a little loop to give it time to do its thing.

The loop just prints a message to say it is waiting , and prompts the user to trigger the input for the joystick to get detected.

Try it .. it works (tested running XAMPP virtual server locally, and converting the HTML5 build to UWP via VS 2017)

Just posting this here because some of the old threads mentioned the joysticks not being able to be detected in the HTML5 builds, but the old threads were locked, so...

... so cool how the trigger values (that Z axis) are floats for sensitivity!

Here is something you can test .... sloppy I know, but you should be able to get the idea.

+ Code Snippet
 


// Project: joystick_controls 
// Created: 2021-06-14

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "joystick_controls" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 90, 0 ) //90fps instead
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts


CompleteRawJoystickDetection() 

do
	if GetRawJoystickExists( 1 ) = 1 then exit
	Print ( " " )
	Print ( "   Joystick not detected...please press/hold the left trigger " )
	sync()
loop 




do


    Print( ScreenFPS() )
    Print(" ")
    Print( GetJoystickX() )				// Display Left Joystick Inputs
    Print( GetJoystickY() )
    Print( GetRawJoystickRX( 1 ) )		// Display Right Joystick Inputs
    Print( GetRawJoystickRY( 1 ) )
    Print(" ")
    Print( GetRawMouseX() )				// Display the Mouse location X and Y
    Print( GetRawMouseY() )
	Print(" ")
    Print(GetRawJoystickZ( 1 ) )		// Disply the Left Trigger Input - Axis Floats for sensitivity
	Print(GetRawJoystickRZ( 1 ) )		// Disply the Right Trigger Input
    Print(" ")
    Print( GetLastChar() )				// Disply the last keyboard character pressed
    Print(" ")

    IF GetRawMouseLeftPressed()
		z = 666
	elseif GetRawMouseRightPressed()
		z = 999
	endif
   
    
    for r = 1 to 64
		if GetRawJoystickButtonPressed( 1, r )
			z=r
		endif
	next r
  			Print(" ")
			Print(  z  ) 				// Display Value of Last Joystick Button Pressed

     
    Sync()
loop





.., build that as HTML5 and test your Xbox controller. (have fun)
Posted: 15th Jun 2021 16:06
SO, I went out and bought a new XBOX controller..... works for X/S and Xbox One.

Tested it on the html5 build, and it detected it fine.

The only issue is that it is an enhanced controller with extra buttons, and those do not show up as regular joystick button inputs.

However, all of the other normal controls (The Xbox One buttons) are being recognized and worked fine.

So, the old threads must have been before an update that addressed the HTML Joystick Controller issues.

I still don't have an Xbox One to test, but if the HTML5 builds that get converted to UWP via VS 2017 do not work right on Xbox One consoles, then the issue is with the Xbox, because they run fine on Windows 10 with the UWP.

If this has been working fine all this time, then I am wondering why there are not a bunch of Xbox releases in the showcase.

As one person mentioned, an HTML game on an Xbox is like having a Ferrari pulling a lawn mower trailer, but games like 'Gems of War' and other casual games rated 'E' seem to be doing well with 2d graphics.

The user base of the Xbox is huge, and I for one am going to play there. (once I have something posted (probably slots or something simple) then I will be sure to post it in the showcase.

Maybe I am just behind the times on this one, but I thought I would share my discoveries in case others are as confused about the Xbox compatibility as I was.


EDIT


So, all in good fun... I went ahead and mixed and matched the new Xbox One X/S controller and the old Xbox360 controller, and they work fine together on Windows 10 (UWP) converted from AppGameKit HTML5 builds.

Have fun, I know I am...

+ Code Snippet
// Project: joystick_controls 
// Created: 2021-06-14

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "joystick_controls" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 90, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts


CompleteRawJoystickDetection() 

do
	if GetRawJoystickExists( 1 ) = 1 then exit
	Print ( " " )
	Print ( "  Xbox Controller for PLAYER 1 was NOT DETECTED...please press/hold the left trigger " )
sync()
loop 



do
	if GetRawJoystickExists( 2 ) = 1 then exit
	Print ( " " )
	Print ( "  Xbox Controller for PLAYER 2 was NOT DETECTED...please press/hold the left trigger " )
	sync()
loop 


do


    Print( ScreenFPS() )
    Print(" ")
    Print( GetRawJoystickX( 1 ) )		// Display Left Joystick 1 Inputs
    Print( GetRawJoystickY( 1 ) )
    Print( GetRawJoystickRX( 1 ) )		// Display Right Joystick 1 Inputs
    Print( GetRawJoystickRY( 1 ) )
    Print(GetRawJoystickZ( 1 ) )		// Disply the Left Trigger Input - Axis Floats for sensitivity
	Print(GetRawJoystickRZ( 1 ) )		// Disply the Right Trigger Input
    Print(" ")
    Print(" ")
    Print( GetRawJoystickX( 2 ) )		// Display Left Joystick 2 Inputs
    Print( GetRawJoystickY( 2 ) )
    Print( GetRawJoystickRX( 2 ) )		// Display Right Joystick 2 Inputs
    Print( GetRawJoystickRY( 2 ) )
    Print(GetRawJoystickZ( 2 ) )		// Disply the Left Trigger Input - Axis Floats for sensitivity
	Print(GetRawJoystickRZ( 2 ) )		// Disply the Right Trigger Input
	Print(" ")
			
    
    for r = 1 to 64
		if GetRawJoystickButtonPressed( 1, r )
			z=r
		endif
		if GetRawJoystickButtonPressed( 2, r )
			zz=r
		endif
	next r
	
	Print(  z  ) 				// Display Value of Last Joystick 1 Button Pressed
	Print(" ")
	Print(  zz  ) 				// Display Value of Last Joystick 2 Button Pressed

     
    Sync()
loop



It seems like they will both be detected simultaneously, if already plugged in, once that trigger is held a couple seconds.

So.... I unplugged the second one, just to make sure I was not bypassing the Joystick 2 check, and it prompted me... then as soon as I plugged it in, it recognized it on its own.

It seems that the entire index is dependent on the first one being recognized, so if you have a RockBand or other 'dongle' in the Controller 1 slot on the Xbox, then it could be an problem. (untested)

Anyway, I am glad I have been playing around with the HTL5 builds recently, because that is going to pay off on some split screen action. (been dreaming about a Xenophobe type split screen)

Finally can have some multiplayer fun on a leading cutting edge console.... Happy days! (yeah yeah other fancy engines that require teams, but for simple indies like me this really shines!)


EDIT

Well, is seems that the Microsoft Store Policies are really 'E' rated and not for anything with adult content, or any kind of violence.

So, Casino is out... gambling.
All Shooters are out ...violence.

Puzzle games and Driving Games (off road) seem to be about it... bummer dudes.