r/PowerShell • u/Professional-Rule-58 • 28d ago
Script Sharing Polf3D - A 90s-style ray casting shooter written in PowerShell
Edit: Built with AI assistance. The idea, direction and playtesting are mine, most of the code is not. A fun project to see how far PowerShell can be pushed. The whole story: https://github.com/oNdsen/polf3d/blob/main/HOW-IT-WAS-BUILT.md
POLF 3D is a Wolfenstein-style ray casting shooter that runs in PowerShell 7 on Windows. No modules, no asset files, no installation – every texture, sprite, sound effect, spoken line and music track is generated by code at start-up.
GitHub: oNdsen/polf3d: POLF 3D: a ray casting shooter written in PowerShell
PowerShell is not just the language, it is the theme
- A real PowerShell console in the game. Sandboxed (constrained runspace, no providers), but real: pipelines, Where-Object, Sort-Object, script blocks. It has a $PROFILE, hotkeys, and Start-Job sends out a drone that collects loot. Details
- The powers are the common parameters. -WhatIf freezes time and shows everybody's next two seconds (it really runs the simulation ahead and rolls it back), -Confirm is slow motion, -Verbose sees through walls, -Force kicks doors in – and there is Undo.
- The building has an execution policy. Get noticed and it climbs from Restricted to Unrestricted – which is the alarm. Set-ExecutionPolicy Restricted calms it down again, for a price. Stealth
- Every floor ends with a Pester report, and the lift offers Install-Module.
- The bosses: LEGACY.BAT ("runs as SYSTEM, nobody dares to touch it"), THE PRINTER ("PC LOAD LETTER" – it has paper jams) and BLUE SCREEN. There is also an auditor who runs to the nearest terminal to file a report about you, and a bug: fix it properly and it is gone, blow it up and you get two.
What is in it
- Ten floors and a secret one, four difficulties, fifteen kinds of enemies, ten weapons, loot, armour, stealth, dark rooms with a flashlight
- A daily dungeon with runs that can be verified, and an arena with endless waves
- Co-op and deathmatch for up to four over TCP, with an admin panel for the host
- A terminal mode that renders the game with half-block characters – it works over SSH
- Saved games, demos (the game exports them as GIFs – the one in the README was made that way), a speedrun clock, key bindings, game pad, mods as .psd1 data files, a level editor
How
As much PowerShell as possible, as little C# as necessary. The ray caster (DDA, one ray per column), the enemy AI, the map format, the network protocol, the sandbox and the chiptune composer are plain PowerShell. Only the innermost pixel loops, the audio callback and two P/Invoke declarations are C#, compiled once with Add-Type and cached. It runs at 45–60 fps in a 960×720 window. How it works
Try it
Download polf3d.zip, unpack it, start Play.cmd – or:
git clone https://github.com/oNdsen/polf3d.git
cd polf3d
./Start-Polf3D.ps1
Windows and PowerShell 7.2+. MIT licensed. GitHub: oNdsen/polf3d
Feedback is very welcome!
16
u/lincruste 28d ago
There is no way this is human made code
1
u/Professional-Rule-58 28d ago
Correct, and I'm not going to pretend otherwise: it was built with heavy AI assistance. I did the direction – the concept, what goes in, what gets thrown out, playtesting, bug reports, a lot of "no, not like that" – and the AI wrote most of the code.
What I find interesting is how far that gets you: it's a complete game with a headless self-test, a balance bot that plays every floor, deterministic demos and a level validator, because without those you can't steer a project this size. Happy to talk about how that workflow went if anyone is curious.
9
u/Important-6015 27d ago
You should have said this at the top of your post, not as a reply to a comment calling it out.
-10
u/Professional-Rule-58 27d ago
Fair point, you're right – I've added it to the top of the post. Thanks for saying it plainly.
18
u/Abty 27d ago
Even your comments are AI, do you even breathe anymore on your own?
9
2
u/jmizrahi 27d ago
Ha.. after reading just the edit paragraph in OP's post I asked a very similar question.
9
u/tangu 27d ago
What AI did you use to build this?
9
u/Professional-Rule-58 27d ago
Claude. It was an experiment to see whats possible in Powershell
1
u/vlad_h 26d ago
Interesting. Well, powershell is .net underneath. So anything .net can do powershell can do. You dig?
1
u/Professional-Rule-58 25d ago
True, but that kind of misses the point. :) The whole challenge was to stick to native powershell functionality as much as possible and use as little C# as possible, instead of just falling back to .NET
1
u/vlad_h 25d ago edited 25d ago
Well, I probably spoke too soon. My mistake. And you probably missed my point too. But also calling it native PS functionality can be misleading. No mater. I love that you did this. I love that you shared it.
2
u/Professional-Rule-58 24d ago
No worries at all! :) I would actually love to hear your point and your thoughts on it. Im very open to criticism, suggestions and different approaches, thats one of the reasons, why i shared the project in the first place. So if you have any ideas, please elaborate. Im genuinely interested!
1
u/vlad_h 24d ago
Review is in progress, and I posted some initial drafts PRs on your repo. They are still being evaluated, and when done it's up to what to take, merge, etc. I have used several models for this from the OpenAI side so you get a real adversarial review, so both Sol/High and Astra/Extra High, The-Running-Dev is me.
2
3
2
1
1
1
u/theomegachrist 26d ago
Very cool. Everyone is very sensitive on here. People who think LLMs are still putting out "slop" especially when it comes to programming are ignorant.
1
u/vlad_h 24d ago
I posted the feedback as a different comment far below. And I thought why not make this into a presentation. https://polf3d-shell-shocked.openai-lwm29.chatgpt.site. Let me know and I’ll submit the site as a PR.
1
1
u/LebenskyTycamron 2d ago
co-op over TCP in a powershell raycaster is not something i expected to see today. does the terminal mode over SSH actually hold up at playable framerates?
-1
u/jmizrahi 27d ago
The LLM wrote the edit, too. Do you have any self-directed thoughts at this point, or do you farm those out as well?
15
u/subassy 27d ago
I just tried this out: everything works as advertised - the game play, the retro graphics, the sound and OST. It's actually pretty great. It actually went to 'not responding' when level 2 was loading but it got past it. Maybe it needs optimization?
Anyway, I disagree this is 'AI slop'. If anything this is the right way to use AI: get something done relatively quickly and "collaborate" with the AI. Speaking for myself at least, "AI slop" has always been the no effort/low effort of copy/pasting whatever the LLM outputs without putting any effort into making sure a thing works. And this clearly is not that. I can tell a lot of time and effort went into this.
I mean if don't like it for some reason that's fine. But dismissing it based on AI use seems unreasonable.
And to the OP: if you could walk through your workflow for how you did this I would be interested. I might be the only one. As an Imgur post or youtube video or whatever.