Page 2 of 2

Posted: Fri Aug 15, 2014 3:40 pm
by kubilus1
Does anyone have a copy of Propeller? I can't seem to locate the file on my drive and the links are broken.

Thanks.

Posted: Fri Aug 15, 2014 3:51 pm
by djcouchycouch
Try again for 1.0.2.

Note that it was last compiled for SGDK 0.93b. I'm pretty sure it won't compile with the latest version. I have no plans to update it.

Posted: Fri Aug 15, 2014 4:42 pm
by kubilus1
Thanks! I'm looking more for algorithmic examples instead of compiling code ATM.

Posted: Fri Aug 15, 2014 5:09 pm
by djcouchycouch
what kind of algorithms are you looking for?

Posted: Fri Aug 15, 2014 5:34 pm
by kubilus1
For starters, I remember you mentioning that you had a method to generate cos tables. Also, I had been skimming some articles about raster transformations (http://www.catalase.com/optrot3d.htm) and was curious if something along these lines have been implemented for 2d sprite rotation, seeing how goplanes had a rotating sprite.

I see that was done by having separate images, which I kind of figured. I think it would be kind of cool to not have to draw the rotations but either do so on the fly (expensive) or somehow pre-render these into VRAM.

Eventually, I want to put together a more comprehensive game/demo, when I get time (???)

Posted: Sat Aug 16, 2014 7:41 pm
by r57shell
building cos/sin table? What can be more simple? :(

Posted: Sat Aug 16, 2014 11:43 pm
by sega16
Yes it is very easy. This is a bit more fancy generator and is only 31 lines of code. It generates fixed point integer tables.

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* Compile gcc main.c -O2 -o sinetab -lm */
int main(int argc,char**argv){
	long n,i;
	double mul,div;
	FILE*fp;
	if(argc!=5){
		/* Divider refers to how much of the sine is stored for example to do 0-90 degrees use a value of 4 */
		printf("Usage %s amount multiplier divider outputfile\n",argv[0]);
		return 1;
	}
	n=strtol(argv[1],0,0)-1;
	if(n<=0){
		puts("Cannot have less than or equal to one sine entry");
		return 1;
	}
	mul=strtod(argv[2],0);
	div=strtod(argv[3],0);
	fp=fopen(argv[4],"w");
	fputc('\t',fp);
	for(i=0;i<n;++i){
		fprintf(fp,"%d,",(int)round(sin((double)i/(double)n*M_PI*2.0/div)*mul));
		if((i&15)==15)
			fputs("\n\t",fp);
	}
	fprintf(fp,"%d\n",(int)round(sin((double)i/(double)n*M_PI*2.0/div)*mul));
	fclose(fp);
	return 0;
}
I think everything should be self explanatory. The only thing that may confuse some too lazy to look at the source code is the divider parameter. What this does is lets you set how much of a sine you want. For example using a value of four would result in 1/4 of a full sine period which is 2*pi or 360 degrees. This allows you to do code size/speed tradeoffs. For example if you use a divider of four you can take advantage of symmetry and reflection with simple conditional statements. Using a divider of one removes the need for conditional statements.

Posted: Sun Aug 17, 2014 7:35 am
by Stef
SGDK does already contains some precalculated cos/sin table.
Not sure that kubilus1 is looking for the tables only but maybe a drawing method using them.

Posted: Sun Aug 17, 2014 1:34 pm
by kubilus1
I recalled that goplanes had a rotating main sprite, I thought there was a chance something like sprite transformation ( prerendering or on the fly) might be implemented in propeller. There isnt, which is kind of expected.

Also, I like to see how other people implement random stuff to see if I get any ideas in general.

Posted: Sun Nov 30, 2014 9:02 pm
by djcouchycouch
I updated Propeller to SGDK 1.00.

https://dl.dropboxusercontent.com/u/173 ... .1.0.3.zip

Let me know if you see any problems.

Re: Propeller - An Example SGDK-Based Game Engine

Posted: Thu Dec 21, 2017 3:02 pm
by djcouchycouch
Hi,

I updated the links.

thanks,
djcc