Connecting players' local games together - javascript

I'm looking for a special answer that i can't find anywhere and i need your help/ideas:
The situaton:
I'm making a mobile web-game that is played on mobile phones. Every player has its own version and profile with levels etc. It is a roulette game so i want if a player gets a card it gets xp and the other players need to get xp as well. But as of now there is no way of syncing game data from one player to other players.
All roulette cards are stored in one big array and if a card is turned the script chooses a random one from the stack.
I was self thinking of some kind of code that everyone enters at the start of the game, and it contains the numbers of idk 20 cards in the array and so the game of all players will show the same card if they click next. But i dont know how to decode this and it is a bit irritating to enter such big code everytime you want to play.
P.s. i do not want to use a third party library or nodejs or something like that. Just javascript.
The "app/game" is hosted on a website that every player loads on their own phone. And game save data is stored in localstorage.
Can you please help? I dont have code to show. That is not relevant here.

I fixed it.
I used QR Codes instead. One qr code generator for the host and a qr code reader for the other players.
Search google for qr code reader js and you'll find it
thnx!

Related

Socket.io switch between game states

I'm making a multiplayer game in Node.js using Socket.js. Between the games I want users to be able to place their bets before a counter is ticking down. After that an incrementing number should pop up on the screen which eventually stops and then the counter and period to place bets comes back. I'm struggling to find anything on how to documentation or help on how to do something like this, where you are switching states/periods in a game.

create personalised videos based on user values

I'll do my best to explain my question clearly so apologies if it isn't crystal clear.
What I want to know (if it's possible) is how you would create a generic video, and somehow pass variables into some form of method, that would turn the video into a personalized video for the user based on their details. A good example of this is the Facebook videos that pop up every now and again saying "Hey, you've been friends with this person for x number of years! here's a video!" then the video is maybe 30 seconds of details about the friendship.
I can't imagine Facebook manually create those videos for billions of users, and that is my question, How is this done?
I'm looking at building an android app and potentially IOS as well.
Any help or pointers in the right direction would be greatly appreciated!
Thanks in advance
Facebook knows who your friends are and has access to both timelines and may look for tags or optical recognition to collect together a bunch of photos.
You can then put together process like a slideshow with variable text holders, the kind of thing you can find as an after effects template that will then output a video. There are a number of services who will do this for you too.
https://spark.adobe.com/make/slideshow-maker/
Animoto is another. If you look more in this direction I am sure you will be able to learn more about how it's done or find a third party who will do it for you.
You may find this the answer you are looking for: Javascript - Adding Full Screen Video to Image Slideshow

Live website to video

I have a website which shows a slideshow of pictures using JS.
The pictures objects are coming from a web service and are being updated from time to time.
In few days, I doing a test with a potential client to present the pictures slideshow on his big LED screen.
He's using BSPlayer for the content on screen, an able to present a website, but it will never be a clean full screen (the X button and such will always be presents).
He's the most comfort with presenting a video rather than a website.
One of my ideas of solutions was to check if there is a way to stream a content of a website.
Googling it got me to a solution combined ImageMagic and FFMPEG which you can read about here
My problem is that this solution only creates a slide show out of static pictures - which I can do, but i'm losing the dynamic part of my live slideshow.
Is there a tool for capturing websites and converting them into a stream of videos?
Or maybe a workaround to achieve the same functionality ?

creating a blackjack game using javascript, html and css only

I am coding a mobile app using PhoneGap, and I am only using HTML and JavaScript. so far, i have made all of the betting functions, such as starting an initial bet, buttons to increase or decrease the bet, and the functions that are called when the player wins, loses, or gets blackjack. My problem is with the deck.
It might be helpful to know what I called my functions, I don't know, but here they are anyway:
function win() adds the value in the bet to the total money.
function lose() subtracts the value that was bet from the total money.
function blackjack() adds one and a half times the value bet to the total money, and I used the Math.floor() on that one.
So with that in mind, I have two questions.
I want to have a deck that is just like a physical deck. I might be a little picky, but i want it so that if a card is shown, it will not be called again until all 52 cards are used, or the deck is shuffled. The cards can come out at random, i don't care as long as the cards are not repeated. also, how would you separate the piles that are dealt?
For example, one pile is the user, the other is the dealer. i kinda think this is needed because we will use the card values to add and decide who has won.
This next part is not required, but would be nice.
Would there be a way that I could add an image to the card that is chosen, so that the player can visually see the card that is drawn?
Using JavaScript, html and css __ONLY__, could I save a value to the apps internal memory or something? What I'm trying to achieve is that when, the player closes the app, the amount of money that is their "winnings" will be saved, and shown the next time they open the app.
I also have one more question, but this one is not part of the app.
Do anyone know how old you have to be to sign up for a Google developer account? I want to publish my app when I finish, but I'm only 17 and I don't know if I'm allowed to create a Google developer account to post my app on Google play because of my age.
To store some data in the client side, you can use the localStorage in a web browser, maybe it is not the best method to work in Android, but ut works.
localStorage.setItem("key", "value");
localStorage.getItem("key");
there you can store info

Replicate car engine sound in html audio javascript

For a few duys i started working on a small js based browser racing game.
I dont have too much experience in javascript but i learn fast. The game is based on php and a little js for the animation. Also trying to implement node.js to make it realtime.
The game works but want to add sound so it would be more interesting... but i came across a little problem, gapless sound looping. Tryied several methods and frameworks but no results, only in chrome with some but thats not enough.
Please give some ideas/solutions/examples of how would you do it. Thanks in advance.
I managed to make a reasonable engine sound by recording a real engine in 250 RPM increments, then created the additional very high RPM wav files by pitch shifting and increasing the volume. I then mix between these continually playing wav files using multiple HTML5 web audio gainNodes.
The pitch-shift is still noticable, but not to bad. If you want perfect sound you would will need to add additional wav files that start at one pitch and shift gradually to another, then logic to fade these in/out appropriately.
Looping the audio is done by having two wav files that overlap slightly and fade between them through the overlap, so you don't hear a click. Or alternatively create one long wav file beforehand using this technique so the clicks are infrequent.

Categories

Resources