00:00
00:00
Newgrounds Background Image Theme

picapip just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

as3 enemy code structure

489 Views | 15 Replies
New Topic Respond to this Topic

as3 enemy code structure 2015-08-09 00:07:26


is there any enemy code structure that make multiple enemy spawn with less lag?

Response to as3 enemy code structure 2015-08-09 12:29:17


What code are you currently using to spawn enemies that's causing the apparent lag?

Response to as3 enemy code structure 2015-08-10 00:17:55


If the lag caused by frequently spawning and removing enemies, you could try using object pooling

Response to as3 enemy code structure 2015-08-10 01:00:26


At 8/10/15 12:17 AM, Dustmasc wrote: If the lag caused by frequently spawning and removing enemies, you could try using object pooling

any example on how to use object pooling?

Response to as3 enemy code structure 2015-08-10 13:25:40 (edited 2015-08-10 13:36:08)


Split the mobs to be loaded on multiple frames.
Say, you want to load 1000 enemies, you split them to add 100 enemies on 10 frames instead of all of them in a single frame. But you'll need to change your code a lot for that.

There'll stil be possibility of having lower framerate due to having too many enemies on the screen. But that's on another topic.

Response to as3 enemy code structure 2015-08-10 13:56:04 (edited 2015-08-10 13:56:41)


At 8/10/15 01:25 PM, Knight52 wrote: There'll stil be possibility of having lower framerate due to having too many enemies on the screen. But that's on another topic.

but that is my problem! the lower rate! :(

Response to as3 enemy code structure 2015-08-10 14:54:47


No. The answer is no. Nothing will work in AS3. Everyone who gets things working is just a miserable cocksucking shit. None of this is real. Nothing is real. Everything is a fucking mess. You don't even exist. Fuck off.

Response to as3 enemy code structure 2015-08-10 19:07:30


At 8/10/15 01:00 AM, cuteboy99 wrote:
At 8/10/15 12:17 AM, Dustmasc wrote: If the lag caused by frequently spawning and removing enemies, you could try using object pooling
any example on how to use object pooling?

first google link

but that is my problem! the lower rate! :(

this makes it sound like it's not the spawning of enemies, it's having many enemies at once that's the problem. Object pooling only helps with spawning and removing enemies.

Response to as3 enemy code structure 2015-08-11 00:05:51


At 8/10/15 02:54 PM, soupflavoredsoup wrote: No. The answer is no. Nothing will work in AS3. Everyone who gets things working is just a miserable cocksucking shit. None of this is real. Nothing is real. Everything is a fucking mess. You don't even exist. Fuck off.

u mad bro?

Response to as3 enemy code structure 2015-08-11 00:08:34


At 8/10/15 07:07 PM, Dustmasc wrote: this makes it sound like it's not the spawning of enemies, it's having many enemies at once that's the problem. Object pooling only helps with spawning and removing enemies.

I will check it out thanks hope it works!

Response to as3 enemy code structure 2015-08-11 02:16:49


At 8/11/15 12:08 AM, cuteboy99 wrote:
At 8/10/15 07:07 PM, Dustmasc wrote: this makes it sound like it's not the spawning of enemies, it's having many enemies at once that's the problem. Object pooling only helps with spawning and removing enemies.
I will check it out thanks hope it works!

I've yet to use it but Adobe Scout (it's free) breaks down your game and will show you what things are causing lag and where. Like I said I haven't used it before so I don't know how difficult it is setting it up with your project but if you are still having difficulties it could be worth a try :)

Response to as3 enemy code structure 2015-08-11 02:29:10


At 8/11/15 02:16 AM, Hero101 wrote:

where. Like I said I haven't used it before so I don't know how difficult it is setting it up with your project but if you are still having difficulties it could be worth a try :)

to be honest, my project is all about trail and error process! I am not an expert! so It not hurt try this way!

Response to as3 enemy code structure 2015-08-11 12:08:24


At 8/10/15 01:25 PM, Knight52 wrote: Split the mobs to be loaded on multiple frames.
Say, you want to load 1000 enemies, you split them to add 100 enemies on 10 frames instead of all of them in a single frame. But you'll need to change your code a lot for that.

There'll stil be possibility of having lower framerate due to having too many enemies on the screen. But that's on another topic.

If you're developing a game with the Flash IDE, which isn't a good idea because it's a suite intended for animation not game development, you should not be using frames; frames are for animation, not separating logic.

Response to as3 enemy code structure 2015-08-11 12:15:39


At 8/11/15 12:08 PM, Diki wrote: If you're developing a game with the Flash IDE, which isn't a good idea because it's a suite intended for animation not game development, you should not be using frames; frames are for animation, not separating logic.

I don't understand! what is Flash IDE?!

Response to as3 enemy code structure 2015-08-11 12:24:22


At 8/11/15 12:15 PM, cuteboy99 wrote:
At 8/11/15 12:08 PM, Diki wrote: If you're developing a game with the Flash IDE, which isn't a good idea because it's a suite intended for animation not game development, you should not be using frames; frames are for animation, not separating logic.
I don't understand! what is Flash IDE?!

The Adobe Flash program.

Response to as3 enemy code structure 2015-08-11 12:47:55


At 8/11/15 12:08 PM, Diki wrote:
At 8/10/15 01:25 PM, Knight52 wrote: Split the mobs to be loaded on multiple frames.
Say, you want to load 1000 enemies, you split them to add 100 enemies on 10 frames instead of all of them in a single frame. But you'll need to change your code a lot for that.

There'll stil be possibility of having lower framerate due to having too many enemies on the screen. But that's on another topic.
If you're developing a game with the Flash IDE, which isn't a good idea because it's a suite intended for animation not game development, you should not be using frames; frames are for animation, not separating logic.

No, I use FlashDevelop. And I'm talking about loading in enter frame events. The point is; load a part of the mob, let the screen refresh so the player doesn't feel lag, and repeat until all mobs are loaded.

Doesn't change anything about having too many enemies on the screen though. He needs to optimize the enemy's AI.