A Simple NES Game

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Re: A Simple NES Game

Postby Falco Girgis on Tue Apr 23, 2013 11:42 am

Hell yeah! I'd hit it! :mrgreen:
"So what happens if the Elysian Shadows Kickstarter fails?"
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10690
Joined: Thu May 20, 2004 3:04 pm
Location: Studio Vorbis, AL

Re: A Simple NES Game

Postby Light-Dark on Mon Aug 04, 2014 11:46 pm

EDIT: Here's a video of it in action

Adding on to the sine-wave like movement pattern discussion in this thread:

There is in fact a way to create a more precise replica of a sinusoidal curve on the NES through the use of a lookup table in ROM. This is how I've gone about generating a smooth curve for ai movemnt in my new platformer engine:
void Generate_Table(){
int i;
float angle = 0.0;
for(i = 0;i <256;i++){
table[i] = ((sin(angle)*127.0)+128.0);
printf("8bit value:%i\n",table[i]);
angle += 0.125;

Here is how I use it in my NES engine:
.incbin "sinetable.bin" ; 256 byte binary file consisting of the generated sine table

And here is how the table is used
Code: Select all
   ldy #$05               ;Set xVel to 3
   lda #$03
   sta (AI_PTR),y
   ldy #$08
   lda (AI_PTR),y            ; action frame
   lda sine,x               ; do sine table lookup
   lsr                     ; divide  by 2 to compress the arc size
    sta Test               ; temporary test variable
   adc #$40               ; add a decent y offset
   ldy #$00               
   sta (AI_PTR),y            ; save it to the Y-position of AI

   ldy #$08               ; reload action frame
   lda (AI_PTR),y            ; ^ I know this seems inefficient lol
   inx                     ; increment it
   sta (AI_PTR),y            ; save it back
   jmp AI_ActionDone         ; exit from the jumptable routine
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step

User avatar
Dreamcast Developer
Dreamcast Developer
Posts: 315
Joined: Sun Mar 13, 2011 8:57 pm
Location: Canada


Return to Game Development

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest