Pygame Comparison

Both Pygame and Arcade have are Python libraries for making it easy to create 2D games. Pygame is raster-graphics based. It is very fast at manipulating individual pixels and can run on almost anything. Arcade uses OpenGL. It is very fast at drawing sprites and off-loads functions such as rotation and transparency to the graphics card.

Here are some comparisons between Arcade 2.6 and Pygame 2.0.1

Library Information

Feature

Arcade

Pygame

Website

https://arcade.academy

https://www.pygame.org

API Docs

API Docs

API Docs

Example code

Example code

N/A

License

MIT License

LGPL

Back-end graphics engine

OpenGL 3.3+ and Pyglet

SDL 2

Back-end audio engine

ffmpeg via Pyglet

SDL 2

Example Projects

Games Made With Arcade

Games Made With Pygame

Feature Comparison

Feature

Arcade

Pygame

Drawing primitives support rotation

Yes

No 1

Sprites support rotation

Yes

No 1

Sprites support scaling

Yes

No 1

Sprite image caching 2

Yes

No

Type Hints

Yes

No

Transparency support

Yes

Must specify transparent colorkey

Camera support

Yes

No

Android support

No

Yes

Raspberry Pi support

No

Yes

Batch drawing

Via GPU

Via Surface 3

Default Hitbox

_images/hitbox_simple.png _images/hitbox_none.png

Tiled Map Support

Yes

No

Physics engines

Simple, platformer, and PyMunk

None

Event Management

Pyglet-based

No (or add Pygame Zero)

View Support

Yes

No

Light Support

Yes

No

GUI Support

Yes

No (or add pygame-gui)

GPU Shader Support

Yes

No

Built-in Resources

Yes

No

Performance Comparison 4

Feature

Arcade

Pygame

Draw 50,000 stationary sprites

0.001 seconds

0.425 seconds

Move 5,000 sprites

0.010 seconds

0.003 seconds

# sprites program can move + draw before FPS drops below 55

8500

2000

Collision detection 50,000 sprites

0.044 seconds no spatial hashing 5
0.005 seconds with spatial hashing

0.004 seconds 6

Draw 5,000 plain rectangles 7

0.081 seconds

0.008 seconds

Draw 5,000 rotated rectangles 8

0.081 seconds

0.029 seconds

1(1,2,3)

To support rotation and/or scaling, PyGame programs must write the image to a surface, transform the surface, then create a sprite out of the surface. This takes a lot of CPU. Arcade off-loads all these operations to the graphics card.

2

When creating a sprite from an image, Pygame will load the image from the disk every time. The user must cache the image with their own code for better performance. Arcade does this automatically.

3

A programmer can achieve a similar result by drawing to a surface, then drawing the surface to the screen.

4

Performance tests done on an Intel Core i7-9700F with GeForce GTX 980 Ti. Source code for tests available at https://github.com/pythonarcade/performance_tests and more detailed results at https://craven-performance-testing.s3-us-west-2.amazonaws.com/index.html

5

Polygon hit box, rotation allowed

6

Rectangular hit box, no rotation allowed

7

This tests raw pixel manipulation. If pre-drawn to a surface, Pygame is almost instant, and Arcade is almost instant if rectangles are batch-drawn in a sprite or shape list.

8

Scaling and rotation must be done by the programmer drawing to a surface, transforming the surface, then blit’ing the surface to the screen. Arcade uses the GPU for these operations and needs no additional code or performance hits.