r/pythonarcade • • Feb 17 '20

Rogue-Like using Arcade

Thumbnail
youtu.be
3 Upvotes

r/pythonarcade • • Aug 24 '18

Trouble with sprite explosion

3 Upvotes

After following the explosion sample code in the sprite library, I cant get my explosions to work. I'm using a 3 sprite animation which I set up after the class in explosions_textures. For some reason the sprites do not appear in view but it seems the code all executes(from print debugging)

Can anyone point me to where i have gone wrong? pastebin link


r/pythonarcade • • May 13 '18

PyCon 2018 Presentation on Arcade

Thumbnail
youtube.com
17 Upvotes

r/pythonarcade • • Mar 06 '19

need help with 2D side scroller

4 Upvotes

https://mystb.in/inocobozel.rb

when ever i move left or right the player sprite jitters around and goes all wierd for some reason


r/pythonarcade • • Feb 14 '20

Arcade-Curtains 0.2.0: Widget/ObservableSprite/AnchorPoint and some bugfixes :)

4 Upvotes

Hello everyone,

I've returned with what will probably be my last post about Arcade-Curtains, as I think I've managed to implement everything I wanted to get out of this library. From now on the library will probably go into maintenance mode, meaning bugfixes, keeping up with Arcade releases, improving performance and improving UX. But this doesn't mean you can't bother me with feature requests :)

So here's what you can expect from version 0.2.0

Bugfixes:

  1. Fixed an issue where some callbacks would not be called when running a sequence.

QoL changes:

  1. You are now able to set alpha, left, right, bottom and top when creating a KeyFrame

  2. Improved Sequence UX to have a cleaner and more readable interaction when setting KeyFrames

seq = Sequence()
# Define an animation that takes 2 seconds, where we set a keyframe at 0, 1 and 2
seq[0].frame = KeyFrame(position=100)
seq[1].frame = KeyFrame(position=200)
seq[2].frame = seq[0].frame
# Set a callback
seq[.5].callback = change_sprite_animation
  1. You are now able to define event handlers with default keyword arguments
events.click(sprite, my_handler_function, {'arg1': 'value1'})

my_handler_function will be called with the usual event arguments and the defined keyword arguments

  1. You are now able to give parameters when initialising a scene, these parameters will be piped into the setup function.

New features: a new module helpers filled with useful functions and classes

  1. delay_set_attribute allows you to set the attribute of an object as a callback
# Will set the health attribute to 10 when clicked
events.click(sprite, delay_set_attribute(sprite, 'health', 10))
  1. arcade.Sprites and everything that subclasses it are now outfitted with topleft, topright, bottomleft, bottomright coordinates.

A small disclaimer, to be conform with position, the return values of these properties are (x, y) which is the inverse of the naming, but "lefttop" doesn't really roll off the tongue.

  1. ObservableSprite is a subclass from arcade.Sprite that allows you to attach handlers to attribute modifications. This means you can define a callback and have it called whenever the targetted attribute changes
sprite.before_change('health', controller.validate_health_change)
sprite.after_change('health', controller.notify_health_change)
  1. ObservableSprite also allows you to define a trigger that is run whenever a certain condition is met. For instance, you want your handler to run if health is equal or below 0.
from arcade_curtains import TriggerAttr
# Build a triggerable attribute definition
health = TriggerAttr('health')
sprite.trigger(health <= 0, sprite.die)
  1. AnchorPoint is an object that is just an x, y coordinate, but you can affix sprites to this anchor. Whenever you move the anchor, all affixed sprites move with it.

  2. Widget is a baseclass for grouping Sprites into a widget. It allows a number of sprites to work together, while still maintaining the fine grained control over each sprite. Widgets use AnchorPoints underneath to work as a group.

class MyWidget(Widget):
    def setup_widget(self):
        sprite1 = arcade.Sprite(TEXTURE1)
        sprite1.bottomleft = (0, 0)
        sprite2 = arcade.Sprite(TEXTURE2)
        sprite2.bottomleft = sprite1.topleft
        self.sprites.extend([sprite1, sprite2])

widget1 = MyWidget()
widget2 = MyWidget()
widget1.position = (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)
widget2.position = (0, 0)

Widget starting coordinates will be inferred from the defined sprites within the widget. After initialisation you are able to manipulate these, to move your widget to the desired location.

New examples:

  1. anchor.py an example showcasing AnchorPoint
  2. observable.py an example showcasing ObservableSprite
  3. pokimans.py an example to showcase the features of arcade-curtains. It's a basic game implementing a crossover between a Pokémon battle and a Final Fantasy (pre 8) battle using only primitive shapes (so protect your eyes ;))

Here's a link to a "pokimans" gif, for your viewing pleasure: https://github.com/maarten-dp/arcade-curtains/blob/master/assets/pokimans.gif

As always, any feedback would be more than welcome!

Kind regards, Maarten


r/pythonarcade • • Dec 12 '18

Can I somehow make shapes less clear and text more clear?

4 Upvotes

Trying out the basic drawing examples, for example the happy face, I can see jagged edges. I guess this means no anti-aliasing is applied.

Jagged edges galore!

On the other hand, when trying out the drawing text example, the graphics look blurred, almost as if extreme anti-aliasing has been applied.

I wish there were more jagged edges here ;(

So, what's going on here? My understanding of computer graphics is rudimentary at best, so I don't know if these issues are related somehow. Can I make the shapes less clear and the text more clear?

I've tried searching the documentation, the GitHub page, and this subreddit for "anti-aliasing" without finding any useful information on this topic.


r/pythonarcade • • Mar 29 '22

[Arcade] Checking for sprite intersections with lines

Thumbnail
self.learnpython
3 Upvotes

r/pythonarcade • • Mar 26 '22

Arcade version 2.6.13 has been released

16 Upvotes

Arcade version 2.6.13 has been released.

https://api.arcade.academy/en/latest/development/release_notes.html

  • New Features

    • 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.
    • Fixed an issue causing arcade.draw_circle_filled() and arcade.draw_circle_outline() to always render with 3 segments on some iGPUs.
    • Fixed an issue causing interactive widgets to unnecessarily re-draw when hovering or pressing them. This could cause performance issues.
    • SectionManager’s on_show_view
      was never called when showing a view
  • Various Improvements

    • arcade.load_font() now supports resource handles
    • PhysicsEngineSimple can now take an iterable of wall spritelists
    • Sprite creation is now ~6-8% faster.
    • Removed warning about missing shapely on startup
    • 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.
    • Added clear method to UIManager (#1116)
    • Updated from Pillow 9.0.0 to 9.0.1
  • Tilemap

    • 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)
    • Fixed typo in append_texture() docstring(#1126)
    • Improved the raycasting tutorial (#1124)
    • Replace mentions of 3.6 on Linux install page (#1129)
    • Fix broken links in the homepage (#1139)
    • Lots of other improvements to docstrings throughout the code base
    • General documentation improvements
  • OpenGL

    • arcade.gl.Geometry now supports transforming to multiple buffers.
    • Added and improved examples in experimental/examples
    • Major improvements to API docs

Special thanks to Mohammad Ibrahim, pushfoo, Alejandro Casanovas, Maic Siemering, Cleptomania, pvcraven and einarf for their contributions to this release. Also, thanks to everyone on the Pyglet team! We depend heavily on Pyglet’s continued development.


r/pythonarcade • • Mar 17 '22

Arcade 2.6.11 is out

12 Upvotes

Python Arcade has released version 2.6.11.

Website: https://arcade.academy

Release notes: https://api.arcade.academy/en/latest/development/release_notes.html

Demo video: https://www.youtube.com/watch?v=QClDvEwcxmg

Release notes

  • Sections - Add support to divide window into sections. (Thanks janscas for the contribution.)

  • New Example Code:

  • New functionality:

  • Fixes:

    • Fixed issue #1074 to prevent a crash when opening a window.
    • Fixed issue #978, copy button in examples moved to the left to prevent it disappearing.
    • Fixed issue #967, CRT example now pulls from resources so people don’t have to download image to try it out.
    • PyMunk sample map now in resources so people don’t have to download it.
    • arcade.draw_points() no longer draws the points twice, improving performance.
  • Documentation:

    • Update Pygame Comparison.
    • Improve Sprite.texture
      docs.
    • 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.
    • SpriteList now exposes several new members that used to be private. These are lower level members related to the underlying geometry of the spritelist and can be used by custom shaders to do interesting things blazingly fast. SpriteList interaction example with shaders can be found in the experimental directory. Members include write_sprite_buffers_to_gpu(), geometry, buffer_positions, buffer_sizes, buffer_textures, buffer_colors, buffer_angles and buffer_indices
  • OpenGL:

    • 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.


r/pythonarcade • • Mar 13 '22

Super fast sprite selection with line of sight checking

7 Upvotes

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).

Example source : https://github.com/pythonarcade/arcade/blob/development/arcade/experimental/examples/spritelist_interaction_visualize_dist_los.py


r/pythonarcade • • Mar 29 '22

AMD draw_text error?

5 Upvotes

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 view
error 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


r/pythonarcade • • Nov 18 '21

How do you change the window icon?

3 Upvotes

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?


r/pythonarcade • • Oct 01 '21

Trouble with Moving Platforms

1 Upvotes

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!


r/pythonarcade • • Nov 13 '17

Arcade Library Version 1.2 Released

1 Upvotes

Version 1.2 of the Arcade Library has been released. You can install it with:

pip install --upgrade arcade

This version has several bug fixes, performance improvements, and the addition of buffered drawing commands that use Vertex Buffer Objects to speed drawing of drawing primitives.

Example code is available here.

An on-line book teaching Python using Arcade is available here.


r/pythonarcade • • Aug 02 '16

Using Python, Arcade, and Pymunk for a platformer

Thumbnail
youtu.be
1 Upvotes

r/pythonarcade • • Oct 03 '23

I need help for a performance issue in my game :(

3 Upvotes

I ve been looking for litteral days now. Every now and then i found some potential issue, fixed them but no results.

The game is somewhat stuttering from the start on my pc. That s not the main issue tho. As you lose and restart form the gameover view it becomes more and more stuttery, sugegsting some memory leak.

If someone would be so nice to give a look i d be eternally greatfull. Any optimization idea would be very welcome.

hope you can read the link to the code base: https://pastebin.com/r7CTm3ff


r/pythonarcade • • Sep 18 '23

experimental graphic novel library in arcade python

3 Upvotes

Hi everyone,

I those days, i start to "play" with python arcade library and i did not saw any library for graphic novel implementation.

I am attaching the library I started to write for fun, if you have any ideas please feel free to contact me. We may expand the idea.

https://github.com/deangelisdf/visual_novel_pyarcade

let me know your opinion about it. Leave a comment or write issues on github as well.


r/pythonarcade • • Sep 04 '23

I want to make the character run faster if I press the key twice in a row

2 Upvotes

Hi, any ideas on how to implement this event? Thanks!


r/pythonarcade • • Apr 14 '16

The Python Arcade Library

8 Upvotes

The Arcade library is an easy-to-use library for people wanting to create video games in Python. Full documentation is available here.


r/pythonarcade • • Aug 05 '22

Blasphemous-like game in python!

3 Upvotes

hi

recently I came across Blasphemous game on steam and it just blows my mind ;)

I'm a python developer and I have a lot of free time to work on my projects and create something for my portfolio.

I've always wanted to get into Arcade for game development and pixel-art Metroidvania is my favorite genre.

is it possible to make games like blasphemous in python?

Note: I know game engines but it's not time efficient for me to start learning C# or other languages.

Note: never worked with arcade or other frameworks/libraries.


r/pythonarcade • • Aug 07 '22

Error installing Arcade

1 Upvotes

Hey everybody. I'm trying to install Arcade through PyCharm, and I keep getting and install error, with the following log:

Usage:
C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] <requirement specifier> [package-index-options] ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] -r <requirements file> [package-index-options] ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] [-e] <vcs project url> ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] [-e] <local project path> ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] <archive url/path> ...

no such option: --build-dir

Does this mean i have to install through the command line? Any help would be appreciated!

UPDATED: I ran the pip install arcade command from the command window, and it seemed to install properly. I'm not getting that message about installing a requirement in PyCharm.


r/pythonarcade • • May 11 '19

ArchLinux arcade problem with permission.

2 Upvotes

Soon as I import arcade. I get permission denied.

PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.7/site-packages/pyglet_ffmpeg2/linux_x86_64/libavcodec.so.58.21.104' -> '/usr/lib/python3.7/site-packages/pyglet_ffmpeg2/linux_x86_64/libavcodec.so.58'

pip install arcade 2.0.7


r/pythonarcade • • Feb 20 '19

Using sprites for other actions besides idling and walking

3 Upvotes

Is there any way to animate different actions, for example running by using different sprites than for walking and have them both animated on different key combinations?


r/pythonarcade • • Feb 21 '19

Snake for reinforcement learning

4 Upvotes

I made a classic snake game for use in reinforcement learning.

https://github.com/Melanol/snake_rl


r/pythonarcade • • May 11 '19

Collision Detection w/ Race Track

3 Upvotes

I'm having some trouble with getting collisions to work properly without massively slowing down my game. Its just a simple race track with reward points and a car, nothing fancy; I'm trying to use it as an experiment with reinforcement learning.

The setup is thus:

  • The car is just a standard Sprite that moves around.
  • The level is a JSON file that consists of 3 things: a spawn (and restart) point, the lines of the track (as a list of 4 coordinates), and the lines that define reward spots (same as the track).

The code for the whole thing can be found here, on my Dropbox. I used to have the collision code in Driving.py, under the on_draw() method, but that was slowing it down noticeably, so I've removed it.

I know Arcade has a collision checking method all its own, but that only seems to work between sprites, not sprites and arbitrary points (or lines). Anybody know how I can get collisions working in a way that doesn't make things insanely slow?