Game of Life

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Game of Life
by on (#88541)
Hello.
I have implemented the "Game of Life" for the NES as invented by mathematician John Conway in 1970.

See here for more information: http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

Image

iNES ROM:
http://www.mediafire.com/?2i9hcr2oc7iibe4

Here's also the source code, but it is not very well written and not super efficient (I'm still a beginner):
http://www.mediafire.com/?0n0awmaz77pea7o

Controls:

SELECT
--> Switch between menu and cell selection

START
--> Shortcut to start the game

A
--> inside field, fill a cell (make it "alive"), inside menu activate the menu entry

B
--> inside field, empty a cell (make it "dead")


If you have never played Life before, you will probably want to try out some of the templates I prepared for you in the Templates-Section.

I hope you like it!

by on (#88544)
Nice, but that font is really difficult to read with these brightness jumps.

Also, try to use frame step in an emulator to check the moment when you switch to the templates menu and back.

by on (#88548)
Shiru wrote:
Nice, but that font is really difficult to read with these brightness jumps.

When using colored fonts it's also especially important to test what it looks like on the real machine. I remember the fonts in Super NeSnake 2 looked really crappy on PAL NES.

by on (#88550)
Shiru wrote:
Nice, but that font is really difficult to read with these brightness jumps.


Thank you, I've changed the palette a bit, i think it looks good now (at least on my emulators - don't have a powerpak yet).
I was testing the game most of the time in an upscaled modus in FCEUXD SP and i thought it looked ok...

Shiru wrote:
Also, try to use frame step in an emulator to check the moment when you switch to the templates menu and back.


Do you mean the "scrolling glitch" before the menu appears?
No idea what causes this, I'm just doing a "normal" nametable upload.
The same glitch is also appearing when calling the help menu.

What's wrong with that code? Did I miss something?
Tried to fix this since an hour or so :?

Code:
  LDA #$00
  STA $2001   ;disable rendering
  STA $2000   ;and NMI
 
  LDA #<TEMPNAMETABLE       ;setup pointer
  STA Pointer
  LDA #>TEMPNAMETABLE
  STA Pointer+1
 
  LDA $2002    ;reset high/low latch
  LDA #$20     ;setup PPU
  STA $2006
  LDA #$00
  STA $2006

  LDX #$00    ;row position
--
  LDY #$00    ;column position
-
  LDA (Pointer), Y
  STA $2007
  INY
  CPY #$20
  BNE -
  LDA Pointer
  CLC
  ADC #$20
  STA Pointer
  LDA Pointer+1
  ADC #$00
  STA Pointer+1
  INX
  CPX #$1E
  BNE --
 
  ;attribute
  LDX #$00
-
  LDA TEMPATTRIBUTE, X
  STA $2007
  INX
  CPX #$40
  BNE -

  ;setup sprite (and delete the selection sprite)
  LDA #64   ;Y
  STA $0200
  LDA #$01  ;Tile
  STA $0201
  LDA #$01  ;Attribute
  STA $0202
  LDA #24   ;X
  STA $0203
  LDA #$FE  ;delete second selection sprite
  STA $0204
  STA $0205
  STA $0206
  STA $0207

  LDA #%00011110
  STA $2001    ;enable rendering
  LDA #%10001000  ;enable NMI
  STA $2000
 
  LDA #$00
  STA $2005
  STA $2005

by on (#88552)
I guess you need to reset PPU_ADDR before enabling rendering, and wait for NMI before disabling rendering,so it will not get disabled in the middle of the frame.

by on (#88554)
Shiru wrote:
I guess you need to reset PPU_ADDR before enabling rendering, and wait for NMI before disabling rendering,so it will not get disabled in the middle of the frame.

Also wait for vblank before enabling rendering.

by on (#88556)
thefox wrote:
Shiru wrote:
I guess you need to reset PPU_ADDR before enabling rendering, and wait for NMI before disabling rendering,so it will not get disabled in the middle of the frame.

Also wait for vblank before enabling rendering.


That was it.
Thanks

by on (#88570)
Yggi wrote:
I've changed the palette a bit, i think it looks good now (at least on my emulators - don't have a powerpak yet).

I've found Nestopia's NTSC filter to be reasonably accurate to the TVs that I own.

Quote:
I was testing the game most of the time in an upscaled modus in FCEUXD SP and i thought it looked ok...

I haven't been able to get FCEUX's NTSC filter to look right.

by on (#88574)
This is a really cool idea. Game of Life has been making the rounds on the internet lately. I wonder why? It's kind of a big thing. Personally, I am interested in the three dimensional varieties.

by on (#88576)
NovaYoshi once made a (slow) 32x32 Life simulator. Perhaps I should bug him to release what he has so far.

Of course we're not talking about Life the board game or Life the game show, which airs on a channel that I think nobody knows about except bronies.

by on (#88585)
Yeah there are just tons of cellular automata documents and programs out there. There's this one called Visions of Chaos that has fractals and many other things in both 2D and 3D.