Jump to content

PixiJS mobile game with distance counter (km) ?


Recommended Posts

Hi everyone,

I hope you're all doing great ! I am currently learning code in order to create my own mobile game. I know how much times and investment this kind of projet will ask me. However, I am determine as never. 😃

Actually, I am looking for the best solution / tool to dev a mobile game 2D in order start learning how it works. PixiJS looks great !

However, my game will need a distance counter (km otherwise steps) feature. -> Is it easy to get this kind of feature with PixiJS ? Through an API i guesss ?

To be more explicit, the "user story" of this feature would be :
- as a gamer,
- I need that my mobile game counts the distance i made (by walking or running) in real life,
- in order to avance in the story of my game.

Exemple : the gamer has to walk 3 km to get access to a new part of the story that his hero is following. 

Thanks in advance for your inlights about this subject ! 

NHD

Link to post
Share on other sites

Pixi aside, I think this task splits into a few questions:

  1. Can we use JS to measure "steps"
  2. Can we run JS run when the screen is locked / device is in pocket / player is walking
  3. Should we do this with pure JS?

"1" is certainly "yes", and there is existing code to do this by measuring the rhythm of motionevents over time (http://sebastien.menigot.free.fr/pedometer_explanations.html).  "2" is a limited "yes" for a period of time after the screen is locked, by using service worker hacks or audio events.  "3" is almost definately "no" - because there are better approaches, and imagine what any website could do while in your pocket if such processing was viable!

Some alternatives directions:

Test out the Cordova pedometer plugin (https://github.com/leecrossley/cordova-plugin-pedometer), does it work for your user base?  If so that's probably a good start?

Targetting wearables specifically.  For example making a web app for Tizen / Samsung Watch that links directly to the pedometer sensor?  Other vendors may have similar?

Connecting to other web APIs that are already measuring the user's distance.  For example Google's geo.

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...