r/learnjavascript • u/Independent_Heart_15 • Nov 27 '22
Created my first .exe game tonight!
4
2
u/_Oooooooooooooooooh_ Nov 28 '22
that looks cool!
i've always wanted to make a tetris game. but i've also been lazy.
1
2
2
u/dromance Nov 28 '22
this is incredible nice job. I have been looking more into cross platform dev lately I think it's so awesome. HOW do these things work exactly? do they just take your JS and convert it to target platform native code?
1
u/Independent_Heart_15 Nov 30 '22
I have no idea how electron works as this would be my first JS project. However if I remember correctly Auto-Py-to-exe (electron for python, which I have used many times before) converts the code into binary.
2
u/anjupiter Nov 28 '22
woahhh, i didn’t know you can do that with JS
1
u/Independent_Heart_15 Nov 30 '22
There’s a whole lot you can do with JS and especially if you include library’s!
20
u/AAACONSUL Nov 27 '22
Wait what? How do make an exe game out of JavaScript?
32
u/carcigenicate Nov 27 '22
Electron. The Discord client for example is basically just a browser that only shows the Discord page afaik.
5
13
13
u/sysrage Nov 28 '22
Everybody is mentioning Electron, but there are a ton of different tools to do this. You can use
pkgto turn a Node.js script into an exe to be used as a CLI app or a service. If you want a UI, there’s tons of options (several being smaller/faster than Electron): https://xpda.net/2
0
u/Zoroae Dec 18 '22
Should've linked Tauri
1
-8
u/thespite Nov 27 '22
You don't. But you can make it "native" with Electron.
2
u/Shabz_ Nov 28 '22
Judging by your karma ratio on this comment, you do
2
u/thespite Nov 28 '22
i wasn't disparaging Electron, but i guess people have knee-jerk reactions. i put native in quotes because it's such a loaded term that it's becoming almost meaningless in this kind of discussions
0
Nov 28 '22
[deleted]
4
3
1
2
u/CalebKious Nov 28 '22
I really like how you added credentials then censored it. Adds a bit of mystery and puzzle to the game!
1
Dec 13 '22
So cool! I think once i finish my senior project presentation and graduate this week, I'll buckle down and make Minesweeper lol i recently got into it during my intermittent breaks and I want to try my hand at coding it! Thanks for sharing your creation with us and good job, i love Tetris!
1
1
0
u/FromBiotoDev Nov 28 '22
Is electron a subset language of JavaScript? I’d love to give this a go!
1
u/jaredcheeda Nov 28 '22
Electron is a runtime environment. It's a node module that launches a custom browser window with the ability to communicate with Node using IPC.
It's honestly overly complex for the job it's doing, and is often critiqued for being bloated and hard to use.
A better alternative would be NW.js. It's a much simpler API, by being just a browser window with Node built in. No need to use IPC tunnels for communication. It's also smaller, and has better overall features.
Some common boilerplates for it are here:
2
u/Independent_Heart_15 Nov 30 '22
I’ll take a look! I have little to no experience with JS and electron was the only converter I had heard about so I choose it, though I quickly noticed its capabilities are a lot larger the my use.
0
24
u/RobotDrZaius Nov 27 '22
Cool! Aside from Electron, what did you have to learn to put this together? Any libraries that were especially helpful? I’m interested in doing this on a hobby level.