Nintendo 3DS #Nindie game development blog 001 - Hello world

I didn’t think I would blog specifically about what I’m doing game development wise, but here goes.
It’s mostly a commentary about my random twitter and youtube posts.

I’ll try and keep the dev blogs not so wordy and long.
It will be technical but not in great detail.
I guess this blog is mostly for other game developers, programmers and gamers interested in how the ‘console’ game sausage is made?
Regardless, it reminds me of the few times I updated my Net Yaroze members site, so so many years ago!

The real start of this blog would be the huge post I wrote on Why indie developers should consider making games for the Nintendo 3DS.

Anyway, after the learning curve of the 3DS hardware & software, and getting the development environment working, came the hard part… the actual development!
DlrNnTaU0AAVXn8.jpg
[This is not homebrew, it’s #Nindie]

Coding graphics

Before getting started on 3DS, I developed with SDL & openGL (ES 2).
I’m far from a graphics expert so I struggled with openGL and shaders.
But keeping it simple, RGBA colour * UV (Alpha Texture) worked well and this is heaps for what I want to do, a DOS, early PS1 style.
Obviously, the openGL side is a lot easier to develop and debug then the 3DS!
And because I’m too cheap to get a real 3DS dev kit, I only get logs sent via a network socket from my 3DS test unit to my PC, which makes the 3DS side harder, but not impossible.

The period between start up and getting sockets working, I have no feedback expect for what the test unit tells me.
This is okay because that’s what a test unit does, ie bellow:

“I really learnt how to use a map file on the Net Yaroze in 2016,
a must for console #GameDev!☺️
0×0013aa2c
0×0013aa38 0×00000064 Code RO 6410 i._ZN2nn2fs6detail8FileBase10InitializeEPKwj platform_3DS.o
0×0013aa9c
Initialize function in platform_3DS.cpp bug 😏”
31 May 2018


DefxJgGVMAAkYIC.jpg

Once I got past the hardware initialization stuff and had logging streaming to see, I could actually start on graphics!

And well.. it was interesting to say the least!
I spent many, many hours getting the graphics working on the 3DS..
The long and hard hours you question your sanity!
Obviously, it’s not openGL, which is a big library, in retro terms anyway.

“My 3DS trying to do simple textured shaders :’(
Horrible way to spend a #gamedev Friday night!”
22 Jun 2018


DgSmY6UUYAIW22x.jpg

But the first time you do something new it’s always a struggle and I persevered!
It’s actually it’s very retro not to follow graphic standards, to optimally use the hardware 😊

And eventually… SUCCESS! The graphic coder’s version of Hello World!

“Oh the many many sad and miserable hours of just trying to get a simple rgb * texture working!”
25 Jun 2018


DghFCkwUwAA_t6j.jpg

You are seeing a triangle with a texture applied to it (orange with a angled white stripes) and RGBA ( Red Green Blue Alpha) applied to it on each vertex, top one is white, left is red and right is blue.

Special thanks to Matthew Gambrell for his 3DS expertise on the forums and Ryan Gordon for the 3DS SDL port.

Next, I had to port my “game engine” and it’s graphics to 3DS.


Porting the game engine

It’s not really an ‘engine’, it’s still very hacky and pieced together code!
It’s C/C++ (mostly C99) structs and math functions, vectors & matrices etc.
Lights are in software, ie calculated per polygon (flat shading) (or per vertex normal - Gouraud shading) and the RGB value is adjusted.
From whatever is inside the view frustum a polygon soup is sent to the hardware in a single draw call with a single texture 512×512 bound!
No lights, context or texture switching, bang!

This was mostly pretty easy, apart from the graphics, it was like developing with Android NDK (compiler stuff, ie setting correct memory alignment and correct type casting, etc).
Getting the engine graphics working on the 3DS wasn’t too bad after learning it.
But triangles are boring.. so what to render?


Modelling

I chose the OBJ format, it’s a very simple format and most 3D modelling tools export to it.
I’ve used fragmotion and Shade3D in the past, so I thought I would try something different again, Silo3D.
It’s pretty simple and has some powerful features, it also has a (very old) GNU Linux build!
But why not Blender? I hear you ask, because it’s huge like 3DS MAX, Maya and I’m not a modeller and I don’t want to go through that huge learning curve to do really simple stuff.

“Boring level culling stuff.. and the horrible logging I’ve been looking at for too long 😥
I don’t know how the old games did their levels,
I’m just using the obj format with creative use of layers and colours!”
27 Jul 2018


DjGBgViU0AAyU4S.jpg

DjGBhJmUUAEwQA_.jpg

[yes I use Eclipse IDE, I use it for Java, C/C++ and PHP]

Actually, I would bet most games use a custom BSP format for their levels… but that’s too complex for me right now.
My code subdivides the model level into ‘chunks’ which the engine does a frustum tests on instead of testing every polygon in that model.
I have two models, both are used for testing and debugging, but it’s easier working with small data.
My SDL/OpenGL view obviously doesn’t perform like a 3DS, but it’s a lot easier working on PC and then porting to 3DS.
So I have a few basic things working now, and it’s time for more game specific code.. but what game genre?


What game to make?

I have my preferences and I know my capabilities, but I thought I would ask the people that know more about 3DS games then me.

Reddit post: What game style would you like to see a solo dev release in 2019?
DjL-5TmUwAEbXx-.jpg

I’m still a social media skeptic, to me the feeds are too fast for any real ’social’ interactions.
But anyway, I was surprised at the replies.
There is a genuine need for new games on the 3DS!

Honestly, I suck at hell bullet shooters and never played a tower defense game :/
The Touhou series and Einhander on PS1 look really cool to me!

And here’s a 2 minute video of all of the above, so far.
[Sorry for the horrible quality, it was late and rushed]


Textures and fonts

So my rendering supports textures, but linking the OBJ file to textures is interesting.
Most modellers output a UV coordinates, which isn’t what I want.. because the 3DS is so under powered, I want my textures to be ’stamped’ or ‘brushed’ on each quad (like Doom and most N64 games).
So my material’s name tell my OBJ reader what texture to assign, ie: 1:255:0:0, texture number 1, and a blending of that RGB colour, simple!
And my font is just A-Z 0-9, I don’t plan on having a lot of text!

“Textures and fonts working..
seemed too easy🤔
#RetroDev 3DS nindies”
1 Aug 2018


DjgTj3FU4AAX5RE.jpgDjj3Sl-V4AAtPGM.jpg


what’s next

Boring User Interface stuff, menus etc.
A lot more OBJ trickary, ie scene & animation
Still not 100% sure on the game genre, but I am leaning more to the hell bullet shooter idea.

Well, that’s it.
Thanks for reading!


Mike.
@mgarcia_org

PS: Any questions, comments, feedback or corrections, feel free to leave a comment below.