Pull to refresh
107.73

Data visualization *

We enclose the data in a beautiful shell

Show first
Rating limit

Fantastic ! Look at >> source code (or take it from my telegram) of the Ping-Pong game prototype on MatPlotLib (scientific graphics on python) with high FPS=40.

Previously, in my >>article on Habr, the application of PyGame for graph plotting was reviewed, and now, conversely, we're creating a game on a system designed for scientific graph plotting. In the previous version, attempting to output text with high FPS resulted in significant "lag"; in the current version, this issue is resolved.

In the code for rendering all game elements, only MatPlotLib objects are used: tennis rackets are represented as bar charts, the ball as a scatter plot, the game field itself as a figure object from MatPlotLib, and text is also output using built-in MatPlotLib functions. For animation, the built-in MatPlotLib Animation object + update() is used. FPS=40 (forty!).

P.S. The yellow bar chart represents the distribution of Y-axis coordinates where the racket hits the ball. It updates with every hit of the racket on the ball.

Tags:
0
Comments1

Authors' contribution