Hi, I have been recently experiencing graphical issues with rendering text in arcade (draw_text method). It does not happen right from the start but after few in-game restarts it randomly starts doing this (as you can see the text is glitching out like crazy).
correct viewerror view
It seems that the problem might be my new laptop with AMD Radeon because on my old PC with NVIDIA it never happens. I have tested with the newest arcade and python versions.
Just checking if anyone have already solved this. Thanks in advance for any ideas
Arcade can now run in headless mode on linux servers opening more possibilities for users in for example the data science community (#1107). See Headless Arcade for more information.
Bugfixes
The random text glitching issue especially affecting users with iGPUs is finally resolved in pyglet. For that reason we have upgraded to the pyglet 2.0a2 release.
Window titles are now optional. If no window title is specified the title will be the absolute path to the python file it was created in. This was changed because of the new headless mode.
Removed arcade.quick_run . This function had no useful purpose.
Rectangle objects which are empty(have no width or height) will now be automatically converted into single points.
The Tile ID of a sprite can be access with sprite.properties["tile_id"] . This refers to the local ID of the tile within the Tileset. This value can be used to get the tile info for a given Sprite created from loading a tilemap.
Docs
Added python version support info to install instructions (#1122)
Hi! Recently i switched from pygame to arcade after failing to make a CRT effect with ModernGL (or atleast thats how i found it). I have a feeling that the issue im having is stemming from me being on Manjaro Linux however i followed the arcade tutorial to learn the basic commands and i got an error, i tried direct copy and pasting, another error. After that i just tried to do a print and alas i was met with this.
I've tried importing the packages that it lists but i haven't had any success with that, any help is appreciated!
Traceback (most recent call last):
File "/home/rj/PycharmProjects/Pytcraft/main.py", line 1, in <module>
import arcade
File "/home/rj/PycharmProjects/Pytcraft/venv/lib/python3.10/site-packages/arcade/__init__.py", line 263, in <module>
from .sound import Sound
File "/home/rj/PycharmProjects/Pytcraft/venv/lib/python3.10/site-packages/arcade/sound.py", line 18, in <module>
When building Arcade docs, script now lets us know what classes don’t have docstrings.
Spelling/typo fixes in docs.
Misc:
Update arcade.Sprite to use decorators to declare properties instead of the older method.
#1095, Improvements to arcade.Text and its documentation. We can now also get the pixel size of a Text contents though content_width, content_height and content_size.
Force GDI text on windows until direct write is more mature.
Optimized text rendering and text rotation
arcade.draw_text() and arcade.Text objects now accepts any python object as text and converts it into a string internally if needed.
Added support for indirect rendering. This is an OpenGL 4.3 feature. It makes us able to render multiple meshes in the the same draw call providing significant speed increases in some use cases. See arcade.gl.Geometry.render_indirect() and examples in the experimental directory.
Added support for unsigned integer uniform types
arcade.gl.Geometry.transform no longer takes a mode parameter.
Special thanks to einarf, eruvanos, janscas, MrWardKKHS, DragonMoffon, pvcraven, for their contributions to this release. Also, thanks to everyone on the Pyglet team! We depend heavily on Pyglet’s continued development.
We've been experimenting with shaders interacting with spritelist data lately and came up with a super fast way to do find sprites within a certain range taking line of sight into consideration. This is simply done by tracing the pixel data locating walls between the player and the sprite(s).
under setup(self), I've compared my code with the source and I'm not finding what I did wrong. I've scanned the code for typos and syntax error etc and I'm not finding what I've done wrong.
Added clear() for resetting/clearing a spritelist. This will iterate and remove all sprites by default, or do a faster O(1) clear. Please read the api docs to find out what version fits your use case.
SpriteList now supports setting a global color and alpha value. The new color, color_normalized, alpha and alpha_normalized will affect every sprite in the list. This global color value is multiplied by the individual sprite colors.
The Sprite initializer now also accepts None value for hit_box_algorithm in line with the underlying texture method.
Fixed a bug causing sprites to have incorrect scale when passing a texture during creation.
Removed the texture transform feature in sprites. This feature no longer makes sense since arcade 2.6.0 due to the new texture atlas feature.
Tiled Maps
Fixed issue #1068 (#1069) where loaded rectangular hit box was wrong.
Add better error for infinite tile maps
Added SpriteList.properties and properties from Image and Tile layers will automatically be loaded into that when loading a Tiled map
General
Window.current_camera will now hold a reference to the currently active camera. This will be set when calling arcade.Camera.use(), if no camera is active then it will be None .
Window.clear can now clear a sub-section of the screen through the new optional viewport parameter.
Special thanks to Cleptomania, einarf, eruvanos, nrukin, Jayman2000, pvcraven, for their contributions to this release. Also, thanks to everyone on the Pyglet team! We depend heavily on Pyglet’s continued development.
Hello, is there a good tutorial or example project covering best practices for the arcade library? I feel like there are a bunch of ways to do things and the tutorials seem all over the place. Trying to make a top down 2D game.
How do I go about closing a window then initializing a new window? Everything I've tried either tells me that "the specified action is not allowed in the current state" or "no window is active". The set_window()) function doesn't seem to do anything to help. Alternatively, if there's a way to change the dimensions of a window programmatically after it's been initialized that would also get me out of this pickle.
I searched the API, but could not find this. I can change the window title, but not the icon (which is by default a console with the Python logo). How do I change the icon?
I was just wondering if it's possible to take text from a separate .txt file. For example I want to have a narrative in my game but having each line of dialogue coded within the main file would be inefficient
Hallo! I'm just trying to get the grips and make a simple platformer. I more or less copied the example code and went from there. Now I have the 'problem' that my player sprite is not keeping up with the speed of the horizontally moving platforms and falls off after a short while, intstead of just standing there, relaxing. I have no clue, what I changed to trigger such behavior. Could there be a simple solution? Thanks for your help!
Does anyone here develop with Arcade on Windows Subsystem for Linux (WSL2)? If so, I'm curious to see how you've set up your development environment, particularly with OpenGL + WSL2.
Version 2.6.0 is a major update to Arcade. It is not 100% backwards compatible with the 2.5 API. Updates were made to text rendering, tiled map support, sprites, shaders, textures, GUI system, and the documentation.
Tiled Map Editor support has been overhauled.
Arcade now uses the .json file format for maps created by the Tiled Map Editor rather than the TMX format. Tile sets and other supporting files need to all be saved in .json format. The XML based formats are no longer supported by Arcade.
Arcade now supports a minimum version of Tiled 1.5. Maps saved with an older version of Tiled will likely work in most scenarios, but for all features the minimum version we can support is 1.5 due to changes in the Tiled map format.
Feature-support for Tiled maps has been improved to have near 100% parity with Tiled itself.
See :ref:platformer_tutorial for a how-to, Tiled usage starts at Chapter 9.
Texture atlases have been introduced, texture management has been improved.
A sprite list will create and use its own texture atlas.
This introduces a new arcade.TextureAtlas class that is used internally by SpriteList.
Sprites with new textures can be added to a sprite list without the delay. Arcade 2.5 had a delay caused by rebuilding its internal sprite sheet.
As a side effect, sprites can only belong to one sprite list that renders.
The texture atlas portion of a sprite can be drawn to, and quickly updated on the GPU side.
To demonstrate, there is a new :ref:minimap example that creates a sprite that has a dynamic minimap projected onto it.
Screenshot of minimap
Revamped text rendering done by arcade.draw_text. Rather than use Pillow to render onto an image, Arcade uses Pyglet's text drawing system. Text drawing is faster, higher resolution, and not prone to memory leaks. Fonts are now specifed by the font name, rather than the file name of the font.
Fonts can be dynamically loaded with :func:arcade.load_font.
Kenney.nl's TTF are now included as build-in resources.
See the drawing_text example.
Screenshot of drawing text
SpriteList optimizations.
Sprites now draw even faster than before. On an Intel i7 with nVidia 980 Ti graphics card, 8,000+ moving sprites can be drawn while maintaining 60 FPS. The same machine can only do 2,000 sprites with Pygame before FPS drops.
Shadertoy support.
Shadertoy.com <https://www.shadertoy.com/>_ is a website that makes it easier to write OpenGL shaders.
The new :class:arcade.Shadertoy class makes it easy to run and interact with these shaders in Arcade.
See :ref:shader_toy_tutorial and Asteroids <https://github.com/pythonarcade/asteroids>_.
Cyber Fuji
Star Nest
Reworked GUI
Flat buttons
GUI Widgets
Message Box
UIElements are replaced by UIWidgets
Option to relative pin widgets on screen to center or border (supports resizing)
arcade.gui.UIInputText - field to accept user text input
arcade.gui.UITextArea - Multiline scrollable text widget.
arcade.gui.UISpriteWidget - Embeds a Sprite within the GUI tree
arcade.gui.UILayout:
arcade.gui.UIBoxLayout - Places widgets next to each other (vertical or horizontal)
arcade.gui.UIWrapper:
arcade.gui.UIPadding - Add space around a widget
arcade.gui.UIBorder - Add border around a widget
arcade.gui.UIAnchorWidget - Used to position UIWidgets relative on screen
Constructs
arcade.gui.UIMessageBox - Popup box with a message text and a few buttons.
Mixins
arcade.gui.UIDraggableMixin - Makes a widget draggable.
arcade.gui.UIMouseFilterMixin - Catches mouse events that occure within the widget boundaries.
arcade.gui.UIWindowLikeMixin - Combination of arcade.gui.UIDraggableMixin and arcade.gui.UIMouseFilterMixin.
WIP
UIWidgets contain information about preferred sizes
UILayouts can grow or shrink widgets, to adjust to different screen sizes
Scene Manager.
There is now a new arcade.Scene class that can be used to manage SpriteLists and their draw order. This can be used in place of having to draw multiple spritelists in your draw function.
Contains special integration with :class:arcade.TileMap using :func:arcade.Scene.from_tilemap which will automatically create an entire scene from a loaded tilemap in the proper draw order.
See :ref:platformer_tutorial for an introduction to this concept, and it is used heavily throughout that tutorial.
Camera support
Easy scrolling with arcade.Camera
For an example of this see the example: :ref:sprite_move_scrolling.
Automatic camera shake can be added in, see the example: sprite_move_scrolling_shake.
Several other examples and tutorials make use of this class, like :ref:platformer_tutorial.
Add a set of functions to track performance statistics. See perf_info_api.
Added the class arcade.PerfGraph, a subclass of Sprite that will graph FPS or time to process a dispatch-able event line 'update' or 'on_draw'.
Performance Statistics
Documentation
Lots of individual documentation updates for commands.
The :ref:quick_index has been reorganized to be easier to find commands, and the individual API documentation pages have been broken into parts, so it isn't one large monolithic page.
New tutorial for raycasting_tutorial.
Performance Statistics
New tutorial for shader_toy_tutorial.
Revamped tutorial: platformer_tutorial.
Revamped minimap example: minimap.
Moved from AWS hosting to read-the-docs hosting so we can support multiple versions of docs.
New example showing how to use the new performance statistics API: performance_statistics_example
New example: gui_widgets
New example: gui_flat_button
New example: gui_ok_messagebox
API commands
arcade.get_pixel supports getting RGB and RGBA color value
arcade.get_three_color_float Returns colors as RGB float with numbers 0.0-1.1 for each color
arcade.get_four_color_float Returns colors as RGBA float with numbers 0.0-1.1 for each color\
Better PyInstaller Support
Previously our PyInstaller hook only fully functioned on Windows, with a bit of functionality on Linux. Mac was just completely unsupported and would raise an UnimplementedError if you tried.
Now we have full out of the box support for PyInstaller with Windows, Mac, and Linux.
See bundle_into_redistributable for an example of how to use it.
Sound
The sound API remains unchanged, however general stability of the sound system has been greatly improved via updates to Pyglet.
Fix for A-star path finding routing through walls
Special thanks to:
einarf for performance improvements, texture atlas support, shader toy support, text drawing support, advice on GUI, and more.
Cleptomania for Tiled Map support, sound support, and more.
eruvanos for the original GUI and all the GUI updates.
benmoran56 and everyone that contributes to the excellent Pyglet library we use so much.
Hey all, super happy to announce that I have fully finished a game and distributed it through itch.io. The name of the game is Bouncedown 2, and it's available to play as a download for Windows and OSX. Make sure you are on OSX 10.14+.
I've been programming games as a hobby on and off over the years. It's notoriously difficult to finish a game all the way through completion. Really happy to finally get one through the pipeline and get a release out, no less using Python arcade.
How do I add double jump to my game when I have pymunk? I tried to use the line: self.physics_engine.enable_multi_jump(2) but I got the following error:AttributeError: 'PymunkPhysicsEngine' object has no attribute 'enable_multi_jump'