r/PowerShell • u/That-Feeling-2399 • Sep 09 '26
Question Are games possible in power shell?
Hey gang, I hope this is the right subreddit but would anyone know if it is possible to run text games in powershell/cmd prompt? If so, what kind of pre built code is out there?
0
Upvotes
58
u/pantherghast Sep 09 '26
You could also use a spoon to tunnel through a mountain, but I wouldn't recommend it.
16
u/TechCF Sep 09 '26
Doom https://www.reddit.com/r/PowerShell/s/R5CnXFKOI8
15
u/MallocArray Sep 09 '26
How about a game in PowerShell to learn how to use PowerShell?
https://github.com/PowerShellOrg/PSKoans
18
u/DrSinistar Sep 09 '26
PowerShell is, at it's core, an automation tool for IT administrators and engineers.
Could you make a text game? Absolutely, but it would be slow and clunky.
If you want to make games, use C# instead. If you want to keep things simple, use Python. PowerShell is the wrong tool for the job.
7
u/ihaxr Sep 09 '26 edited Sep 09 '26
Yes, specifically you can use
[Console]::SetCursorPositionto directly overwrite specific locations on the screen without having to runClear-Hostand redraw the entire frame.You can lookup any console based games in any language and try to rewrite it in PowerShell or see how it's written.
I'm not really aware of any preexisting libraries for it.
Give it a try by creating a blank window, output an
oto the window then detect key presses:You'll want to improve it to only overwrite the old location and update the new location after a key is pressed instead of just duplicating the character, also detect the boundaries of the console to prevent errors, etc...
1
u/That-Feeling-2399 Oct 12 '26
Thanks all, learned lots of good things
1
u/Creative-Type9411 Sep 10 '26
I mean, theres this..
https://github.com/illsk1lls/Powerstein3D
3
u/Tanner-TO Sep 09 '26
Just for fun I had qwen 3.8 make a tetris game the other day as an exercise to see if it could do it or not... and rather successfully..
3
u/AdministrativeFile78 Sep 14 '26
Yes but for the love of God, no
2
u/Cannaganjabis Sep 09 '26
You could try this Powershell Hangman game - https://www.scriptwizards.net/how-to-code-a-hangman-game-in-powershell/
2
u/renevaessen Sep 09 '26
You mean like this: https://github.com/genXdev/GenXdev.PowerShell/blob/main/Functions/GenXdev.Console/Start-SnakeGame.ps1
2
u/phunky1-2 Sep 09 '26
https://github.com/gregoryfmartin/Eldoria
2
u/MonkeyNin Sep 09 '26
What kind of game are you trying to make? If you want a roguelike, there's libraries for python and javascript that are a lot easier .
But if you want text, tables, etc try Spectre It's a more modern TUI / Text-user-interface.
Then you don't have to mess with manually using
[Console]::ReadKey2
u/g3n3 Sep 09 '26
Pstetris
2
u/Proxiconn Sep 10 '26
https://www.reddit.com/r/PowerShell/s/KO7aBad6hF
Powerstein.
1
u/Loki-L Sep 09 '26
Sure, I don't see why you would want to, but you definitely could.
You could probably easily port something like Zork to PowerShell.
It isn't really the right tool for this sort of job, but it can certainly do that.
1
u/stillnotlovin Sep 09 '26
One of our first powershell tasks at school was to make a hangman's game with word randomization.
1
u/AroTesCra Sep 09 '26
Since you can add-type and other compiled languages to the mix also you can call Win forms / WPF and directX you could make a window popup with a scripted game
1
u/ZZartin Sep 09 '26
It has access to the full .net library so sure?
Doom in powershell anyone?
1
u/x8code Sep 14 '26
Technically yes, but game loops are much better with a high performance language. Use Rust instead.
1
u/ki6cqe Sep 14 '26
Powershell has full access to the .Net framework. "Anything" you can do in C++ you could do in Powershell, but it will never be as fast or efficient as C++ (close, if you are using .Net libraries, those are compiled, but the control portion in PSH will be slow). Probably ok for a text-based adventure.
1
u/TheBigBeardedGeek Sep 14 '26
Nethack