Re: [pygame] Physics, collision detection etc?

2008-10-11 Thread Peter Gebauer
Yo René!

Indeed, it would be nice to see a Python extension for this. I still think 
it'd be nice to use Zhang Fan's wonderful code, it has the basic concepts 
there, just needs that extra to become a collision testing library as well.
From what I understand from Zhang Fan the plan was to provide full 
collision testing capabilities, but there wasn't any time left.

Before the wishlist grows too large, let's just see if we can summarize what 
functions are needed for polygon and plane tests.

/Peter

On 2008-10-10 (Fri) 07:10, René Dudfield wrote:
 hi,
 
 it'd be cool if we also had a good kdtree implementation for spatial
 stuff too :)  For cases when we had say 1000 objects or so.
 
 note, the wikipedia entry has a basic implementation in python
 http://en.wikipedia.org/wiki/Kd-tree
 
 There's also some quadtree python code lying around if you needed
 it(see cookbook).  However, maybe even a simple grid will be better
 for you.
 
 
 cu,
 
 
 On Fri, Oct 10, 2008 at 2:46 AM, Peter Gebauer
 [EMAIL PROTECTED] wrote:
  Hello René.
 
  The thing is, in a large world spanning 16000x1 pixels that will be a
  huge mask. Even if I reduce the resolution of the mask alone it will be
  either top inprecise or still too large.
 
  I don't want to write for OpenGL alone even though the plan is to use OpenGL
  as test output. My plan is to build a large world of 3 or 4-sided
  convex polygons that could be used to detect colliding with large shapes in
  that world.
 
  The best way to do this is probably to expose some of Zhang Fan's physics
  code, much of the math involved is already there, it just lacks
  non-rectangular shapes and a nice Python API to access it.
 
  /Peter
 
  On 2008-10-09 (Thu) 11:41, René Dudfield wrote:
  hi,
 
  Note, that you can find contact normals with the mask module. See mask 
  example.
 
  For some types of games, per pixel collision detection is fast enough.
   It uses rect bounding boxes as a first pass, so mostly it's not much
  slower than rect collision detection.  Assuming you are working in 2d,
  and you cache the mask(not regenerating it every frame) that is.
  However the mask.from_surface routine is fairly fast, it could do with
  some more optimization.
 
  For opengl, it'd be interesting to do it in a shader too... since then
  you could just reuse your drawing routines to draw your
  objects(sprites) into a buffer (each with a different color), then use
  a shader to find all of the contact normals.  That way your collision
  could be pixel perfect, even with different methods of
  drawing(cartoon, glow, and other shaders) where the polygon
  representation is not correct.
 
 
  cheers,
 
 
 
 
  On Wed, Oct 8, 2008 at 9:46 PM, Greg Ewing [EMAIL PROTECTED] wrote:
   Nirav Patel wrote:
  
   If the polygons are Surfaces or can be turned into Surfaces, they can
   be turned into Masks to do pixel collision.
  
   On Tue, Oct 7, 2008 at 11:21 AM, Peter Gebauer
   [EMAIL PROTECTED] wrote:
  
Yep, but as I said, I need to find colliding polygons, not pixels.
  
   Pixel collision isn't suitable for all purposes,
   e.g. if you need to find contact normals for
   physics calculations.
  
 
 
 


[pygame] working with blobs

2008-10-11 Thread Kurt Yoder
Hi all,

I've been creating blobs in a cartesian grid system manually up until
now, but I wonder if there is an easier way to do it? Does pygame include
a method of merging geometric objects, finding their inside/outside,
finding the half-way point between opposite sides, etc? If not pygame,
perhaps some other python library?

Thanks,

-Kurt



[pygame] Blended tile systems

2008-10-11 Thread Knapp
I do a lot of work in Blender3d and very often I make textures by
using 3 textures of different sizes. One is the basic look, say a
square of grass. Then the next to are blurry cloud like shadow things.
The last is used for the normals but all that means is shading based
on the light angle.

So my question is has anyone ever made a basic 2d tile game this way?
You would end up with tiles that were much more natural looking an
much less tilish.

This is a animation I made this week using this technique for the
grass. See how there are almost no seen seams? If you look close you
will see a bit of repeat but not much. It is also totally  flat. The
hills are nothing but shading done with the 2 extra textures.

http://www.youtube.com/watch?v=Hn91J1YwikAfeature=related
If you go to my area you can find a bunch of other night walker vids
with the same grass.

So has anyone ever tried this 2d with a tile system?

-- 
Douglas E Knapp

http://sf-journey-creations.wikispot.org/Front_Page


[pygame] Pixel placement and resize

2008-10-11 Thread KKarasu

hello.
Im doing this project of a biology dispersion simulator.
Using a matrix(of 0 n 1 in a rows) i want to each value correspond to a 
pixel, in case of zooming in or out groups of 4 or 6 pixels.


I was planing using tkinter for the interface, buttons n canvas and 
menus n sutch, but i cannot find a way to use pixel placement on canvas.

I wanted something simple as put_pixel(x,y,collor).

I couldnt find a way to do that.(anythoughts about that?)
So, has pygame got that kind of stuff?
if so can i implement a tkinter interface with a pygame window in a 
canvas of it?