GC : Explosive Balls (game play) Continued adventures with the oneLoneCoder pixelGameEngine (youtube). With the current game challenge, time has started to arc over and on the surface, I'm not looking all that great. Under the hood though, things are playing well with each other. I have most all of my render system in place, most update behaviors ready and still have some performance headroom, although I've dipped under standard monitor speed (60hz) sometime last week in test runs. So, two weeks. That's what I get to finish game play, leaving something for cleanup and GC blog/project setup. The original plan is still good and taken from concept to reality. We're here. Got balls, they go boom, they dig a hole and do a pretty splash on their way out the door. Perfect. This last week a terrain smoothing feature was added. After a carve operation and the damage the particle system does as well leaves pointy peaks. The smoothing provides landslide behavior and drops stray leftover pixels into the pile. As soon as I realized that, I saw a water implementation peeking it's head out of the sand. So again, here we are. The new yellow object is the puncture pin. Balls and pin against character and his pipes. If balls get the pin down to the pipe, we start flooding for effect game over. That's where my idea went. Did I mention, "not ...all that great" Working on that mechanic for the next day or two. (I'll be back) The initial stab at it was nice. Tomorrow, another particle system type as the spawner. As of now, I set an int in my world array to the water ID and update the array like so. Pretty easy and nice addition...now we're making progress. if (terrain.isStable == true) // not used? always fires at 100 pixel row chunks { static int tty = terrain.nMapHeight - 1; // search row cursor location (y axis marker) for (int n = 0; n < 200; n++) // update count rows of pixels { tty--; // advance on start for the iteration of the row for (int x = 0; x < terrain.nMapWidth; x++) { // scan the single row this frame int index = (tty * terrain.nMapWidth) + x; // this location data index int indexDown = index + terrain.nMapWidth; // the pixel below if (terrain.map[index] != 0) { // we're a pixel. is someone not below me? if (terrain.map[indexDown] == 0) { // fall - swap down one pixel terrain.map[indexDown] = terrain.map[index]; terrain.map[index] = 0; } // no, is someone down and left? if (terrain.map[index] == 1) { // dirt slide float rnd = (float)std::rand() / (float)RAND_MAX; bool bChaos = rnd > 0.95 ? true : false; // determine chaos for horizon movement if (terrain.map[indexDown - 1] != 1 && bChaos == true) { // settle left - swap (down/left) one pixel terrain.map[indexDown - 1] = 1; terrain.map[index] = 0; } // no, is someone down and right? else if (terrain.map[indexDown + 1] != 1 && bChaos == true) { // settle right - swap (down/right) one pixel terrain.map[indexDown + 1] = 1; terrain.map[index] = 0; } } if (terrain.map[index] == 2) // { // water slide // just right here (behavior) int sign; // tty % 2 == 0 ? sign = -1 : sign = 1; if (terrain.map[index+sign] == 0) { // flow left - swap (left) one pixel terrain.map[index+sign] = 2; terrain.map[index] = 0; } } } } if (tty == 0) // top row tested. reset to bottom to restart scan. tty = terrain.nMapHeight - 1; } } https://ift.tt/eA8V8J
Continued adventures with the oneLoneCoder pixelGameEngine (youtube). With the current game challenge, time has started to arc over and on the surface, I'm not looking all that great. Under the hood though, things are playing well with each other. I have most all of my render system in place, most update behaviors ready and still have some performance headroom, although I've dipped under standard monitor speed (60hz) sometime last week in test runs. So, two weeks. That's what I get to finish game play, leaving something for cleanup and GC blog/project setup. The original plan is still good and taken from concept to reality. We're here. Got balls, they go boom, they dig a hole and do a pretty splash on their way out the door. Perfect. This last week a terrain smoothing feature was added. After a carve operation and the damage the particle system does as well leaves pointy peaks. The smoothing provides landslide behavior and drops stray leftover pixels into the pile. As soon as I realized that, I saw a water implementation peeking it's head out of the sand. So again, here we are. The new yellow object is the puncture pin. Balls and pin against character and his pipes. If balls get the pin down to the pipe, we start flooding for effect game over. That's where my idea went. Did I mention, "not ...all that great" Working on that mechanic for the next day or two. (I'll be back) The initial stab at it was nice. Tomorrow, another particle system type as the spawner. As of now, I set an int in my world array to the water ID and update the array like so. Pretty easy and nice addition...now we're making progress. if (terrain.isStable == true) // not used? always fires at 100 pixel row chunks { static int tty = terrain.nMapHeight - 1; // search row cursor location (y axis marker) for (int n = 0; n < 200; n++) // update count rows of pixels { tty--; // advance on start for the iteration of the row for (int x = 0; x < terrain.nMapWidth; x++) { // scan the single row this frame int index = (tty * terrain.nMapWidth) + x; // this location data index int indexDown = index + terrain.nMapWidth; // the pixel below if (terrain.map[index] != 0) { // we're a pixel. is someone not below me? if (terrain.map[indexDown] == 0) { // fall - swap down one pixel terrain.map[indexDown] = terrain.map[index]; terrain.map[index] = 0; } // no, is someone down and left? if (terrain.map[index] == 1) { // dirt slide float rnd = (float)std::rand() / (float)RAND_MAX; bool bChaos = rnd > 0.95 ? true : false; // determine chaos for horizon movement if (terrain.map[indexDown - 1] != 1 && bChaos == true) { // settle left - swap (down/left) one pixel terrain.map[indexDown - 1] = 1; terrain.map[index] = 0; } // no, is someone down and right? else if (terrain.map[indexDown + 1] != 1 && bChaos == true) { // settle right - swap (down/right) one pixel terrain.map[indexDown + 1] = 1; terrain.map[index] = 0; } } if (terrain.map[index] == 2) // { // water slide // just right here (behavior) int sign; // tty % 2 == 0 ? sign = -1 : sign = 1; if (terrain.map[index+sign] == 0) { // flow left - swap (left) one pixel terrain.map[index+sign] = 2; terrain.map[index] = 0; } } } } if (tty == 0) // top row tested. reset to bottom to restart scan. tty = terrain.nMapHeight - 1; } }
from GameDev.net http://bit.ly/304lEr7
from GameDev.net http://bit.ly/304lEr7
ليست هناك تعليقات