I've been thinking about good rules for object spawning/deactivating for my platformer engine, and started to think about how commercial games handle stuff like that. Hopefully we can get a discussion going to add to the earlier thread about spawning.
SMB3
Objects can be spawn from both directions. Their initial movement direction changes based on which side of the screen spawns them, so they always head towards the hero. They don't respawn if they've been killed (although pushing them into pits doesn't count as a kill).
The game seems to spawn enemies a little bit before the screen scrolls to the spawn point, so they scroll into view smoothly.
Bucky O'Hare
Enemy spawning is somewhat buggy (although some might call this a feature). If a spawned enemy is killed, and the edge of the screen is still inside the 16(?) pixel spawn location, scrolling one pixel or so to the right will spawn it again. This is another one of those things that while understandable from programming point of view, is unintuitive to the player.
Spawning isn't pixel perfect, i.e. it doesn't take the sprite bounding box in account. Sprite simply appears on the spawn location, seems to be centered on the screen edge horizontally most of the time. Also with frame stepping it's possible to see that objects on the right side of the screen are facing the wrong way for a single frame after spawning.
Common
In both games, objects don't have to be very far from the screen edges to get deactivated. There are situations when this makes the player think the enemy vanished into thin air. For example when enemy is walking right on a narrow cliff, the right edge of screen is just past the enemy spawn point and the enemy gets deactivated when it goes outside the visible window. Now when player scrolls to right, the enemy appears to have vanished. Sorry, hard to explain.
In SMB3, I *think* the deactivating rules change depending which direction the hero and the enemy are moving. If screen is scrolling to right and the enemy is moving left, the enemy disappears immediately after leaving the screen. However if enemy is moving right also, it doesn't. Or so it seems.
---
Anybody have anything to add?
SMB3
Objects can be spawn from both directions. Their initial movement direction changes based on which side of the screen spawns them, so they always head towards the hero. They don't respawn if they've been killed (although pushing them into pits doesn't count as a kill).
The game seems to spawn enemies a little bit before the screen scrolls to the spawn point, so they scroll into view smoothly.
Bucky O'Hare
Enemy spawning is somewhat buggy (although some might call this a feature). If a spawned enemy is killed, and the edge of the screen is still inside the 16(?) pixel spawn location, scrolling one pixel or so to the right will spawn it again. This is another one of those things that while understandable from programming point of view, is unintuitive to the player.
Spawning isn't pixel perfect, i.e. it doesn't take the sprite bounding box in account. Sprite simply appears on the spawn location, seems to be centered on the screen edge horizontally most of the time. Also with frame stepping it's possible to see that objects on the right side of the screen are facing the wrong way for a single frame after spawning.
Common
In both games, objects don't have to be very far from the screen edges to get deactivated. There are situations when this makes the player think the enemy vanished into thin air. For example when enemy is walking right on a narrow cliff, the right edge of screen is just past the enemy spawn point and the enemy gets deactivated when it goes outside the visible window. Now when player scrolls to right, the enemy appears to have vanished. Sorry, hard to explain.
In SMB3, I *think* the deactivating rules change depending which direction the hero and the enemy are moving. If screen is scrolling to right and the enemy is moving left, the enemy disappears immediately after leaving the screen. However if enemy is moving right also, it doesn't. Or so it seems.
---
Anybody have anything to add?