Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

How to convert python built game into HTML5 game?

A topic by Ninja-E-Bangla created 37 days ago Views: 268 Replies: 10
Viewing posts 1 to 4

How to convert python built game into HTML5 game? 

I want to convert my python game (---.py) into a HTML5 game (---.html). 

But I don't know how to do that. I tried to get help from AI, but don't want to use AI for developing games rather it gave me a code that I didn't like. I got an idea 'pygbag'. But the problem is I don't know how to use this. Please answer me.

Note: I have already uploaded the python game on itch.io; I have the python file/scrypt also.  Click here to see my python game

Moderator moved this topic to General Development
Moderator(+1)

You can try to search for pygbag in the forum, I've seen people mention it before. Try looking at Brython, too. Either way, it's not going to be a simple conversion process.

Okay my friend I will try Brython soon. I tried Pygbag and it finally succeed to make  a  index file. But after opening that, it doesn't work.


Note: I have deleted the 'web-cache' folder

(+1)

Brython allows you to use Python scripts within HTML, but it's not designed for games.

Typically, if you make games in Python, you'll use pygame, and pygbag is designed specifically for converting games created with pygame to web games. This is the best option, but it has certain requirements, such as using asynchronous functions. It's best to study the pygbag documentation and examples.

https://pygame-web.github.io/

Thank you for your information. I will try to include the functions/modules in my python script.

I have used Pygbag for converting the python game into  HTML game. IT didn't open in my browser by double clicking on the file. Although it didn't worked properly, I uploaded to my Wobbly Potato game portal. Then it worked!
But the problem is the emoji that is included in the wacky pillars are not showing. What should I do now?

To test the web version locally, you need to run the game using pygbag with the following command:

pygbag your.app.folder

Regarding the image of the pillar, I'm not sure what the issue is, but it's likely a problem with the file path or something in your code. I doubt it's a problem with pygbag itself.

Those are not files. It is included directly by emoji. 

Can I use Pyodide instead Pygbag?

(+1)

I don't know, I've never used Pyodide to run games or call the pygame library. You'll have to try it yourself and let us know if it works well or not.

Okay I'll try it by myself and make you informed