Charles Joseph Christie II | 1 Apr 2007 22:46
Picon

Re: Firing bullets

This is what I want to do but I'm kinda confused on how to do it, and
then use it to make at least a simple pattern.

On Wed, 28 Mar 2007 23:27:50 -0700
"andrew baker" <failrate@...> wrote:

> I always like to fill a list full of bullet sprites to pull from when
> a character is firing and to return to when they are "dead".  This
> saves a lot of processing power, because you are performing less
> instantiation and destruction.  The trade-off is in memory, but this
> shouldn't be significant.  The only other thing I would mention is to
> make sure that the bullets in the bullet sprite queue are not calling
> their update, as they are inactive until fired.
> 
> On 3/28/07, Damien Miller <djm@...> wrote:
> > On Mon, 26 Mar 2007, Charles Christie wrote:
> >
> > > Well, I'm trying to get my program to fire bullets now. Isn't
> > > that great?
> > >
> > > I think I'm doing it all wrong though...
> > >
> > > My problem has been that I don't know how to make the program
> > > fire bullets. But then I thought, "shouldn't the character be
> > > firing the bullets, not the program?" and it's then that I
> > > realized why I couldn't do anything. My logic has been completely
> > > wrong. Again. Go figure <_<
> > >
> > > Well, I still don't have images for characters yet and I still
> > > have no movement code (I should probably work on that, huh?) but
(Continue reading)

andrew baker | 2 Apr 2007 00:51
Picon

Re: Firing bullets

Well, I start by making a container, which will be just a simple list

bullets = []

This is assuming the simple case, where all of the bullets are the same type.

Then, create a bunch of bullets

for i in range(0, totalBullets):
    bullets.append(myBulletClass())

When you need a bullet,

firedBullet = bullets.pop()

When that bullet "dies",

bullets.append(firedBullet)

You might want to make the bullets list into a whole class if you
start adding features, but for most cases, this is all the firepower
you'll need.

As for patterns, I would do macros, personally.

Declare different functions that do small patterns

def starBurst(qty):
      angleSlice = 360/qty
      for i in range(0, qty-1):
(Continue reading)

René Dudfield | 2 Apr 2007 09:35
Picon
Gravatar

Re: Python bots in Galcon (or your game!) safe_eval

Hi,

One further step you could take would be running the bots as separate
processes with lower OS level privileges, or sandbox.

So with unix you could then use ulimit to limit files opened, memory
used, etc etc.  Type ulimit -a to see a list of things you can change.

The process would need some way to talk, however since you are already
using networking to communicate this should be easy.

This would help reduce the chance of denial of service attacks through
cpu use, and memory use.

Chroots(unix), and jails(*bsd) would be possible... but maybe a little
bit too much effort.  I'm not sure what facilities are available on
windows... but I'm sure there is something you can do to limit what a
process can do.

Cheers,

On 3/8/07, Phil Hassey <philhassey@...> wrote:
> Hey,
>
> I spent some time today working on building a safe_eval function that would
> make it "safe" to run user submitted bots in games (Galcon, being that game
> ;)
>
> http://www.imitationpickles.org/tmp/safe.py
>
(Continue reading)

Charles Christie | 2 Apr 2007 17:50
Picon

Re: Firing bullets

Ha! That makes things much easier to take in. So I was doing it partially right.  Thanks for the insight! You're a lifesaver.

The pygame mailing list is really great... I don't know what I'd do without you guys!

On 4/1/07, andrew baker <failrate-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Well, I start by making a container, which will be just a simple list

bullets = []

This is assuming the simple case, where all of the bullets are the same type.

Then, create a bunch of bullets

for i in range(0, totalBullets):
    bullets.append(myBulletClass())

When you need a bullet,

firedBullet = bullets.pop()

When that bullet "dies",

bullets.append(firedBullet)

You might want to make the bullets list into a whole class if you
start adding features, but for most cases, this is all the firepower
you'll need.


As for patterns, I would do macros, personally.

Declare different functions that do small patterns

def starBurst(qty):
      angleSlice = 360/qty
      for i in range(0, qty-1):
           current = bullets.pop()
           current.movingX = math.cos (angleSlice*i)*current.maxSpeed
           current.movingY = math.sin(angleSlice*i)*current.maxSpeed

Then, assign and object's fire function to the value of the function

myBadGuy.attack = starBurst

Now, when you call myBadGuy.attack(), your starBurst function will be called.

Diego Essaya | 3 Apr 2007 18:47
Picon

new Pygame-based framework: qxp

Hi all, I have just uploaded a new, small game framework based on Pygame:

http://www.qb9.net/qxp/

We use it here at QB9 for quick prototyping, and I hope that it will
grow until some day it is suitable for commercial games.

Please, tell me what you think about it.  If you feel that the
pygame-users list is inappropriate, you can send me a private mail,
and eventually I can open a separate mailing list / forum.

Best regards,
Diego

Charles Christie | 3 Apr 2007 19:13
Picon

Re: new Pygame-based framework: qxp

Sounds pretty cool... What, specifically, have you done that's different than pygame?

On 4/3/07, Diego Essaya < dessaya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi all, I have just uploaded a new, small game framework based on Pygame:

http://www.qb9.net/qxp/

We use it here at QB9 for quick prototyping, and I hope that it will
grow until some day it is suitable for commercial games.

Please, tell me what you think about it.  If you feel that the
pygame-users list is inappropriate, you can send me a private mail,
and eventually I can open a separate mailing list / forum.

Best regards,
Diego

DR0ID | 3 Apr 2007 19:27
Picon
Favicon

Re: new Pygame-based framework: qxp

Diego Essaya schrieb:
> Hi all, I have just uploaded a new, small game framework based on Pygame:
>
> http://www.qb9.net/qxp/
>
> We use it here at QB9 for quick prototyping, and I hope that it will
> grow until some day it is suitable for commercial games.
>
> Please, tell me what you think about it.  If you feel that the
> pygame-users list is inappropriate, you can send me a private mail,
> and eventually I can open a separate mailing list / forum.
>
> Best regards,
> Diego
>
Hi

'-inf' in fps.py, line 25, does not work on all platforms!!! On my winxp 
it does not work, I just have replaced it with -100000 instead.

Looks good otherwise.

~DR0ID

Diego Essaya | 3 Apr 2007 19:26
Picon

Re: new Pygame-based framework: qxp

That's a good question =)

Basically I have had some problems with the Sprite class.  It is
likely that I didn't understand it, but I found difficult to have a
changing background below a sprite, and I wasn't comfortable with the
grouping mechanism.  So I implemented my Widget class. Sprite and
Widget are similar classes, so maybe we can have Widget subclass
Sprite in the future...

Then I found that I was implementing the same main loop in all my
games, so I added it to the engine.  Then I wrote some commonly used
widgets.  Then I added an animations system borrowed from Panda3D.

Except for the Widget class, I wouldn't say that qxp makes things
differently than Pygame, it just implements some shortcuts.

On 4/3/07, Charles Christie <sonicbhoc@...> wrote:
> Sounds pretty cool... What, specifically, have you done that's different
> than pygame?
>
>
> On 4/3/07, Diego Essaya < dessaya@...> wrote:
> > Hi all, I have just uploaded a new, small game framework based on Pygame:
> >
> > http://www.qb9.net/qxp/
> >
> > We use it here at QB9 for quick prototyping, and I hope that it will
> > grow until some day it is suitable for commercial games.
> >
> > Please, tell me what you think about it.  If you feel that the
> > pygame-users list is inappropriate, you can send me a private mail,
> > and eventually I can open a separate mailing list / forum.
> >
> > Best regards,
> > Diego
> >
>
>

Horst JENS | 3 Apr 2007 21:18
Picon
Gravatar

Re: new Pygame-based framework: qxp

> Please, tell me what you think about it.  

I think it is very cool. All tutorials work (tested with ubuntu edgy).

-Horst

Mark Mruss | 3 Apr 2007 20:31
Picon

Re: new Pygame-based framework: qxp

I have not tried it out yet but I went over the tutorials and it looks
pretty slick.  Too bad you didn't release it before pyweek!  I would
have used it in my entry for sure!

mark.

On 4/3/07, Diego Essaya <dessaya@...> wrote:
> Hi all, I have just uploaded a new, small game framework based on Pygame:
>
> http://www.qb9.net/qxp/
>
> We use it here at QB9 for quick prototyping, and I hope that it will
> grow until some day it is suitable for commercial games.
>
> Please, tell me what you think about it.  If you feel that the
> pygame-users list is inappropriate, you can send me a private mail,
> and eventually I can open a separate mailing list / forum.
>
> Best regards,
> Diego
>


Gmane