elliot | 19 May 06:30 2016
Picon

A numpy based data-oriented Entity-Component-System framework for pyglet


It's been a while since I've posted about this because my first prototype demonstrated the idea but was very awkward to actually use.  It turns out the best way to use a data-oriented approach that I found is an Entity-Component-System approach.  So, after much work, I now have a minimal numpy based ECS for y'all.  See the README of my repo for more information about what data oriented programing and ECS are.

Repo: https://github.com/Permafacture/data-oriented-pyglet

I could not figure a way to integrate this approach with the current pyglet batches and groups.  Thus, this is an alternative to pyglet batches and groups.  It provides a way to do all computationally expensive operations on batches, such as rendering, translation, changing animation frames, updating position based on velocity, updating acceleration based on forces, collisions, etc in a batched manner using vectorized operations on numpy arrays.

An interesting side-effect of this organization is that it makes multiprocessing much easier.  If I have physics running that results in updated positions and angles, and rendering which takes those positions and angles and translates polygons to render, the position and angle numpy arrays can sit in shared memory.  The physics and rendering processes can run independently in separate CPU threads.  My personal project using pymunk and pyglet went from 50 FPS on my low end laptop to 180 space steps per second for physics and 600 FPS for rendering using this model.  This is an extraordinary improvement and other situations are not improved by as much.  In single threaded examples, I find that the translation and other batched computations take an insignificant amount of time and rendering is the bottle neck.  Also, the shared memory is not yet implemented in the public repo.

The only requirements for the examples are pyglet and numpy.  Try it out and let me know what you think.  This is very alpha.

Thanks for reading,
  Elliot

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
Dan Liu | 13 May 18:01 2016
Picon

pyglet is wonderful

pyglet is so easy to use...

joystick lib is too useful !

wonderful and feel so good to use

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
magurp244 | 30 Apr 00:16 2016
Picon

Re: Pyglet culling destroys FPS

Adding/removing for ordering is unnecessary, you just need to enable depth testing and change the relevant textures z coordinates (between 1.0 to 0.0):

import pyglet
from pyglet.gl import *

class group(pyglet.graphics.OrderedGroup):
   
def set_state(self):
       
if self.order == 0:
            glBindTexture
(GL_TEXTURE_2D, texture.id)
       
elif self.order == 1:
            glBindTexture
(GL_TEXTURE_2D, texture2.id)

window
= pyglet.window.Window(640,480)

glEnable
(GL_DEPTH_TEST)

rendered_sprites
= []

batch
= pyglet.graphics.Batch()

batch_idle
= pyglet.graphics.Batch()

texture
= pyglet.image.load('test.png').get_texture()

texture2
= pyglet.image.load('test2.png').get_texture()

rendered_sprites
.append(batch.add(4, GL_QUADS, group(0),
                                 
('v3f/static', (0.0,0.0,0.0, 32.0,0.0,0.0, 32.0,32.0,0.0, 0.0,32.0,0.0)),
                                 
('t3f/static', texture.tex_coords)))

rendered_sprites
.append(batch.add(4, GL_QUADS, group(1),
                                 
('v3f/static', (16.0,0.0,0.0, 48.0,0.0,0.0, 48.0,32.0,0.0, 16.0,32.0,0.0)),
                                 
('t3f/static', texture2.tex_coords)))


<at> window.event
def on_draw():
    window
.clear()
    glEnable
(GL_TEXTURE_2D)
    batch
.draw()
    glDisable
(GL_TEXTURE_2D)

<at> window.event
def on_key_press(symbol,modifiers):
   
if symbol == pyglet.window.key.SPACE:
       
if rendered_sprites[1].vertices[2] == 0.0:
           
for a in xrange(2,12,3):
                rendered_sprites
[1].vertices[a] = 1.0
       
else:
           
for a in xrange(2,12,3):
                rendered_sprites
[1].vertices[a] = 0.0

pyglet
.app.run()

Pyglet also has multi-texturing support, if your inclined to use multiple textures per surface.

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
ZOnline | 28 Apr 03:25 2016
Picon

Pyglet culling destroys FPS

I searched previously and found a thread on culling off screen sprites for better performance. In the end, the guy suggested to simply set a sprites visible flag.

However, I have tried this and the performance is abysmal, making the game unplayable.

Here is my code:

class TileLayer(object):
   
def __init__(self):
       
self.group = pyglet.graphics.Group()
       
self.batch = pyglet.graphics.Batch()
       
self.sprites = []
       
self.cache = {}
       
   
def setInViewSprites(self):
       
""" Called everytime the camera bounds change, cache which sprites are in view and not in view, then change visibility """
        bounds
= viewService.getScreenBounds()

       
if not bounds in self.cache:
            inViewSprites
= []

           
for sprite in viewService.collideView(self.sprites):
                inViewSprites
.append(sprite)
           
           
self.cache[bounds] = inViewSprites

       
for sprite in self.sprites:
           
if not sprite in self.cache[bounds]:
               
if sprite.visible == True:
                    sprite
.visible = False
           
else:
               
if sprite.visible == False:
                    sprite
.visible = True


This seems super inefficient to me, but I can't think of any other way. In another library I could simply just keep a list of sprites in and out of view, and pass the list to the renderer for easy and quick removal of sprites.

However because of batching and groups, this doesn't seem possible. Any suggestions?

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
Christophe Pallier | 24 Apr 16:04 2016

audio crah (Pulseaudio)

Hello,

I am running Ubuntu 14.04

I unstalled the pygame-pyglet package which had a version dated from 2009 an ran 'pip install pyglet' to install a more up to date version of pyglet.

Now, the attached python script crashes when playing audio (while it worked with the 2009 version of pyglet)

Below is the console's output (with debug_media set to True):

I do not know if it is the origin of the probleme but I noticed the odd message "Error importing driver directsound: 'module' object has no attribute 'oledll'" (as I am running under linux).

chrplr <at> is151214:~/code/tests⟫ python test-pyglet-0.py
get_audio_data
Got an audio packet at 0.0
Got requested audio packet at 0.0
get_audio_data returning ts 0.000000 with events []
remaining events are []
get_audio_data
Got an audio packet at 0.09288
Got requested audio packet at 0.09288
get_audio_data returning ts 0.092880 with events []
remaining events are []
get_audio_data
Got an audio packet at 0.18576
Got requested audio packet at 0.18576
get_audio_data returning ts 0.185760 with events []
remaining events are []
get_audio_data
Got an audio packet at 0.278639
Got requested audio packet at 0.278639
get_audio_data returning ts 0.278639 with events []
remaining events are []
get_audio_data
Got an audio packet at 0.371519
Got requested audio packet at 0.371519
get_audio_data returning ts 0.371519 with events []
remaining events are []
get_audio_data
Got an audio packet at 0.464399
Got requested audio packet at 0.464399
get_audio_data returning ts 0.464399 with events []
remaining events are []
get_audio_data
Got an audio packet at 0.557279
Got requested audio packet at 0.557279
get_audio_data returning ts 0.557279 with events []
remaining events are []
get_audio_data
Got an audio packet at 0.650159
Got requested audio packet at 0.650159
get_audio_data returning ts 0.650159 with events []
remaining events are []
get_audio_data
Got an audio packet at 1.486077
Got requested audio packet at 1.486077
get_audio_data returning ts 1.486077 with events []
remaining events are []
get_audio_data
Got an audio packet at 1.578957
Got requested audio packet at 1.578957
get_audio_data returning ts 1.578957 with events []
remaining events are []
get_audio_data
Got an audio packet at 1.671837
Got requested audio packet at 1.671837
get_audio_data returning ts 1.671837 with events []
remaining events are []
get_audio_data
Got an audio packet at 1.764717
Got requested audio packet at 1.764717
get_audio_data returning ts 1.764717 with events []
remaining events are []
get_audio_data
Got an audio packet at 1.857596
Got requested audio packet at 1.857596
get_audio_data returning ts 1.857596 with events []
remaining events are []
get_audio_data
get_audio_data returning None
del avbin source
Error importing driver directsound:
'module' object has no attribute 'oledll'
context state cb
context state cb
context state cb
context state cb
Client version:  4.0.0
Server:          unix:/run/user/1000/pulse/native
Protocol:        28
Server protocol: 28
Local context:   Yes
write callback: 11024 bytes
packet 0.0
Traceback (most recent call last):
  File "source/callbacks.c", line 206, in 'calling callback function'
  File "/usr/local/lib/python2.7/dist-packages/pyglet/media/drivers/pulse/__init__.py", line 357, in _write_cb
    pa.pa_free_cb_t(0),  # Data is copied
SystemError: NULL result without error in PyObject_Call
stream ready
play
Traceback (most recent call last):
  File "test-pyglet-0.py", line 29, in <module>
    sound.play()
  File "/usr/local/lib/python2.7/dist-packages/pyglet/media/__init__.py", line 473, in play
    player.play()
  File "/usr/local/lib/python2.7/dist-packages/pyglet/media/__init__.py", line 1012, in play
    self._set_playing(True)
  File "/usr/local/lib/python2.7/dist-packages/pyglet/media/__init__.py", line 994, in _set_playing
    self._audio_player.play()
  File "/usr/local/lib/python2.7/dist-packages/pyglet/media/drivers/pulse/__init__.py", line 477, in play
    pa.pa_stream_success_cb_t(0), None)
SystemError: NULL result without error in PyObject_Call


--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
Attachment (test-pyglet-0.py): text/x-python, 624 bytes
Tristam MacDonald | 20 Apr 18:06 2016
Picon
Gravatar

Re: Wacom usage on osx

I don't know what Pyglet's support for tablets is like at the moment, but Wacom provides excellent documentation as to accessing tablet events on Mac:

http://www.wacomeng.com/mac/Developers%20Guide.htm

At this point I don't honk any mucking around in Carbon or HID is required. The standard Cocoa NSEvent object carries everything you need, which should make it easy to expose to pyglet.

On Wed, Apr 20, 2016 at 9:00 AM, Tristam MacDonald <swiftcoder <at> gmail.com> wrote:
Aren't the

On Wed, Apr 20, 2016 at 9:00 AM, Tristam MacDonald <swiftcoder <at> gmail.com> wrote:

On Wed, Apr 20, 2016 at 7:57 AM, future stack <futurestack <at> gmail.com> wrote:
Hello - I'm curious what the state of tablet support is on osx and if someone can provide me with an example of how to read pen pressure from a stylus?

I've attached my attempt from a few days ago, but I've been informed that my approach is wrong.

A friend linked me to this page:


which says that events are subscribeable via carbon or HID, but I can't find a working example of this anywhere.

I also found this:

but this requires wxwidgets to work, which is apparently still 32 bit, and downgrading my python to get this to work seems less than ideal.

Am I barking up the wrong tree(s)?   Any leads would be appreciated.

Andrew

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
future stack | 20 Apr 16:57 2016
Picon

Wacom usage on osx

Hello - I'm curious what the state of tablet support is on osx and if someone can provide me with an example of how to read pen pressure from a stylus?

I've attached my attempt from a few days ago, but I've been informed that my approach is wrong.

A friend linked me to this page:

https://github.com/jpaalasm/pyglet/blob/master/experimental/input/tablet-notes.txt#L37

which says that events are subscribeable via carbon or HID, but I can't find a working example of this anywhere.

I also found this:
https://bitbucket.org/AnomalousUnderdog/pythonmactabletlib/downloads

but this requires wxwidgets to work, which is apparently still 32 bit, and downgrading my python to get this to work seems less than ideal.

Am I barking up the wrong tree(s)?   Any leads would be appreciated.

Andrew

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
Attachment (wacom_tests.py): text/x-python, 3588 bytes
Charlie | 16 Apr 09:37 2016
Picon

Texture bleedthrough issues

I have been testing my game in just one resolution for quite a while.

Today I decided to change the resolution to something bigger to test out and to support more resolutions and see how they behave. I began to notice that tons of textures are bleeding through my tileset and animated textures. Sometimes they disappear if I zoom in, or move the character, sometimes they bleed on different sides, and sometimes the bleed disappears entirely. 

I have googled a ton on this but can't find any resolution. So I have checked the following:
Mipmap issue: Not using mipmapping
Issue with filtering: Changed pyglet to use GL_NEAREST not GL_LINEAR for textures. Not using AA or other sampling.
Texture coordinates are incorrect: I am assuming pyglet's are correct as I have not changed this.
Set clamping: Tried setting clamping in all of the places that set the min/mag_filter.
Camera is sampling floats: I've made sure to force camera movement in 1 pixel increments to make sure it doesn't get in-between a pixel.

I have checked all of these and the issue still remains. What am I missing?

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
saleem a | 14 Apr 00:05 2016
Picon

Fwd: Us congress hearing of maan alsaan Money laundry قضية الكونغجرس لغسيل الأموال للمليادير معن الصانع







 

موقع اليوتيوب الذي عرض فيديوهات جلسة استماع الكونجرس الأمريكي

 لمتابعة نشاطات غسل الأموال ونشاطات

 

السعودي معن عبدالواحد الصانع 

مالك مستشفى  وشركة سعد  ومدارس سعد بالمنطقة الشرقية بالسعودية   ورئيس مجلس ادارة بنك اوال البحريني

 

 وتعليق محطة سي ان بي سي التلفزيونية

 

مترجم باللغة العربية

 

US Congressional Hearing of

 Saudi billionaire" maan  Al Sanea "

 and Money Laundering  

with bank of America

 

With Arabic Subtitles

 

 

http://www.youtube.com/watch?v=mIBNnQvhU8s

 

 

 






















































--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
RedDevil91 | 7 Apr 13:17 2016
Picon

AVbin v5 64bit for windows

Hi!

I'm looking for the 64-bit version of Avbin 5 dll, but could not find it on the webpage. I need it for a codebase that relies on pyglet 1.1.4 where the python environment upgraded from 32 to 64-bit under win7. Tried pyglet 1.2.4 with Avbin 10, but it crashed the application.

Thanks,
RedDevil91

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
RedDevil91 | 5 Apr 12:04 2016
Picon

pyglet 1.2.4 crashes with RuntimeError

Hi!

I have the following issue.
After upgrading my toolchain from 32 bit to 64 bit I upgraded pyglet 1.1.4 to pyglet 1.2.4. After all my program (which uses pyglet video player) crashes with the following error

Caught exception in background:
Traceback (most recent call last):
 
File "c:\Users\Me\background_pyglet.py", line 88,
in _run_pyglet_thread
    event_loop
.run()
 
File "C:\Users\ext-bognara\AppData\Local\Continuum\Miniconda2\envs\pytch\lib\s
ite-packages\pyglet\app\base.py"
, line 131, in run
    platform_event_loop
.start()
 
File "C:\Users\ext-bognara\AppData\Local\Continuum\Miniconda2\envs\pytch\lib\s
ite-packages\pyglet\app\win32.py"
, line 95, in start
   
'thread that imports pyglet.app')
RuntimeError: EventLoop.run() must be called from the same thread that imports p
yglet
.app
Restarting background event loop


and stays in a forever loop. I tried to figure out what can cause the problem but I failed. My program remained the same only pyglet (and other modules) was upgraded.
I am working on a 64bit windows computer with 64bit python and pyglet uses avbin v8 64bit.
Can somebody tell me what causes the problem and why?

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Gmane