|
Post by gtoal on Nov 11, 2023 4:23:38 GMT -5
I was messing about with an experiment sort of inspired by the Spirograph (adding two circular motions together) and came up with this...
#include <vectrex.h> int main(void) { long int x,y, sin1,cos1, sin2,cos2; long p[10] = {8,8,4,4,2,3,2,3,4,2}; #define MAXSPEED 3 int speed = 0; sin1 = -96L; cos1 = 1L; sin2 = 1L; cos2 = -96L; while (1) { Wait_Recal();Intensity_7F(); speed+=1; sin2 = sin2 - (cos2/p[0]); cos2 = cos2 + (sin2/p[1]); if (speed == MAXSPEED) { sin1 = sin1 - (cos1/p[2]); cos1 = cos1 + (sin1/p[3]); speed=0; } x = (sin1/p[4])+(sin2/p[5])*p[6]; y = (cos1/p[7])-(cos2/p[8])*p[9]; x = (int)((long)x * 15L / 16L);y = (int)((long)y * 23L / 16L); Reset0Ref(); Print_Str_d((int)y, (int)x, "g \x80"); } return 0; } Although it sort of works as-is as a simple screen-saver, I was wondering if the motion path might be useful for some sort of game. It's semi-regular yet semi-chaotic - a little but not 100% predictable - can anyone think of a good game mechanic that could take advantage of that kind of movement? (The parameter array is pretty much arbitrarily chosen and tweaking the numbers would give quite different paths) Slowly changing some of the parameters over time could make it even more unpredictable.
G
|
|
|
Post by Peer on Nov 11, 2023 12:18:40 GMT -5
I was messing about with an experiment sort of inspired by the Spirograph (adding two circular motions together) and came up with this... #include <vectrex.h> int main(void) { long int x,y, sin1,cos1, sin2,cos2; long p[10] = {8,8,4,4,2,3,2,3,4,2}; #define MAXSPEED 3 int speed = 0; sin1 = -96L; cos1 = 1L; sin2 = 1L; cos2 = -96L; while (1) { Wait_Recal();Intensity_7F(); speed+=1; sin2 = sin2 - (cos2/p[0]); cos2 = cos2 + (sin2/p[1]); if (speed == MAXSPEED) { sin1 = sin1 - (cos1/p[2]); cos1 = cos1 + (sin1/p[3]); speed=0; } x = (sin1/p[4])+(sin2/p[5])*p[6]; y = (cos1/p[7])-(cos2/p[8])*p[9]; x = (int)((long)x * 15L / 16L);y = (int)((long)y * 23L / 16L); Reset0Ref(); Print_Str_d((int)y, (int)x, "g \x80"); } return 0; } Although it sort of works as-is as a simple screen-saver, I was wondering if the motion path might be useful for some sort of game. It's semi-regular yet semi-chaotic - a little but not 100% predictable - can anyone think of a good game mechanic that could take advantage of that kind of movement? (The parameter array is pretty much arbitrarily chosen and tweaking the numbers would give quite different paths) Slowly changing some of the parameters over time could make it even more unpredictable. G Nice! Reminds my of something I did. The trajectories of the objects in "Count Vecula" are computed in a similar way. In each level, the path of each of the nine objects is determined by a parameterized superpositions of two sine and two cosine functions. If you can see only one objects flying (as in some levels), then its paths seems pretty erratic and difficult to predict. But if you see all nine at the same time (as in others levels), then a nice and regular pattern for the whole swarm emerges. Your code would fit in very well I think.
Many Cheers, Peer
|
|