How to make game delete itself after finishing?

I’m making a horror game and want the game to delete itself after it’s done. It’ll then leave a text document on the person’s computer saying “You couldn’t save them all!”. How do I do this?

1 Like

As far as I know, you cannot delete the application from within the application itself (windows and electron design rules).

However, you could always make it so you check the game folder for the text file, and if it exists close the game out upon starting?

1 Like

:open_mouth: so, if this were possible, we can delete files / folders as we wish on the PC of the users of our programs …

:cold_face: cool.

anyway, Silver-Streak has the best solution. Maybe with a frontend… horror music…

1 Like

To be clear, you can absolutely delete files and folders on the system. The filesystem events/expressions allow for that.

I don’t think you can make the app delete itself, though.

3 Likes

Really??? without user acceptance?? OMG.

Yep, absolutely. So does Unity, Unreal, Defold, and Construct 3 (with their scripts options).

It’s pretty standard.

2 Likes

i was totally unaware of this.

thanks for your time,

Ermes

2 Likes

What if I could make something like a batch script that opens as soon as I close the game? Is there a way to do that?

No, as far as I know most OSes will not let you execute a batch/powershell/run script from another program to avoid malicious actors.

No Os will grant you to achieve this without the user interaction, you probably can delete folders but not uninstall the software itself.

1 Like

it’s somehow doable, think it like this
base on the operating system the game will generate a bash script or a batch file that does like this:
the game runs it in the background and it checks for the process id of the game and whether it kills it or waits until it ends and after that delete the game and remain the text file, that’s how I think it can be done

You can store the “delete” status; so if you want to delete it, save the information and the next time the gamer open it, show a message that inform you that the game in deleted.