You're welcome! I'm glad to hear that you found the information useful and that it was new to you. It's true that web browsers have come a long way and can handle more and more advanced features. I think it's exciting to see how web-based apps are becoming more and more prevalent in the industry. Thanks for your comment!
My html file created by pygbag is full of errors. I could fix them. But, even the, the game doesn't work for me after the emerging banner Pygame. After that, it only appear a black box. Could be possible if anybody share a succesfull generated .html file?
am getting the following error: "WARNING: wasm mimetype unsupported on that system, trying to correct Not using SSL" could not find a solution anywhere
FAQ 1: All I get is a black screen after converting the game. Please load the game like this: localhost:8000/#debug This way you can see the error that prevents the game from loading. FAQ2: Can I use .mp3 files? Yes, but don't. Using .mp3 files is buggy. Convert your .mp3 sound to .ogg.
Not sure if you guys are still looking for a solution, but in order to fix the black screen you need to: 1. Make sure that all of the functions in your code that have infinite loops (while True for example) have the "async" keyword in front of them 2. Put "await asyncio.sleep(0)" at the end of each infinite loop 3. Put the "await" keyword on all asynchronous function calls
I have a programe to edit images. It use Tkinter for the GUI. And PIL library. In this case, PyBag don't include these libraries. What can I do to achieve a similar result? Pyscript neither do. Maybe use a remote server to run it would be the unique solution?
There are many things that can go wrong. First you could try the debug mode to see what's wrong using localhost:8000#debug instead of just localhost:8000 it will show you the REPL with any message/trace python could send.
Im trying to do this on a raspi over a LAN connection. Ive done this and it works on localhost however, id like to be able to display it on some page like you have in the end. Ive got apache on the pi to work, but how can i run the game this way? Does the python file need to be an APK? I cannot find anything online explaining how to do this
i successfully completed the instruction but as soon as i interact with my game, there seems to be a light blue overlay pver my game (similar to how it looks like when you select and image/ or text) how can i fix this?
What if my game has 3 main definitions, play, main menu and tutorial?? how do I include async with it ? When i try to do async def with tutorial function, I cant change to any of the other screens anymore.
It (as well as pyinstaller if I don’t put It into the directory layer above the rest of the game) seemingly can’t find the font I’m importing. Why do all compiling programs struggle with fonts so much?
It is showing black screen on me, anybody know the issue? I try with the snake example and also try on my game. the background music is played but the graphics, input, and sfx is not. just black screen
Great explanation, I manage to load the game in the browser, but only when the command prompt is open, after I close the command prompt and double click on the browser icon in the build, the browser fails to load the game
Yes, that's normal behavior. The command promt has created a game server to load the game. If you close the command prompt, the server is no longer active so the game won't load. If you upload the game to your own web server it will work fine, this issue happens only if you run the game locally.
I have installed pygbag but I'm still getting: C:\Users\aryam\Desktop>pygbag snake 'pygbag' is not recognized as an internal or external command, operable program or batch file. What do I do?
All I see on screen after the green loading bar is a black screen and I can hear audio. Also it’s not the whole screen just the game tab. How do I fix this
Hey, I tried doing this with my own flappy bird clone, For some reason pygbag kept showing black screens, only the background music loads, I've also tried using the debug tool that comes with pygbag but it only showed errors that didn't really make sense cause they worked in pygame. Do you have any idea how I could fix this? Thanks.
What is your music format? MP3 or something else? I had the same problem when using .mp3 files. When I converted them to .ogg everything works fine. Try it and tell me how it goes.
@@programmingwithnick Hey, I did fix it after all, Basically the sound files weren't converted properly to .ogg, hence why the game wouldn't boot. and I have also forgotten to add a await asyncio.sleep(0) after every while true loop.
Hey, I have installed pygbag, but when I run "pygbag [Folder]," I get an error message that says pygbag is not an executable internal or external exam.
Solved. It happened because I was calling the run async method by inside a __init__() function of a class. Do not do that. I create a class and than called its run method from out of the init function
Is there a way this can work on iPhones? When I try the link I get the screen with the green button that says “Ready to Start!” but it does nothing when I tap on it.
Yes, this happens if the game you have created requires a keyboard to work. Since there is no physical keyboard on the iphone this approach won't work. You have to modify your original code to include mouse controls or touch controls as well.
Hi, I had the same problem and then realized I put the await asyncio.sleep(0) at the end of the main() function and not inside the while loop... I hope this helps you out. Now I just need to figure out how to upload it to my website
Thank you Nick, that was new to me, it's amazing what todays web browsers can handle these days, soon all apps will be web based.
You're welcome! I'm glad to hear that you found the information useful and that it was new to you. It's true that web browsers have come a long way and can handle more and more advanced features. I think it's exciting to see how web-based apps are becoming more and more prevalent in the industry. Thanks for your comment!
it isn't working!!!!!
I still can't believe this, this is an incredible invention
Exporting pygame games to wasm is new for me! Thanks for the detailed video. Great work :)
the image is black clompledly black, do I need to upload my background too?
My html file created by pygbag is full of errors. I could fix them. But, even the, the game doesn't work for me after the emerging banner Pygame. After that, it only appear a black box. Could be possible if anybody share a succesfull generated .html file?
Best video I could found about this. Thank you!!
does it only work when your entire game is in a single file? Been stuck on "Setting [src] up" where 'src' is the name of my directory.
am getting the following error: "WARNING: wasm mimetype unsupported on that system, trying to correct
Not using SSL"
could not find a solution anywhere
did u find the solution?
he got the same thing and it still ran
FAQ 1: All I get is a black screen after converting the game.
Please load the game like this: localhost:8000/#debug
This way you can see the error that prevents the game from loading.
FAQ2: Can I use .mp3 files?
Yes, but don't. Using .mp3 files is buggy. Convert your .mp3 sound to .ogg.
*Should I assume playing videos is also not a good idea?*
I got more information form a 2 hour video for this 10min video! crazy keep it up
what if the game loop is part of the main game class?
The browser shows blank screen after ready to start button, The game has no error while running normally
what could be possible cause?
same thing is happening with me
did u find the solution for it?
Not sure if you guys are still looking for a solution, but in order to fix the black screen you need to:
1. Make sure that all of the functions in your code that have infinite loops (while True for example) have the "async" keyword in front of them
2. Put "await asyncio.sleep(0)" at the end of each infinite loop
3. Put the "await" keyword on all asynchronous function calls
Tanks bro, you're the best!
I have a programe to edit images. It use Tkinter for the GUI. And PIL library. In this case, PyBag don't include these libraries. What can I do to achieve a similar result? Pyscript neither do. Maybe use a remote server to run it would be the unique solution?
my screen is black after I click start, any suggestion?
There are many things that can go wrong. First you could try the debug mode to see what's wrong using localhost:8000#debug instead of just localhost:8000
it will show you the REPL with any message/trace python could send.
@@programmingwithnick I substituted the mp3 files with ogg and now it works
hey nick, some people are having some dificulties, can you make and pin a comment listing some problems and how to solve them? will help a lot
Im trying to do this on a raspi over a LAN connection. Ive done this and it works on localhost however, id like to be able to display it on some page like you have in the end. Ive got apache on the pi to work, but how can i run the game this way? Does the python file need to be an APK? I cannot find anything online explaining how to do this
Thank you Nick!
i successfully completed the instruction but as soon as i interact with my game, there seems to be a light blue overlay pver my game (similar to how it looks like when you select and image/ or text) how can i fix this?
when i open the game in the browser it doesn't start and screen is black
same thing is happening with me
did u get the solution?
Same
What if my game has 3 main definitions, play, main menu and tutorial?? how do I include async with it ? When i try to do async def with tutorial function, I cant change to any of the other screens anymore.
It (as well as pyinstaller if I don’t put It into the directory layer above the rest of the game) seemingly can’t find the font I’m importing. Why do all compiling programs struggle with fonts so much?
You sound Spanish or Greek 🤔
Great tutorial, man. Thank you!
It is showing black screen on me, anybody know the issue? I try with the snake example and also try on my game. the background music is played but the graphics, input, and sfx is not. just black screen
same here.. did u find somthing !
mine is have a define so what should I do
Thank you!!
Great explanation, I manage to load the game in the browser, but only when the command prompt is open, after I close the command prompt and double click on the browser icon in the build, the browser fails to load the game
Yes, that's normal behavior. The command promt has created a game server to load the game. If you close the command prompt, the server is no longer active so the game won't load. If you upload the game to your own web server it will work fine, this issue happens only if you run the game locally.
I have installed pygbag but I'm still getting:
C:\Users\aryam\Desktop>pygbag snake
'pygbag' is not recognized as an internal or external command,
operable program or batch file.
What do I do?
have the same problem
@@cypherecon5989 python -m pygbag file_name use this command and error will resolve
All I see on screen after the green loading bar is a black screen and I can hear audio. Also it’s not the whole screen just the game tab. How do I fix this
same
did u find the solution
@@prajwalshetti3655 I’m pretty sure I did but I don’t remember.
Hey, I tried doing this with my own flappy bird clone, For some reason pygbag kept showing black screens, only the background music loads, I've also tried using the debug tool that comes with pygbag but it only showed errors that didn't really make sense cause they worked in pygame. Do you have any idea how I could fix this?
Thanks.
What is your music format? MP3 or something else? I had the same problem when using .mp3 files. When I converted them to .ogg everything works fine. Try it and tell me how it goes.
@@programmingwithnick Hey, I did fix it after all, Basically the sound files weren't converted properly to .ogg, hence why the game wouldn't boot. and I have also forgotten to add a await asyncio.sleep(0) after every while true loop.
Hey, I have installed pygbag, but when I run "pygbag [Folder]," I get an error message that says pygbag is not an executable internal or external exam.
im having the exact same issue. i have no idea how to fix it.
@@D-ingus I think i found the solution. Try running python -m pygbag [Folder]
Thanks Dude U help me alot
@@elainegou
I had the exact same issue, pybag has hidden some where in your Python package area
I love your voice
Nick the GOAT
Thank you I can now participate in Pirate Software - Game Jam 15 😁
edit: My screen is now black with no game play why?
Me 2
Thanks it's a good tutorial
when running the game i get the error: Unexpected reserved word
thanks so much
pygbag snake not working with giving me an erorr
does this work with numpy and numba?
I have a issue of the game just showing previous images. The game runs but in a totally crazy way. any ideas?
Solved. It happened because I was calling the run async method by inside a __init__() function of a class. Do not do that. I create a class and than called its run method from out of the init function
@@SalocinRevenge Iam getting a black screen
I got the ready button but its not going further
what could be the problem?
Iam calling the async normally
Freezes at Downloading on localhost
same problem, doesn't display the program on the web browser, rather shows a black screen
Try loading the game like this: localhost:8000/#debug to see what goes wrong.
I really would appreciate if you can do a similar tutorial but for C++ with Raylib.
Added to the list. Thanks!
Is there a way this can work on iPhones? When I try the link I get the screen with the green button that says “Ready to Start!” but it does nothing when I tap on it.
Yes, this happens if the game you have created requires a keyboard to work. Since there is no physical keyboard on the iphone this approach won't work. You have to modify your original code to include mouse controls or touch controls as well.
@@programmingwithnick thank you!
Do you know how to use c++20 modules with raylib
I thinks its good
Iam getting a black screen
I got the ready button but its not going further
what could be the problem?
Hi, I had the same problem and then realized I put the await asyncio.sleep(0) at the end of the main() function and not inside the while loop... I hope this helps you out. Now I just need to figure out how to upload it to my website
@@calendollens9982 Thank you so much for ur help. I got the output :)
ty🙏
Please nick can you make more tutorials about raylib
Yes, I will make more raylib tutorials, but please be patient. Long format tutorials require a lot of time to be produced!
@@programmingwithnick sure but we need it the documentation is just a cheat she
Thank you very much for the feedback. I noted it down. I will prepare a lot of tutorials about raylib since you guys want it! Stay tuned!
@@programmingwithnick trust me Nick..... you gonna blow up in no time
awesome
😊
I keep seeing a black screen on the website. How do I fix this?