Propeller - An Example SGDK-Based Game Engine

Talk about development tools here

Moderator: BigEvilCorporation

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Fri Aug 15, 2014 3:40 pm

Does anyone have a copy of Propeller? I can't seem to locate the file on my drive and the links are broken.

Thanks.

djcouchycouch
Very interested
Posts: 672
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Fri Aug 15, 2014 3:51 pm

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.

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Fri Aug 15, 2014 4:42 pm

Thanks! I'm looking more for algorithmic examples instead of compiling code ATM.

djcouchycouch
Very interested
Posts: 672
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Fri Aug 15, 2014 5:09 pm

what kind of algorithms are you looking for?

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Fri Aug 15, 2014 5:34 pm

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 (???)

r57shell
Very interested
Posts: 474
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Post by r57shell » Sat Aug 16, 2014 7:41 pm

building cos/sin table? What can be more simple? :(
Image

sega16
Very interested
Posts: 250
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Sat Aug 16, 2014 11:43 pm

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.

User avatar
Stef
Very interested
Posts: 2616
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Aug 17, 2014 7:35 am

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.

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sun Aug 17, 2014 1:34 pm

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.

djcouchycouch
Very interested
Posts: 672
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Sun Nov 30, 2014 9:02 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest