Posté le 21/03/2014 à 14:50Edité par NeoHomeBrew le 21/03/2014 à 17:00 Membre depuis le 21/03/2014, 187 messages
Hi to all,

Recently, I have found HPMAN's video library for the Neobitz SDK in the NeoGeoFans.com forum (http://www.neogeofans.com/leforum/showthread.php?t=46638) and I have contacted him to ask for additional information. He suggested me to post my experiences and questions to this forum because maybe other developers could benefit from this in the future.

My actual project is to develop a side-scrolling shooting game for the Neo-Geo, which is really not an all-new idea but comparatively easy to program - particularly by using HPMAN's amazing DATlib. The library offers very useful pre-build functions like scrolling, animation, raster effects and multiple color palettes which make game development on the Neo-Geo a lot easier.

neo-sub.png



The first thing I was playing with was the scrolling function which is able to scroll huge graphics with multiple color palettes and auto-animation without any sprite tearing. The scrolling function provides a great performance because it uses only 21 sprites regardless of the real length of the graphic.

I added 3 scrollable layers to my game to create a parallax scrolling effect. The bottom layer has an 8-frame auto-animation and uses 2 color palettes. Here is a video of the scrolling test:

http://www.youtube.com/watch?v=pVH0kJ4ZTkc

Question to HPMAN: How to speed up the auto-animation?



During the creation of the bottom layer graphic I was facing the problem that there is a difference between the RGB color palette of the Neo-Geo and the RGB color palette of an usual Windows PC.
If you create a graphic on your PC with a graphic editor like Photoshop you have much more colors available than the Neo-Geo can actually display. That means you need to know which RGB color code is "Neo-Geo-save" especially if you want to make gradients. Here is an example (PC color - left vs. Neo Geo colors - right):

pc-colors.png neo-colors.png

As you can see, the colors the Neo Geo hardware isn't able to diplay are converted during the graphic compiling proccess to the "nearest neighbor" colors.

Question to HPMAN: I used Furrteks NGPG tool (https://wiki.neogeodev.org/index.php?title=File:Ngpg01.png) to validate which colors are actually displayable by the NeoGeo hardware. Because it only shows the Neo Geo color hex codes I have used "Dotcolor" (http://www.inetis.com/index.php?module=programcki) to get the PC color hex code of the given color.

For example:

Ngpg01.png

Ngpg02.png

Neo Geo color: $344F / R: 17 G: 19 B: 63
is equal to
PC color: #44CFC / R: 68 G: 76 B:252

Is there any easier method of translating the color codes from PC to Neo Geo and vice versa?



For debugging homebrewed code on the computer I have found two emulators which accept to execute Neo-Geo .bin files with wrong CRC checksums (MAMEUI32 0.141u2 and MAME32 0.90u1).
But both of them show a warning message before starting the emulation which has to be confirmed by clicking "OK" or pressing buttons. Dou you maybe use a better version without that annoying warning message?

warning.png



Thanks a lot,
Michael
Posté le 21/03/2014 à 15:32 Membre depuis le 06/09/2002, 18645 messages
Hey a Blood Money link
good news
I am happy to see you here, and i will test your game in neo geo (CD) with pleasure
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 21/03/2014 à 15:57 Membre depuis le 28/01/2003, 160 messages
Anto anim speed is handled by the LSPC mode register at 0x3c0006 (https://wiki.neogeodev.org/index.php?title=Memory_mapped_registers)


Just can just write your value in there to set anim speed when using the regular vblank IRQ: volMEMWORD(0x3c0006)=0x1c00;
If you use the Timer interrupt enabled IRQ, use LSPCmode=0x1c00; instead.


There's no easy way to sort out the colors issue on modern drawing utilities like photoshop.
You draw and save images as 24bpp colors, neo geo is 15 bpp color + dark bit, so buildchar tries to pick up the nearest available color.
It's not perfect yet as it's missing dark bit support at the moment. If you loose colors on an image rip from another game that might be the cause.

There's no good way to know how it will end beforehand, a good solution would be to have a color picker plugin for photoshop matching NG color scheme, but nobody did that grin
Posté le 21/03/2014 à 16:05 Membre depuis le 06/09/2002, 18645 messages
maybe atarashi could help you for the neo geo palette ?

http://furrtek.free.fr/?a=atarashi
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 21/03/2014 à 17:09 Membre depuis le 21/03/2014, 187 messages
You guys are faster than I could complete writing my first post wink

To KUK: Thanks, I will have a look on that atarashi tool (I haven't seen it before.) I don't know if there will be a NGCD version because, as for now, there is a problem regarding CD compiling. I will post that later.

To HPMAN: Thanks for your fast support - I will check out your advice with the LSPC mode register.
Posté le 21/03/2014 à 17:28 Membre depuis le 10/12/2010, 194 messages
Hi Michael / Jojo 23 (NeoHomeBrew.com)

You 're Welcome !
Your first test concerning your new project with the new HPMAN's DATlib seem very good !
you seem very motivated ... that's good too

Concerning your warning message before starting the emulation, You will find few words & tools solution in this section :
topics/148447-ajouter-son-projet-a-un-emulateur Ajouter son projet à un emulateur / Add your project to emulator

Bye,
Fred / FRONT!
Posté le 21/03/2014 à 18:08 Membre depuis le 06/09/2002, 18645 messages
NGCD is the best console for the hombrew production embarrassed
So we/i could test it if you want
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 21/03/2014 à 18:15 Membre depuis le 21/03/2014, 187 messages
Notes regarding auto-anim - the following eight animation speeds are possible:

Binary value / Hexadecimal value

0000000100000000 / LSPCmode=0x100 fastest
0000001000000000 / LSPCmode=0x200
0000010000000000 / LSPCmode=0x400
0000100000000000 / LSPCmode=0x800
0001000000000000 / LSPCmode=0x1000
0010000000000000 / LSPCmode=0x2000
0100000000000000 / LSPCmode=0x4000
1000000000000000 / LSPCmode=0x8000 slowest

0000000000001000 / LSPCmode=0x8 auto-anim off

THX to HPMAN king
Posté le 21/03/2014 à 18:38 Membre depuis le 21/03/2014, 187 messages
To FRONT: Thanks for your welcome and the link - this could help sun

To KUK: Yes, I would like to make the game also for the NGCD system but currently HPMAN's DATlib can't be compiled for it. I have asked him already for it but and he wrote me that there seems to be a configuration problem with the CD header file.
Posté le 21/03/2014 à 18:48 Membre depuis le 06/09/2002, 18645 messages
c'est quoi cette histoire HPMAN ? on fait des outils orienté ? non
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 21/03/2014 à 19:32 Membre depuis le 28/01/2003, 160 messages

For debugging homebrewed code on the computer I have found two emulators which accept to execute Neo-Geo .bin files with wrong CRC checksums (MAMEUI32 0.141u2 and MAME32 0.90u1).
But both of them show a warning message before starting the emulation which has to be confirmed by clicking "OK" or pressing buttons. Dou you maybe use a better version without that annoying warning message?

warning.png


I suggest you download the mame source and add your driver, much more convenient (topics/148447-ajouter-son-projet-a-un-emulateur)

NeoHomeBrew (./8) :
Notes regarding auto-anim - the following eight animation speeds are possible:

Binary value / Hexadecimal value

0000000100000000 / LSPCmode=0x100 fastest
0000001000000000 / LSPCmode=0x200
0000010000000000 / LSPCmode=0x400
0000100000000000 / LSPCmode=0x800
0001000000000000 / LSPCmode=0x1000
0010000000000000 / LSPCmode=0x2000
0100000000000000 / LSPCmode=0x4000
1000000000000000 / LSPCmode=0x8000 slowest

0000000000001000 / LSPCmode=0x8 auto-anim off


Actually you can fit the upper 8 bits anything from 0x00 to 0xff, 0 to change image every frame, 1 for every 2 frames, 2 for every 3 frames etc...


kuk (./10) :
c'est quoi cette histoire HPMAN ? on fait des outils orienté ? non


C'est elle qu'a commencé, en ne lisant pas l'ADPCM-B embarrassed
Posté le 21/03/2014 à 20:12 Membre depuis le 06/09/2002, 18645 messages
teuteuteu
on fait des outils clairement orienté neo geo CD et vite !
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 22/03/2014 à 00:01 Membre depuis le 28/01/2003, 160 messages
140322120825202066.png

cool
Posté le 22/03/2014 à 00:25 Membre depuis le 21/03/2014, 187 messages
HPMAN, this is really cool - send me some details please miam
Posté le 22/03/2014 à 00:32 Membre depuis le 28/01/2003, 160 messages
crt0_cd.s:
********************* Vector Definitions *********************
_IRQ1	=	DAT_TIfunc
_IRQ2	= DAT_vblankTI
_IRQ3	=	_irq3_handler
_ENTRY_USER	= _start
_ENTRY_PLAYER_START	= _dummy_config_handler
_ENTRY_DEMO_END	= _dummy_config_handler |; MVS game switch
_ENTRY_COIN_SOUND	= _dummy_config_handler |; coin sound

DUMMY			= _dummy_exc_handler
TRAP00			= _dummy_exc_handler
TRAP01			= _dummy_exc_handler
TRAP02			= _dummy_exc_handler
TRAP03			= _dummy_exc_handler
TRAP04			= _dummy_exc_handler
TRAP05			= _dummy_exc_handler
TRAP06			= _dummy_exc_handler
TRAP07			= _dummy_exc_handler
TRAP08			= _dummy_exc_handler
TRAP09			= _dummy_exc_handler
TRAP10			= _dummy_exc_handler
TRAP11			= _dummy_exc_handler
TRAP12			= _dummy_exc_handler
TRAP13			= _dummy_exc_handler
TRAP14			= _dummy_exc_handler
TRAP15			= _dummy_exc_handler

************************ Definitions *************************
_CDDA_FLAG	= 0
_NGH	=	0x7777
_PROGRAM_SIZE	=	0x00100000
_WRK_BCKP_AREA = bkp_data
_WRK_BCKP_AREA_SIZE = 0x0100	|;256bytes
_EYE_CATCHER = 0x02	/*;eye catcher (0-common 1-custom 2-off)*/
_EYE_CATCHER_TILES = 0x01 /*;eye catcher start tiles (upper bits, 0x01 => 0x0100)*/

	.include	"common_crt0_cd.s"

* Names MUST be 16 characters long
*           <---------------->
JPconfig:
	.ascii	"HELLO WORLD JP  "
	.long	0xFFFFFFFF
	.word	0x0364
	.byte	0x14, 0x13, 0x24, 0x01

NAconfig:
	.ascii	"HELLO WORLD US  "
	.long	0xFFFFFFFF
	.word	0x0364
	.byte	0x14, 0x13, 0x24, 0x01
	
EUconfig:
	.ascii	"HELLO WORLD EU  "
	.word	0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
	.end


common_crt0_cd.s:
_ZERO_DIVIDE	=	0x00c00426
_CHK_CMD	=	0x00c00426
_TRAPV_CMD	=	0x00c00426
_NPC_1010	=	0x00c00426
_NPC_1111	=	0x00c00426
_IRQ4	=	0x00c00426
_IRQ5	=	0x00c00426
_IRQ6	=	0x00c00426
_IRQ7	=	0x00c00426
	
********************** Exported Symbols **********************
	.globl	_start
	.globl	atexit

********************** Imported Symbols **********************
	.globl	__do_global_ctors
	.globl	__do_global_dtors
	.globl	main
	.globl	memset
	.globl	__bss_start	
	.globl	_end
	.globl	_sbrk_base1
	.globl	_sbrk_base2

********************** Program Start *************************

	.org	0x0000
	
	.long	0x0010f300	|;reset stack ptr
	.long	0x00c00402	/*;reset ptr*/
	.long	0x00c00408	/*;bus error*/
	.long	0x00c0040e	/*;address error*/

	.long	0x00c00414	/*;illegal instruction*/
	.long	_ZERO_DIVIDE	/*;division by 0*/
	.long	_CHK_CMD	/*;CHK command*/
	.long	_TRAPV_CMD	/*;TRAPV command*/

	.long	0x00c0041a	/*;illegal privilege*/
	.long	0x00c00420	/*;trace exception handling*/
	.long	_NPC_1010	/*;no package command (1010)*/
	.long	_NPC_1111	/*;no package command (1111)*/

	.long	0x00c00426, 0x00c00426, 0x00c00426	/*;unused*/
	.long	0x00c0042c	/*;uninitialized interrupt*/

	.long	0xC00522, 0xC00528, 0xC0052E, 0xC00534
	.long	0xC0053A, 0xC004F2, 0xC004EC, 0xC004E6
	.long	0xC004E0
	
	|; 0x64
	.long _IRQ1, _IRQ2, _IRQ3, _IRQ4, _IRQ5, _IRQ6, _IRQ7	/*;4-7 unused*/
	.long	TRAP00,	TRAP01,	TRAP02,	TRAP03
	.long	TRAP04,	TRAP05,	TRAP06,	TRAP07
	.long	TRAP08,	TRAP09,	TRAP10,	TRAP11
	.long	TRAP12,	TRAP13,	TRAP14,	TRAP15
	.long	0xC00426, 0xC00426, 0xC00426, 0xC00426
	.long	0xC00426, 0xC00426, 0xC00426, 0xC00426
	.long	0xC00426, 0xC00426, 0xC00426, 0xC00426
	.long	0xC00426, 0xC00426, 0xC00426, 0xC00426
	
	.org 0x100

	.ascii	"NEO-GEO"
	.byte _CDDA_FLAG
	.word _NGH
	.long _PROGRAM_SIZE
	.long _WRK_BCKP_AREA
	.word _WRK_BCKP_AREA_SIZE
	.byte	_EYE_CATCHER
	.byte	_EYE_CATCHER_TILES

	.long	JPconfig
	.long	NAconfig
	.long	EUconfig
	
	jmp	_ENTRY_USER
	jmp	_ENTRY_PLAYER_START
	jmp	_ENTRY_DEMO_END
	jmp	_ENTRY_COIN_SOUND

|;* Standard IRQ1 handler
_irq1_handler:
	move.w	#2, 0x3C000C
	rte
|;* Standard IRQ3 handler
_irq3_handler:
	move.w	#1, 0x3C000C
_dummy_exc_handler:
	rte
|;* Dummy atexit (does nothing for now)
atexit:
	moveq	#0, d0
_dummy_config_handler:
	rts

|;* Entry point of our program
_start:
	|;* Setup stack pointer and 'system' pointer
	|;lea		0x10F300, a7
	|;lea		0x108000, a5

	|;* Reset watchdog
	move.b	d0, 0x300001
	
	|;* Flush interrupts
	move.b	#7, 0x3C000C
	
	move.l #0, TInextTable
	
	|;* Enable manual reset (A+B+C+START or SELECT)
	bclr	#7, 0x10FD80
	
	|;* Enable interrupts
	move.w	#0x2000, sr
	
	|;* Stop CDDA
	move.w	#0x0200, d0
	jsr		0xc0056a

	|;* Initialize base pointers for malloc
	move.l	#0x120000, _sbrk_base2
	move.l	#_end, d0
	add.l	#32, d0
	and.l	#0xFFFFFF0, d0
	move.l	d0, _sbrk_base1
	
	|;* Initialize BSS section
	move.l	#_end, d0
	sub.l	#__bss_start, d0
	move.l	d0, -(a7)
	clr.l	-(a7)
	pea		__bss_start
	jbsr	memset	

	|;* Jump to main
	jbsr	main

	|;* Call global destructors
	jbsr	__do_global_dtors

	|;* For CD systems, return to CD Player
	jmp		0xC0055E


Add volMEMBYTE(0x10fd80)=0x80; at the start of your main.
Posté le 22/03/2014 à 01:09 Membre depuis le 21/03/2014, 187 messages
It works - thanks a lot! Your video lib looks perfectly also on the real CD-System.
You just made my day boing !

For those who are interested here is a link to the NGCD demo:
http://www.neohomebrew.com/forum-pics/neosub-demo.rar

Just unpack and burn the files to a CDR and feed your toploader NGCD.
Posté le 24/03/2014 à 17:45 Membre depuis le 06/09/2002, 18645 messages
so i test it on my neo geo CDZ and it's ok
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 30/04/2014 à 11:57 Membre depuis le 21/03/2014, 187 messages
I have made a new video of the actual status of the project:

- new animated background layers > two layers with 8-frame animation (the water-like raster effect has been "faked" graphically)
- up to 10 enemies can be spawned at the same time
- up to 15 enemy torpedos can be shown at the same time
- up to 10 player torpedos can be shown at the same time
- enemies can fire at the player now
- player hit detection & armor bar

Posté le 30/04/2014 à 12:40 Membre depuis le 11/03/2013, 88 messages
Absolutely Fantastic Work!!
Posté le 30/04/2014 à 14:15 Membre depuis le 06/09/2002, 18645 messages
love
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 28/05/2014 à 16:42 Membre depuis le 21/03/2014, 187 messages
The graphic below contains 3632 basic "NeoGeo-safe" colors of the 15-bit RGB555 color palette arranged to a color chart.
I have made this graphic for myself but I think this chart could be interesting for future developers or designers for the system.

neo-geo-15-bit-rgb555-color-chart.png
Posté le 28/05/2014 à 18:00 Membre depuis le 28/01/2003, 160 messages
Been looking into colors for next update (also adding dark bit), turns out the system DAC isn't linear, which is the source of color conversion difficulties:

140528060548464140.png

Did you take that into accound making your chart?
Posté le 29/05/2014 à 00:14 Membre depuis le 21/03/2014, 187 messages
Hi HPMAN,

this is an interesting diagram - I did not knew it before. Great that you are working on an improvement of the graphics compiler - dark-bit colors would be nice grin

The values in the color chart are based on numbers which are divisible by eight. My goal was to have a chart with 24-bit colors which are displayable as 15-bit colors after compiling.
I have noticed a small difference between the values before and after compling but I think that is an emulator issue (?):

rbg-values-blue.png
Posté le 29/05/2014 à 01:40 Membre depuis le 28/01/2003, 160 messages
Looked into mame to get the info.

What mame does is calculate exact color values from the DAC resistor values in ohms.

It runs the code for both dark bit states, so you end up with two sets of values:
        private static double[] _noDB = {
            0.0000000000000000, 7.7986725921356159, 13.8249195716471380, 21.6235921637827530, 30.4148230211259190, 38.2134956132615360, 44.2397425927730550, 52.0384151849086720,
            64.7123893723533140, 72.5110619644889310, 78.5373089440004580, 86.3359815361360750, 95.1272123934792260, 102.9258849856148400, 108.9521319651263700, 116.7508045572619900,
            138.2491954427379700, 146.0478680348735700, 152.0741150143851100, 159.8727876065207200, 168.6640184638639000, 176.4626910559995000, 182.4889380355110400, 190.2876106276466400,
            202.9615848150912700, 210.7602574072268700, 216.7865043867384100, 224.5851769788740200, 233.3764078362172000, 241.1750804283528000, 247.2013274078643400, 254.9999999999999400 };


        private static double[] _withDB = {
            0.0000000000000000, 7.6868626613063098, 13.6267110582412330, 21.3135737195475410, 29.9787642921561930, 37.6656269534625000, 43.6054753503974270, 51.2923380117037340,
            63.7846048431222390, 71.4714675044285460, 77.4113159013634660, 85.0981785626697730, 93.7633691352784240, 101.4502317965847300, 107.3900801935196500, 115.0769428548259600,
            136.2671103126034200, 143.9539729739097400, 149.8938213708446500, 157.5806840321509700, 166.2458746047596200, 173.9327372660659400, 179.8725856630008500, 187.5594483243071700,
            200.0517151557256700, 207.7385778170320000, 213.6784262139669000, 221.3652888752732200, 230.0304794478818700, 237.7173421091881900, 243.6571905061231000, 251.3440531674294200 };


Values are then rounded up for RGB display.

I also noted displayed values when taking screenshots are not exactly calculated ones, that's probably because raw picture runs through further color/gamma adjustments before output.

What I do right now is pick closest value from table for each RGB value, calculate delta to real value for RGB and add up values, with and without dark bit, then picks the color with the smallest delta.
Posté le 29/05/2014 à 17:49 Membre depuis le 21/03/2014, 187 messages
I have made a color chart with these DAC resistor values compared to Furrteks palette tool (linear) and compared to the real system output (Neo-Geo CD).
It proves that you are right and real system has almost the same irregular steps between the values.

But in my opinion I would prefer a linear system because it is a lot easier to handle from the designer's point of view.
Because if I know any color with RGB values divisible by eight will be converted to an unique Neo-Geo color, I can a create Neo-Geo-safe color palettes much faster and can be sure it is displayable.
With an irregular system it would be much more complicated to calculate the "safe" values and I would have to verify any color to ensure that the color is a "safe" one or not.

rbg-values-blue2.png
Posté le 29/05/2014 à 22:31 Membre depuis le 28/01/2003, 160 messages
Kinda off topic but you shouldn't use blue to illustrate color values, as it's not very well perceived by the human eye: http://nfggames.com/games/ntsc/visual.shtm

Green is the way to go grin
Posté le 08/06/2014 à 19:58 Membre depuis le 29/05/2014, 24 messages
This looks awesome Michael. I actually found this on Youtube a a couple of weeks ago and was surprised I hadn't heard about it before. Keep up the good work!. Do you have plans to turn it into a full shooter with levels and bosses?
Posté le 25/06/2014 à 19:20Edité par NeoHomeBrew le 25/06/2014 à 19:54 Membre depuis le 21/03/2014, 187 messages
Hi CosmicR,

thank a lot for your feedback. Yes, the plan is to make 5 different stages with a big boss submarine / ship at the end of each stage boing

--
I have made a video today of the actual status of the game. The new features are:

- smoother submarine movements (slightly delayed acceleration & deceleration)
- scroll-back if no input (x-axis)
- submarine moves up and down if no input
- scrolling on Y-Axis added
- new animated waterline layer + cloudy sky
- collision detection on foreground layer added
- sound effects for torpedo launches and explosions

Posté le 25/06/2014 à 19:51 Membre depuis le 21/03/2014, 187 messages
Also, I have made a new color test chart (this time in green wink ) to verify which RGB value will be identified as an unique color after compiling.


neo-geo-green.png
Posté le 26/06/2014 à 04:49 Membre depuis le 28/01/2003, 160 messages
Nice progress.

I have a library update around the corner which includes an overhaul of the color conversion, don't waste too much time working out colors on this version smile