JavaScript Based Image Input & Keyboard Output - javascript

this is my first post!
I am working on a project with AI for a game. I am trying to recreate Tetris with Javascript, HTML, and CSS to train an AI to play. After making the game, I would then need to incorporate the AI into it. After it is trained, I want to test the AI against other, real-time players to see how good it is. This is similar to what Code Bullet did, I have attached that video. My question is, is there any way to have my AI play on a website against other players? I think this would be possible if I could somehow get input from the site it is playing on, sending it to the AI, and receiving output in the form of simulated presses from the AI. I know this is possible with Python, but I am unfamiliar with that language. If you could help me, that would be much appreciated.
Thank you!
Code Bullet's video
P.S. Since this is my first post, please let me know if I am doing something wrong/missing something in my post. Thank you again!

Related

Javascript Rectangle inside webcam stream

I am very sorry for the UI of the question, I do not know why images
are so huge. Please accept my apologies.
I am doing a QrCodeScanner with browser's getUserMedia and up to now have got this.
Please do not pay attention to buttons [SCAN QR, STOP QR], the camera is between them.
What I want is something like this
Does anyone know what the way of doing it is?

Stop playing sound before going on to next function

I was tasked to create a simple mini game based solely on Javascript. I encountered a problem as I was adding in sound effects..
After the player drowns, the game should 'return' to its initial frame with one 'live' count decreased. During the drowning action, it plummets down the lake while the sound effect comes into place. However, the sound is activated a few .seconds late and the player freezes at the bottom of the lake. The game does not return either.
I have also tried adding stop() but it doesn't work. Here's a fragment of the relevant code.
gameCharacter_y +=2;
drownSound.play();
return;
Been stuck for days now and am an absolute beginner, would appreciate and be grateful for any suggestions!
Thanks.
In order to manipulate sound you should have a soundmanager...
This makes it really easy to see what clips are playing and pause them and do with them as you please! I'm not sure how to make one in JavaScript...
But what you are looking for is...
drownSound.pause();
There is no 'stop()' method apparently...

When making an interactive fiction game in javascript and HTML, should I make one big file or multiple smaller ones?

Making an account here since I'm relatively new to programming. I'm currently making an interactive fiction game with javascript and HTML just as an exploration of how to do things with the languages (I know it's ambitious for a beginner, but I'm not asking for help with that part.)
My current question here is essentially just the title. I currently have everything in one .html file, which is getting larger as I go. Superficial googling tells me that having one file at the time is good for the end user but doesn't matter otherwise, but I'll be compiling it with Electron once I'm done so I wasn't sure if that would effect anything.
I know how to do it, I'm just not sure if I should, and what the pros/cons would be either way.
Thank you for any help!

Creating MMO using canvas

So I will be using javacript and HTML to create a game in canvas in my planning stage however I started to wonder how I was gonna handle multiple users editing and playing on the same "canvas" per say
So to describe my issue I wanna tell you a little about the game
When I was 7(now 18) I played this amazing game called "Pocket Empires" it brought Teamwork to a whole new playing field it had everything you see in the modern day "Clash of Clans" but while in battle if you were struggling your alliance members could jump in the battle and save you
It was truly a remarkable game I encourage everyone to look it up
This game however was android only and fell through the cracks in 2013 and I have looked for a game clone since but have found nothing truly like it since so now I am going to create it myself
The main thing about the game I am concerned with is displaying the same thing across all screens for example
Player 1 places a building
Player 2 should see that on his screen
or
Player 1 is attacking some goblins
Player 2(if in the same alliance) should see player 1 attacking and should be able to join in
I have done a lot of research over the years I have a web development certificate in both HTML and CSS(as if that actually mattered) Afterwards I spent another 2 years learning Javacript and PHP
Now I know php will not be of use without ajax which I want to avoid at all cost so thats all the information I believe I can provide now I leave it to y'all to lead me in the right direction
You can use web sockets to :
send the action of the user to the server
get the actions of others player and to show what needs to

How do I create an object such as a wall in javascript?

I am programming a game in JavaScript, the game involves player one controlling an image of a head around the screen by using the arrows on the keyboard. The aim is to get as much burgers shown on the screen. Once you get it, it will randomly appear somewhere else on the screen. My first problem is how do i create an obstacle such as a wall in JavaScript? my second problem is how do i create a rule that result's in game over if the obstacle is touched?
It is easy to solve by using box2D, and I use the framework which integrates box2D.
this is the example link I did 2 mins ago:game link
if you don't know how to use it,my facebook messenger is Alan Nie

Categories