Flint Particle System Forum - Starfield Generation Sun, 13 Jun 2010 07:06:50 +0100 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.4 & Feed Publisher Starfield Generation http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=192#Comment_192 http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=192#Comment_192 Fri, 06 Jun 2008 02:40:31 +0100 britg
Here is the how it will be used:
- the game is a space shooter
- the player's ship is stationary in the center of the screen
- movement is simulated by the startfield reacting to user-input (i notice v1.0.3 was just released with keyboard events)

I have actually written my own code for this but I have a distinct feeling it's not up to par as it maxes out my cpu while moving! haha.

I don't necessarily want to know "how do I do this" as I enjoy writing the code and learning a tool. Simply, in your qualified opinion, is this the correct tool to get started with? Is there another tool out there that is better?

Thanks in advance! ]]>
Starfield Generation http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=194#Comment_194 http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=194#Comment_194 Fri, 06 Jun 2008 07:51:13 +0100 Richard Starfield Generation http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=195#Comment_195 http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=195#Comment_195 Fri, 06 Jun 2008 14:09:27 +0100 britg Starfield Generation http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=197#Comment_197 http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=197#Comment_197 Sun, 08 Jun 2008 16:15:35 +0100 britg
I image that if there isn't a solution already in place, that I should modify the KeyDownCounter to accept an array of keys?


public function KeyDownCounter(counter:Counter, keys:Array, stage:Stage)
...


Am I conceptualizing this correctly? ]]>
Starfield Generation http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=198#Comment_198 http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=198#Comment_198 Mon, 09 Jun 2008 06:07:47 +0100 britg
- went with a Steady() counter
- added a Move() action
- added a TargetVelocity() action instead of a Velocity() initializer
- updated the TargetVelocity during the game loop and fed it x and y velocities
- paused the emitter if x and y velocity go to 0

This all worked better than the KeyDown classes because the ship may still be drifting when a key is not pressed.

I have to say Richard, this is a great framework you've got going here! Here's the result of about 2 days of playing - still a few quirks but overall it runs well and was easy to implement:
http://ss.as3gaming.com/spacesurvivor.html

A couple of issues - can't figure out how to 'run ahead' when no Velocity initializer is in place, but to be honest I haven't tried very hard. Have any thoughts on that?

Also, I placed a MultiZone comprised of 4 LineZones around the edges of the game screen so that stars can be generated from anywhere based on the velocity vector. I'm afraid though that this may be inefficient, because only 2 zones at most are producing visible particles, whereas the other 2 are creating particles that are immediately DeathOffStaged(). Is this a valid concern, and do you know of a better way of doing it?

Again, thanks for sharing this great library. ]]>
Starfield Generation http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=199#Comment_199 http://flintparticles.org/forum/comments.php?DiscussionID=38&Focus=199#Comment_199 Mon, 09 Jun 2008 07:54:18 +0100 Richard can't figure out how to 'run ahead' when no Velocity initializer is in place, but to be honest I haven't tried very hard. Have any thoughts on that?

I assume this is about filling the screen with stars at the start. The run ahead simply calculates and applies a number of frames based on the current settings. If you tell it the ship is moving - whatever the effects of that are - then the stars should move accordingly (and instantaneaously, so you don't see the movement.

However, a better option may be to operate the emitter in two phases. The first phase uses a position initializer using a rectangle zone covering the stage and a blast counter to create a number of particles. You call start on this emitter, causing the particles to be created and placed randomly over the stage. then you change to phase 2 - change the counter to a steady counter and change the zone on the position initializer to the four lines around the stage, so now the system works as you've designed.

I placed a MultiZone comprised of 4 LineZones around the edges of the game screen so that stars can be generated from anywhere based on the velocity vector. I'm afraid though that this may be inefficient, because only 2 zones at most are producing visible particles, whereas the other 2 are creating particles that are immediately DeathOffStaged(). Is this a valid concern, and do you know of a better way of doing it?

I don't think it's of great concern - you don't seem to be having any speed issues. Also, it's worth noting that a DeathZone with a rectangle the size of the stage is a lot more efficient than a DeathOffStage, so if you have speed issues switching to a DeathZone would be the first thing to change. ]]>