Skip to content

Repository files navigation

🐭 Welcome to Space Invaders Unity with Pi Pico W WiFi UDP Joystick

You are never too old to set another goal or dream a new dream.

                                                                        ― C.S. Lewis

Table of Contents

📜 Description

Space Invaders Unity 6.4 code generated by DeepSeek AI that interfaces with a Raspberry Pi Pico W joystick through WiFi UDP.
The program runs on Raspberry Pi Pico W (WiFi UDP Joystick) and MacBook Air 2017 (Space Invaders).

💻 Development Platform

Program code is generated for Unity 6.4 using C#.
I started prompt coding in the morning of 9th June 2026.
It took me quite a long time to complete this.
I have tested on Raspberry Pi Pico W and MacBook Air 2017 Unity 6.4.

On the Raspberry Pi Pico W:

  1. Do ensure that the Raspberry Pi Pico W is flashed with the correct *.uf2 file
  2. The RPI_PICO_W-20251209-v1.27.0.uf2 file can be downloaded from /resource/Pi Pico W Joystick Unity/ folder in this repository.
  3. Open Thonny and upload all the files in the repository folder /resource/Pi Pico W Joystick Unity/ onto Raspberry Pi Pico W. Program is using MicroPython.
  4. Open the file Pico_W_Joystick_WiFi_Unity.py. Make sure you update the code with your Wifi SSID, password and Raspberry Pi 5 IP.
# WiFi Configuration - UPDATE THESE
WIFI_SSID = "YOUR_WIFI_SSID"
WIFI_PASSWORD = "YOUR_WIFI_PASSWORD"

# Unity UDP Configuration
UNITY_IP = "192.168.0.15"  # Replace with your computer/Unity IP address
  1. Run Pico_W_Joystick_WiFi_Unity.py. The following output will be displayed in the Thonny run window.

Note: You can rename Pico_W_Joystick_WiFi_Unity.py to main.py so that the program will automatically run when Raspberry Pi Pico W power up.

MPY: soft reboot

==================================================
PICO W JOYSTICK - DIRECT TO UNITY
==================================================
Connecting to WiFi: chanhome 2.4GHz
Connecting... 14s left
Connecting... 13s left
Connecting... 12s left
✓ WiFi connected! IP: 192.168.0.19
✓ UDP socket created
Sending directly to Unity at 192.168.0.15:9000

✓ Ready! Sending joystick data directly to Unity...
Press Ctrl+C to stop

[5] X= 77% (50764), Y= 77% (50796), Button=Released
[10] X= 77% (50844), Y= 77% (50796), Button=Released
[15] X= 77% (50860), Y= 77% (50860), Button=Released
[20] X= 77% (50828), Y= 77% (50844), Button=Released
[25] X= 77% (50764), Y= 77% (50828), Button=Released
[30] X= 77% (50828), Y= 77% (50876), Button=Released
[35] X= 77% (50828), Y= 77% (50876), Button=Released
[40] X= 77% (50844), Y= 77% (50812), Button=Released
[45] X= 77% (50780), Y= 77% (50844), Button=Released
[50] X= 77% (50764), Y= 77% (50860), Button=Released
[55] X= 77% (50780), Y= 77% (50844), Button=Released
[60] X= 77% (50828), Y= 77% (50828), Button=Released
[65] X= 77% (50764), Y= 77% (50844), Button=Released
[70] X= 77% (50764), Y= 77% (50844), Button=Released
[75] X= 77% (50796), Y= 77% (50780), Button=Released
[80] X= 77% (50764), Y= 77% (50828), Button=Released
[85] X= 77% (50764), Y= 77% (50828), Button=Released
[90] X= 77% (50828), Y= 77% (50828), Button=Released
[95] X= 77% (50764), Y= 77% (50780), Button=Released
[100] X= 77% (50828), Y= 77% (50844), Button=Released
[105] X= 77% (50796), Y= 77% (50844), Button=Released
[110] X= 77% (50780), Y= 77% (50828), Button=Released
[115] X= 77% (50828), Y= 77% (50812), Button=Released
[120] X= 77% (50716), Y= 77% (50828), Button=Released
[125] X= 77% (50796), Y= 77% (50844), Button=Released
[130] X= 77% (50796), Y= 77% (50700), Button=Released
[135] X= 99% (65007), Y= 77% (50844), Button=Released
[140] X= 25% (16900), Y= 77% (50732), Button=Released
[145] X= 77% (50764), Y= 77% (50716), Button=Released
[150] X= 77% (50764), Y= 77% (50764), Button=Released
[155] X= 77% (50732), Y= 89% (58654), Button=Pressed
[160] X= 77% (50764), Y= 77% (50828), Button=Pressed
[165] X= 77% (50620), Y= 77% (50764), Button=Pressed
[170] X= 77% (50748), Y= 77% (50780), Button=Released
[175] X= 77% (50764), Y= 77% (50876), Button=Released
[180] X= 77% (50796), Y= 92% (60382), Button=Released
[185] X= 89% (58926), Y=100% (65535), Button=Released
[190] X= 99% (65295), Y=100% (65535), Button=Pressed
[195] X= 77% (50732), Y= 77% (50796), Button=Pressed
[200] X= 77% (50780), Y= 77% (50780), Button=Released
[205] X= 56% (36889), Y= 77% (50764), Button=Pressed
[210] X= 45% (30039), Y= 77% (50780), Button=Released
[215] X= 77% (50748), Y= 77% (50844), Button=Released
[220] X= 77% (50828), Y= 77% (50828), Button=Released
[225] X= 12% ( 8017), Y= 77% (50796), Button=Released
[230] X= 37% (24325), Y= 77% (50780), Button=Released
[235] X= 77% (50764), Y= 77% (50844), Button=Released
[240] X= 77% (50844), Y= 77% (50796), Button=Released
[245] X= 77% (50796), Y= 77% (50828), Button=Pressed
[250] X= 77% (50828), Y= 77% (50796), Button=Released
[255] X= 77% (50780), Y= 77% (50860), Button=Released
[260] X= 77% (50796), Y= 77% (50796), Button=Released
[265] X= 77% (50780), Y= 77% (50844), Button=Released
  1. Raspberry Pi Pico W is now ready and transmitting the Joystick movement data to MacBook Air 2017.

On the MacBook Air 2017:

  1. Git clone all the files in the repository folder onto MacBook Air 2017 Home folder. Program is using Unity 6.4 that run from Unity Hub.
  2. Open the project Space-Invaders-Unity.
  3. Run Space-Invaders-Unity

💾 Software Development:

Unity 6.4 code is generated by DeepSeek AI using the following prompt:

Can you generate code for space invaders game that runs on Unity 6.4 game engine? 
Name the project: Space-Invaders-Unity. 
You can refer to the attachment of files from my Space Invader Godot 4 with Pi Pico W WiFi UDP joystick. 
Make use of the resources names for sound, sprite , etc. referenced in the files for 
your reference. I have sprite spacesprite.png file for invader and ship.png for space ship. 
There is no sprite for the laser. Follow the reference files to support WiFi UDP communication 
with the Raspberry Pi Pico W WiFi joystick.

Can you let me know the steps to create the Unity project and 
how to setup the code, sprite, sound, etc as I am very new to Unity 
and not familiar with the settings.

Sprite image and sound file obtained from this webside: (https://joecode22.itch.io/space-invaders)

📱 Platform tested:

I have tested my code on:

  • Raspberry Pi Pico W together with MacBook Air 2017 running Unity 6.4.

🎞️ Screenshots

Splashscreen searching for joystick:

Splashscreen joystick found:

Splashscreen joystick not found, switch to keyboard mode:

Game screen Joystick mode:

Game screen Keyboard mode:

Game over screen, player loss:

Player win game screen:

⏳ Chronology of Development Events

  • 8th June 2026: Finally managed to install Unity Editor on my old MacBook Air 2017. There was a hiccup initially that the Unity Hub I downloaded from Unity website for Mac always defaulted to Arm64. Unity only allows Personal License to be created through Unity Hub so it is critical to get Unity Hub running. Luckily I found out later from AI query that game me a link to download x64. Used my phone to download it and then copy to me MacBook Air 2017.Around 5.48pm in the evening finally managed to get Unity Hub running, personal license created and Unity 6.4 editor downloaded by Unity Hub and installed.
  • 9th June 2026: Started prompt codng of Unity 6.4 codes using Qwen3.6-plus AI. After struggling for few days, I gave up on the code generated by Qwen3.6-plus. The settings are too complicated and a number of times I couldn't find the setting that Qwen3.6-plus asked to set. I felt that this AI tends to make a lot of mistakes. Ended up I moved to develop in Godot first.
  • 22nd June 2026: I completed Space Invaders Godot using DeepSeek AI. So today I prompt generated Space Invaders Unity through DeepSeek. Completed by end of the day all the setting, prefab and scripts but unfortunately game when run is not displaying anything.
  • 23rd June 2026: Finally gotten the Space Invader game to work on Unity. Spent whole day familiarising with the Unity way of adjusting the location of HUD, text in game mode.
  • 24th June 2026: Completed all of the features including the moving slider for representing Calib and also having invader & player sprite in the SplashScreen. The rotating circle during Joystick connection is completed. Due to me running Unity on MacBook Air, found that I need to turn off firewall before trying to connect to the WiFi UDP Joystick.
  • 25th June 2026: Completed the Space Invaders Unity project. Built the app program that is standalone and runnable on my MacBook Air 2017. Finally, I have published and released v1.0.0 version of space-invaders.app.

☕ Buy Me a Coffee

If you appreciate my work, do support me by...
Buy Me A Coffee

🆕 Changelog

📃 License

This program is licensed under the GNU General Public License v3.0 
Permissions of this strong copyleft license are conditioned on making  
available complete source code of licensed works and modifications,  
which include larger works using a licensed work, under the same  
license. Copyright and license notices must be preserved. Contributors  
provide an express grant of patent rights.

See the GNU General Public License for more details.

💬 Feedback and Suggestions

For any feedback or suggestions, feel free to contact me via email:
📧 chanlhock@gmail.com 🐭

About

Space Invaders Unity with Pi Pico W WiFi UDP Joystick

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages