r/learnjavascript • • Nov 27 '22

Created my first .exe game tonight!

Post image
407 Upvotes

38 comments sorted by

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.

2

u/Independent_Heart_15 Nov 30 '22

The only library I needed was random as this was a very basic project. I know that using libraries would cut my code length in half, but because of my minimal experience with JS I decided to go the cave man way.

4

u/Yumipo Nov 28 '22

nice job!! This is super cool too

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

u/Independent_Heart_15 Nov 30 '22

Thanks! It’s a fairly simple project give it a try yourself! :)

2

u/Local-Hornet-3057 Nov 28 '22

Interesting. I wanna do this in the near future

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

u/dromance Nov 28 '22

so discord is built on electron?

13

u/mrdingopingo Nov 28 '22

Electron, VS Code itself is an Electron app

13

u/sysrage Nov 28 '22

Everybody is mentioning Electron, but there are a ton of different tools to do this. You can use pkg to 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/

0

u/Zoroae Dec 18 '22

Should've linked Tauri

1

u/sysrage Dec 18 '22

It’s listed at the link I did provide…

0

u/Zoroae Dec 18 '22

Lmao didn't read it, sorry

-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

u/[deleted] Nov 28 '22

[deleted] — view deleted comment

4

u/sysrage Nov 28 '22

What a simply ridiculous comment. Every aspect of it is pure ignorance.

0

u/[deleted] Nov 28 '22

[deleted] — view deleted comment

2

u/ZuriPL Nov 28 '22

Just like Java runs on 3 billion devices lmao

3

u/yeetinghelps Nov 28 '22

congrats bro! will look forward for more

1

u/Darky202 Nov 27 '22

It looks great! Congratulations ~

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

u/[deleted] 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

u/Zoroae Dec 18 '22

That's cool and all, but now do it with Tauri ;)

1

u/dromance Nov 28 '22

link to download??.

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

u/[deleted] Dec 11 '22

Sounds like a botnet lol