greggman / happyfuntimes Goto Github PK
View Code? Open in Web Editor NEWA System for creating 10-100+ player local games
Home Page: http://greggman.github.io/HappyFunTimes
License: BSD 3-Clause "New" or "Revised" License
A System for creating 10-100+ player local games
Home Page: http://greggman.github.io/HappyFunTimes
License: BSD 3-Clause "New" or "Revised" License
Since iOS and Android does not allow to use the sensor data per default the orientation controller does not. I assume that the code should be enhanced by something like this;
DeviceOrientationEvent.requestPermission()
.then(response => {
if (response == 'granted') {
window.addEventListener('deviceorientation', (e) => {
// do something with e
})
}
})
.catch(console.error)
But the other buttons work well. What could be the possible reason?
The link:
https://github.com/greggman/HappyFunTimes/blob/master/docs/linux.md
does not work from the page:
http://superhappyfuntimes.net/install
I'm sure this used to work. Is there an alternative?
It's not working on XP. It gets the following error
C:\Documents and Settings\gregg>hft list
path.js:8
throw new TypeError('Path must be a string. Received ' +
^
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.win32.join (path.js:221:5)
at getConfigPath (C:\Documents and Settings\gregg\Local Settings\Application
Data\Greggman\HappyFunTimes\lib\config.js:57:15)
at Object.<anonymous> (C:\Documents and Settings\gregg\Local Settings\Applic
ation Data\Greggman\HappyFunTimes\lib\config.js:61:15)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
I understand this isn't yet supported yet, but I would like to help work on it. Are there any limitations you foresee? Any hints that could point me in the right direction would be awesome!
Hi,
I would like to know if there is a way to change the appearance of the "Looking for HappyFunTimes" dialog (it appears when the app is turned off and the user tries to reconnect to happyfuntimes.net). It seems that the css and javascript behind this particular html is generated at runtime.
Many thanks for considering my request =)
Hi,
It seems that when the ComputerName is not set in Mac OS, the library fails in an unexpected way because scutil does not return a result. Please see this stackoverflow question:
Perhaps the code should throw if a err
has a value?
Hi, I've been working on a project and updated unity to the newest release and now HappyFunTimes doesn't work. It returns the following error. Any suggestions on how to fix it?
UriFormatException: Invalid URI: Invalid port specified.
UnityEngineInternal.WebRequestUtils.MakeInitialUrl (System.String targetUrl, System.String localUrl) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/WebRequestUtils.cs:540)
UnityEngine.Networking.UnityWebRequest.set_url (System.String value) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs:400)
UnityEngine.Networking.UnityWebRequest..ctor (System.String url, System.String method) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs:176)
HappyFunTimes.HFTSite+Informer+d__15.MoveNext () (at Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTSite.cs:89)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
HappyFunTimes.Informer:Inform(Boolean, MonoBehaviour, Byte[], String) (at Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTSite.cs:72)
HappyFunTimes.d__8:MoveNext() (at Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTSite.cs:240)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
I was wondering if it was possible to recreate the functionality of your HappyFunTimes Redirector? I basically want to keep that branded in line with the game.
Is there any info you could give on this?
I built a game with HappyFunTimes using unity and I don't know how to run a build? Works fine in the Unity editor, though.
I get the following when I point my controller to "happyfuntimes.net"
TypeError: Cannot read property 'originalGameId' of undefined
at handleHappyFunTimesPingRequest ...
If I go straight to the ip address nothing happens just stays at "Waiting for game ..."
It's a OSX Build, btw.
Thanks. :)
I tried to use happyfuntimes on new computer, but can unfortunately not connect to happyfuntimes.
I get the error messages:
ERROR: parsing C:\Users\ Johanna Jacob\Documents\Game Jam\HappyFunTime_2\Assets\WebplayerTemplates\HappyFunTimes\package.json
ERROR: Reading C:\Users\ Johanna Jacob\Documents\Game Jam\HappyFunTime_2\Assets\WebplayerTemplates\HappyFunTimes\package.json
Type Error: Cannot read property 'gamesDir' of undefined
Any idea what can I do there?
Here's the error I get in chrome's console
Uncaught TypeError: audioManager.loadSounds is not a function
at r.handleLoadSounds (controller.js:209)
at r.<anonymous> (hft-min.js:1)
at r.g (hft-min.js:1)
at WebSocket.t.onmessage (hft-min.js:1)
Using Unity 5.6.1.
Trying to follow the instructions in unitydocs.md.
At step 3, "Standard Assets" is not one of the available options in Unity 4.3.4f1.
After steps 4-7 my unity project has this folder structure:
/Assets/Plugins/websocket-sharp.dll
/Assets/Plugins/HappyFunTimes/ClientMessageArgs.cs
/Assets/Plugins/HappyFunTimes/EventProcessor.cs
/Assets/Plugins/HappyFunTimes/GameServer.cs
/Assets/Plugins/HappyFunTimes/MessageCmd.cs
/Assets/Plugins/HappyFunTimes/NetPlayer.cs
/Assets/Plugins/HappyFunTimes/PlayerConnectMessageArgs.cs
/Assets/Plugins/HappyFunTimes/PlayerDisconnectMessageArgs.cs
/Assets/Plugins/HappyFunTimesExtra/CSSParse.cs
/Assets/Plugins/HappyFunTimesExtra/DeJson.cs
/Assets/Plugins/HappyFunTimesExtra/MiniJSON.cs
/Assets/Scripts/HappyFunTimes/DPadEmuJS.js
/Assets/Scripts/HappyFunTimes/Example3rdPersonController.js
/Assets/Scripts/HappyFunTimes/ExampleBasicMaterial.mat
/Assets/Scripts/HappyFunTimes/ExampleCharacterGameSettings.cs
/Assets/Scripts/HappyFunTimes/ExampleCharacterMultiPlayerCamera.js
/Assets/Scripts/HappyFunTimes/ExampleCharacterSpawner.js
/Assets/Scripts/HappyFunTimes/ExampleSimple.cs
/Assets/Scripts/HappyFunTimes/ExampleSimpleGameSettings.cs
/Assets/Scripts/HappyFunTimes/ExampleSimpleGoal.cs
/Assets/Scripts/HappyFunTimes/ExampleSimplePlayer.cs
/Assets/Scripts/HappyFunTimes/Prefabs/Prefab Example 3rd Person Controller.prefab
/Assets/Scripts/HappyFunTimes/Prefabs/PrefabForExampleSimple.prefab
/Assets/Scripts/HappyFunTimes/Scenes/HappyFunTimesCharacterExample.unity
/Assets/Scripts/HappyFunTimes/Scenes/HappyFunTimesSimpleExample.unity
At step 8, opening HappyFunTimesCharacterExample.unity reveals that the Main Camera and ExampleCharacterController game objects have missing scripts. In the inspector, each missing script has this error:
"The associated script cannot be loaded. Please fix any compile errors and assign a valid script."
There are no compile errors, but when trying to play the scene the warning "The referenced script on this Behavior is missing!" appears in the console for each missing script.
With the relay server running, the UnityCharacterExample link on http://localhost:8080/games.html points to http://localhost:8080/%(gameUrl)s which results in a 404 error.
Idea without having done research on it yet: I wonder if Chromecast would be able to act as the server and display.
In order for the browser to go fullscreen (currently Android only), access the mic (also Android only), use the camera for real time input (Android only), and even read the gyroscrope pages are required to be served as HTTPS
Unfortunately that's rather complicated. To use HTTPS requires Certificates. Certificates require domain names.
Lots of people have suggested solutions but they all seem to fail in some way
A solution needs to have zero user interaction IMO. Run the game, it just works. No login, no registration, no configuration
The solution I think would work is to run a free DNS server for happyfuntimes and get it listed on the Public Suffix List (or talk to letsencrypt for a special exemption).
The free DNS server would have an API that lets games generate a DNS server like this
<sha256ofgamename+internalip+externalip>.dyndns.happyfuntimes.net
That domain is would point to internal IP address of the game and the DNS server would have an API to support validating letsencrypt using TXT records.
The game (happyfuntimes library) would then have to contact happyfuntimes.net, ask for a domain name, it could then use that name to get a cert from letsencrypt. It would store that locally and if it's close to expiring try to get a new cert.
Some issues
This would only be a pain point for devs not users. Basically like many other services the dev has to register their game and get an API key used to talk to happyfuntimes.net. This allows knowing who owns what and or ban abusers?
Last time I asked I was told the fact that I was just trying to get more certs was bad. I'm not trying to get more certs though. I'm trying get let users get certs. Maybe they'd let me on. My only thinking there was if I separate the "get a domain" into a separate non-happyfuntimes service then it's more generic and more likely to be approved. Also useful for other projects.
I choose sha256-internalip-externalip-gamename
because it means the game knows what domain it will use without having to ask. But, since it has to at least contact happyfuntimes.net in some way maybe happyfuntimes.net should just make some random number and return the domain name in the result.
Similarly originally I was going to try to do something like externalip-internalip-gamename
(no sha256). The idea being that since the ip addresses are in the name the dynamic dns server doesn't have to store any data to resolve DNS. It just looks at the name and returns the number in the name. I forgot why I moved away from that ideas. I'd base32 the addresses which for ipv6 is 26 characters per address so internal + external is 52 leaving just 11 for some kind of id (since 2 or more games running on the same machine need their own certs).
Or maybe they don't need their own certs? I don't like the idea of games sharing data. Especially if the dynamic dns portion was unrelated to happyfuntimes and could be used for anything that needed an instant domain and a cert then it seems like the certs should not be shared.
I think the reason random names or whatever came up is the DNS server has to store the DNS-01 challenge stuff for each domain anyway. Since it has to store anything it might as well store more like the generated domain name.
Anyway, other ideas welcome - though please explain how it will require zero end-user interaction to both the person running the game and the people playing the game.
For instance, https://github.com/greggman/HappyFunTimes/search?q=superhappyfuntimes and various places on the website ( including, notably, the "What is this?" link on the happyfuntimes.net redirector)
When I download and want to play a HFT Unity game on Linux, then HFT wants to start "[name]-linux", instead of "[name]-linux.x86", saying "native game does not exist".
Also the executable flag must be set, otherwise the game cannot be started.
A workaround is renaming the executable and setting the executable flag manually, obviously.
When I load the 'platform' test scene, on latest Chrome on an Android phone, the A/B buttons are sticky and do not get reset until another button elsewhere on the pad is pressed (e.g. the d-pad).
On an ipad, the jump buttons are not sticky (they return to an unpressed state), but ~15-30% of inputs seem to be lost.
Interestingly, when I load the 'touch' test scene, both devices show smooth, generally non-laggy, loss-free tracking of the finger moves.
The server in these cases is the most recent HFT, running on OSX, with latest HFT plugin running in Unity 5.1.1f. If there's any other debugging info I could provide, happy to help.
I tried to ask a question on stackoverflow using the "happyfuntimes" tag. But since the tag seems not to be used yet, I can create no question with this tag. (You need a certain reputation to create an own tag for questions.)
My question is:
How can I modify the preset controller?
I am using the 2D sample project of happyfuntimes and would like to display the player's score directly on their phone.
Which script do I use to accomplish this? HFTGamepad.cs? controller.js? PhonePlayerScript?
Can I test the controller without connecting a phone to the game? E.g. by opening a browser?
I followed the docs on sending messages from the game to the phones and implemented the following code:
game.js
player.netPlayer.sendCmd('roundStart', data)
controller.js
function onRoundStart() {
//
}
var g_client = new GameClient();
g_client.addEventListener('roundStart', onRoundStart());
However, I get the following error in the console after the message arrived on the phone:
GameClient: unknown event: roundStart
Am I doing something wrong? I already tried other spellings like round-start
and roundstart
but none worked. Do I have to add custom events anywhere?
I believe I have everything set up correctly since I can see games i've added but whenever I try running Unity example the exe crashes and HFT crashes. both from localhost and from superhappyfuntime installs. The html games seem to work fine. any ideas what it might be?
Hello! I was just starting to work on a new game for HFT and I went to start up the app and I get this error. I have tried uninstalling (config files and all) and reinstalling. I am running Mac OS 10.9. I have run and developed for HFT until very recently. I have tried opening from the app icon and from terminal with the same result. Also I have started as root. I fear it is a node issue of some kind which is an area that I am a little unfamiliar with.
using ip address: 10.0.1.xx
WARNING!!!: EACCES: could NOT connect to port: 80
Listening on port(s): 18679, 8080
/Applications/HappyFunTimes.app/Contents/hft/lib/computername.js:38
computerName = res.stdout.split()[0];
^
TypeError: Cannot read property 'stdout' of undefined
at /Applications/HappyFunTimes.app/Contents/hft/lib/computername.js:38:23
at ChildProcess.<anonymous> (/Applications/HappyFunTimes.app/Contents/hft/lib/utils.js:67:7)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)
The fact that port 80 isn't opened hasn't mattered in the past. I assume that it can't get access to 80 because it isn't running in root. I don't think this is the issue.
Thanks in advance!
Hi there, I'm wondering how to run hft game without electron? I'm using cocos as client game engine but got this error:
:7456/build/src/project.js:1 WebSocket connection to 'ws://localhost:7456/' failed: Connection closed before receiving a handshake response
I'd like to know how to start websocket server if not using electron but a hosted web page?
I followed the instructions from http://docs.happyfuntimes.net/docs/linux.html
All seemed to work until I run the last step:
$ hft start --app-mode
ERROR: happyFunTimes does not appear to be installed.
Apparently it's looking for a config file in
$HOME/.happyfuntimes/config.json
but this directory does not exist, nor the file. Thus getHftInstallDir() in hft-config.js is throwing an exception and returning "undefined".
Probably the problem would be solved with one more step in the instructions for creating the missing directory + config file.
Browser controllers on the same machine as the game work.
Mobile phones in the same WiFi network don't ("Could not find HappyFunTimes").
Running the sample 2d platform scene gives this error.
UriFormatException: Invalid URI: Invalid port specified.
UnityEngineInternal.WebRequestUtils.MakeInitialUrl (System.String targetUrl, System.String localUrl) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/WebRequestUtils.cs:548)
UnityEngine.Networking.UnityWebRequest.set_url (System.String value) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs:400)
UnityEngine.Networking.UnityWebRequest..ctor (System.String url, System.String method) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs:176)
HappyFunTimes.HFTSite+Informer+d__15.MoveNext () (at Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTSite.cs:90)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
HappyFunTimes.Informer:Inform(Boolean, MonoBehaviour, Byte[], String) (at Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTSite.cs:72)
HappyFunTimes.d__8:MoveNext() (at Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTSite.cs:241)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
HappyFunTimes.HFTSite:Init(Options) (at Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTSite.cs:175)
HappyFunTimes.HFTManager:StartServer() (at Assets/HappyFunTimes/HappyFunTimesCore/HFTManager.cs:272)
HappyFunTimes.HFTManager:Start(HFTRuntimeOptions, GameObject) (at Assets/HappyFunTimes/HappyFunTimesCore/HFTManager.cs:57)
HappyFunTimes.HFTConnectionManager:StartHappyFunTimes() (at Assets/HappyFunTimes/HappyFunTimesCore/HFTConnectionManager.cs:54)
HappyFunTimes.PlayerSpawner:StartHappyFunTimes() (at Assets/HappyFunTimes/HappyFunTimesCore/PlayerSpawner.cs:104)
HappyFunTimes.PlayerSpawner:Start() (at Assets/HappyFunTimes/HappyFunTimesCore/PlayerSpawner.cs:172)
I'm running my game in Unity, with the Installation mode checked through Unity. I have a home router that I connect to, and this issue happens even when I connect on mobile, or directly go to localhost:18679 on the running computer's browser.
Whenever a player joins the game by going to the website, the screen will flash between the "Switching Game" blue screen, and the default brownish controller screen (which I'm using). As this happens, I get an error message and log message in Unity (attached). Sometimes it will redirect only 10 times, others might take longer - 50 or so. This only happens for the first player to connect, and the second player will connect instantly. My guess is that the game hasn't been set up in the first X seconds by then, and it's still trying get set up while the player is connecting.
HappyFunTimes informs happyfuntimes.net of a running server in Informer.InformCoroutine() by sending a www message with custom headers. In Unity 2017, trying to manually set a "Host" header will throw an exception: (InvalidOperationException: Cannot override system-specified headers).
Removing the host header will cause the exception to go away, but then the game never registers itself because the server is returning error 503 (probably because the host header is expected server-side).
Since the host header isn't getting set automatically client-side due to usage of a direct ip address, I added an Informer object that just used the happyfuntimes.net hostname, without converting that to a IPv4 or v6 address. This sets the host-header correctly, and so registers the game correctly and everything is happy and fun again.
Probably this might warrant a proper fix though, since I assume the direct IP conversion was done for a reason...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.