I have written a stand alone pygame application that connects via udp to a master machine.
This master machine provides network packages with variables and their values via udp, and the application represents them as instruments in the client machine.
Each instrument has a set of 2d textures associated with it and a range of values and movement, can be rotation, translation (x and y) and also could display text, hide/show the texture, etc.
The application loads the textures and variable value and accordingly rotates/moves it. then it keeps monitoring the variables and adjusting the texture rotation/position based on the defined tables. The instruments are defined in an INI file, that at the moment is quite large.
The goal is for this application to have good performance. At the moment ive accomplish about 20fps with some optimisations, but the more instruments i add, its getting slower and slower.
Ideally i would want 60 fps for this.
from my experimentation, the most costly part is not the network layer, but actually rotating the images with pygame.
Since this happens many times per second for hundreds of images, its getting a toll on performance.
Ive tested by 'pre calculating' the rotations from 1-360 degrees, and this approach gave a huge increase in performance, but the memory consumption was way to big due to having in memory 360 copies of the same image , times hundreds of images. getting out of memory with 8gb of ram.
Im looking for someone to look at my code, and optimise this application somehow to be able to achieve good performance, 60 fps or more, maintaining the same model of textures and ini file with the definitions.
The code ideally should be on python, using pygame although i may consider migrating to something like opengl if it gave performance gains.
You can look at the code here:
[login to view URL]
the branch test should automatically generate random values so you can see some movement and fps results without the master machine or network setup.
14 freelancers are bidding on average €478 for this job
Hello. It sounds interesting! :) I’m fine with optimizations especially in such interesting case! I think I may help you! Let’s talk details and do the business!