Commutator by Sodoj

Please read below before downloading!
In Commutator, you take on the role of the hardworking postman, Wilson, as he embarks on a perilous journey to deliver important packages to their recipients. But there's a twist – all of the packages are scattered across the town! To make matters worse, the packages keep piling up and Wilson must strategically collect them to avoid crashing and losing everything! Will Wilson ever make his delivery?
But wait, why does it look like a typical snake game that is somehow played in Microsoft Paint? Well, it's simple, it's because it is! Yeah, Commutator is a fully playable snake game in a Microsoft Paint window that allows for player input, growing snake, keeping score and increasing speed! Just pretend it's a little postman running around and collecting packages in order to fit this game with this Ludum Dare theme :p

HOW TO PLAY
Well, this is where it gets a little tricky. Commutator is not really a game in a traditional sense, but rather a Python script that simulates the snake game using your mouse! It requires more effort to run than your average game and it can be a little bit scary, but I promise you there is nothing to worry about!
Choosing a method
There are two methods you can play this game. The only thing you really need for both of these methods is to have is a computer with English Windows 10. The game simulates Wilson's movement with your mouse input and the first couple of inputs the game makes is setting up the canvas for the game, which was preconfigured for Windows 10 version of Microsoft Paint. The game then assumes everything is set up correctly so it starts moving your mouse and clicking. I haven't tested the game on Windows 7 or Windows 11, but you can feel free to give it a go! If anything goes wrong, you can press the Escape button which will stop the game immediately.
Well now, off to the two methods:
Method 1: Running the Source Python script
In order to run this script, you'll need to have several libraries installed:
- pyautogui (pip install pyautogui )
- pygetwindow (pip install pygetwindow)
- pywin32 (pip install pywin32)
- keyboard (pip install keyboard)
- for updated version - psutil (pip install psutil)
There are two source scripts, one called CommutatorSource.py, which creates a canvas which dimension's are 800x600 and another one called CommutatorSource_NonStandard.py, which creates a canvas with dimensions of 640x480 . Non standard screen sizes like screens with 768p should ruin the NonStandard version of the code. When you
Method 2: Downloading and running the .exe
This method may seem more straightforward, but here's the catch: antiviruses really don't like precompiled Python scripts and they flag them as potentially harmful so you'll have to go out of your way to wrestle with your antiviruses in order to play the game. I recommend this method only if you really don't want to bother with setting up Python. The standard and non standard version of executables are the same deal, pick whichever suits your screen.
UPDATE: The Updated version of source is now available, including the support for French and Spanish Display language, Automatic Canvas resize depending on the screen you have and an option to resize the dots representing the player and the pellets! before the game starts!
Playing the game
When you run the script, let go of your mouse! The script will take control of your mouse and keyboard to run mspaint using the run command and will set up the game board for you. If you move your mouse in a meantime, there's a chance the script will missclick something and the worst it can happen is that the game will start clicking on your files, folders and whatnot! Again, if anything goes wrong, pushing the Escape key on your keyboard will end the game and the script.
Once the screen is set up and you see snake moving, then you can control it. You can control snake with WASD buttons. Once you lose, the game will display your final score and MSPaint window will close. If you want to play again, just run the script/exe!
I hope this wall of text won't intimidate too many people. I am very happy with how this project has turned out and I had a lot of fun working on it.
Have fun!
| A Python script, recommended for running the game | https://sodoj.itch.io/commutator |
| Precomiled Python script, may get falsely flagged by antiviruses | https://sodoj.itch.io/commutator |
| Original URL | https://ldjam.com/events/ludum-dare/53/commutator |
Ratings
| Overall | 175th | 3.633⭐ | 62🧑⚖️ |
| Fun | 188th | 3.433⭐ | 62🧑⚖️ |
| Innovation | 2th | 4.628⭐ | 76🧑⚖️ |
| Theme | 381th | 2.754⭐ | 63🧑⚖️ |
| Graphics | 328th | 2.982⭐ | 58🧑⚖️ |
| Humor | 38th | 3.925⭐ | 62🧑⚖️ |
| Mood | 178th | 3.389⭐ | 20🧑⚖️ |
| Given | 93🗳️ | 157🗨️ |

I recorded myself playing if you want some extra feedback. I don't have too much to say, it's just snake, but the medium in which you have presented snake is hilarious and crazy. Great work!
https://www.youtube.com/watch?v=6PDXqcZaBWU

I love it.
``` mspaint_window = gw.getWindowsWithTitle('Untitled - paint')[0]
IndexError: list index out of range```
This is a huge oversight on my part, it never occurred to me that people don't necessarily have Windows in English while I was developing the game, so thank you for pointing that out to me! I'll see how I can address it!
```
Traceback (most recent call last):
File "C:\Users\Utilisateur\Downloads\Commutator_Source.py", line 68, in <module>
canvas_x, canvas_y, canvas_width, canvas_height, board_width, board_height = get_canvas_position()
File "C:\Users\Utilisateur\Downloads\Commutator_Source.py", line 48, in get_canvas_position
rect = win32gui.GetWindowRect(paint_win)
pywintypes.error: (1400, 'GetWindowRect', 'Handle de fenêtre non valide.')
```
`mspaint_window = gw.getWindowsWithTitle('Sans Titre - Paint')[0]`
If you are sure the name you put in the parenthesis and the name of your window match, then I'm not sure what would cause the issue. Either way, thank you so much for taking time to debug this with me!
I'm gonna try to find
Well now going to bed, way to late and spent way too much time on this lol, let's say it was a part of the game ! Anyway, your idea was crazy and I really wanted to try it, great idea even if the game is super simple, good job !
I did use the precompiled jam version though.


EDIT: 125% causes same issue as 150% (duh)

I played the JAM exe version and the postjam script:
- I think you need to update the instructor the postjam script, there's also `psutil` needed to run the script e.g.
```
pip install pyautogui pygetwindow pywin32 keyboard psutil
```
- Would love to have a bigger pencil size, currently the dots look too small on my monitor and it kinda hurt my eye.
- I managed to "trick" the JAM version by opening another Paint windows and use a Brushes with max size, and JAM version used that window instead of the one it opened. Max brushes size looks better imo and I can play well. But post-jam script detects window quite stably so can no longer trick it :(
This script is very interesting, maybe it can even turn Paint into a movie/gif player haha
Also when I looked through the code it looked like you quit the game if the player has the wrong language- you might want to default to English instead.
I'd love to have the game default to English, but as I explained in this [blogpost](https://ldjam.com/events/ludum-dare/53/commutator/the-horrors-of-making-a-game-running-in-microsoft-paint-window), the layout in Paint is different in every language and even some of the hotkeys are different, that is the sole reason why I added support for French and Spanish and also the reason I can't afford to do what you suggested, who knows what script might end up clicking, potentially giving a scare to unsuspecting players!