Homebrew Question What's a good way to start learning how to make switch homebrew?

ButtonMarkedErase

Active Member
OP
Newcomer
Joined
May 25, 2019
Messages
36
Trophies
0
Age
22
XP
371
Country
United States
Hi! I wanna make games for the nintendo switch but I have no clue on where to start. What languages/engines should I use? I don't know any language so I'll be okay with anything since I'll need to learn it haha.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
As with most things the short answer is going to be "it depends" and the longer one will first see you have to learn some of the basics of programming to make real sense of it.

Jumping right into the Switch... some would say maybe start with a popular device like a PC if you have never coded before but if it is coding for the Switch that will make you stick with it then I can see it happening.

The closer you get to manipulating data going into and out of the processor in your code the faster it will theoretically be or could potentially be. Classically this would mean learning the assembly for a system, which you still did benefit from on the DS and even 3ds, but probably don't need to do for homebrew these days.
Next up is a variety of languages but most are going to look at the C family starting with C itself.
C then gives way to C++ which also affords some serious niceties (object oriented programming doing rather well for games).

Beyond this then it will depend what the Switch has available, and this can include the port of Linux to the Switch ( https://gbatemp.net/threads/l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/ ) which will come with a complement of programs including interpreters for sometimes very high level languages but definitely things like python, maybe PHP (though this is more of a web development language), lua, maybe some Java (android uses this), possibly Ruby and on and on and on but will need you (and any users of your homebrew) to have said Linux installed or for the thing running it to be ported to the Switch (which might be easier said than done).

Libraries and engines then.
As there are basic things that everybody will want to do then even some assembly development setups will include a measure of library support (though don't assume there will be any for a given system) but definitely when you get to the likes of C and C++.
The author of the compiler/development environment will likely have ensured a lot of the basics can be done fairly easily by including the libraries and calling the functions they have, you will get to learn these. C and C++ both feature a standard library of core functions so you can also expect that (and probably spend some time learning those).
In the case of things like devkitpro ( https://switchbrew.org/wiki/Setting_up_Development_Environment ) then the same authors that ensure the standard libraries for C and such are available will also do their own (libnx being the one devkitpro has).
Other authors will also release libraries to do certain things, or behave like other libraries on other systems people might be more used to. Switch homebrew is a bit less popular than some of the older systems (and likely always will be) so we don't see as much of this these days, but there is still some of it going on.
Not all libraries will work with/be easily available in all languages, going up and down the chain though things in higher level languages can often call lower level ones, and in some ways you can make a standalone program in a higher level language to perform a task but you would only do that for things you might be able to afford to wait a second or two for. Generally though stick to libraries available in the language you are using.

Engines are in some ways a super advanced type of library but contain most things needed to make a game, and probably an example that serves as said basic game. There are hundreds of these, though fewer likely ported in any sensible manner to the Switch. RPG maker is an engine, unity is an engine, unreal is an engine and this could go on for a while. Not all engines will be available, or at least legitimately available, to you as the lowly homebrew developer either -- while I fully expect game developers are all over the world right now looking for people to work on their Switch game and have experience of unreal it is unlikely there will be a free version for you to use to make your homebrew. I don't know what is available at this point other than "not a lot" and frankly jumping right into an engine will probably limit your development of programming skills and gain you not a lot for it.

For coding itself then I have a thread up on the matter for the general case.
https://gbatemp.net/threads/so-you-want-to-learn-to-program.371255/

Once you learn some C or C++ you will then be able to start making sense of what libnx does and go more from there.
 

tallbl0nde

Well-Known Member
Member
Joined
Jan 11, 2019
Messages
147
Trophies
0
Age
24
XP
1,538
Country
Australia
If you're looking to create a game or anything else that doesn't require access to the Switch's data (eg. user images/names, installed games...) I'd recommend looking at LOVE: https://love2d.org/. LOVE is a 2D game engine which you program for in Lua. Lua is one of the easier languages to start with (in my opinion) and is similar to something like python (don't quote me on that!). The game engine is currently being ported by TurtleP and can be found here: https://github.com/TurtleP/LovePotion. Most of the important functionality is implemented, you'll only start having issues if you try to delve into deeper things like threading, for example. The best thing about using LOVE is you can edit and run your lua scripts on your PC. Then, when you're ready you can compile it and send it over to Switch, where 99% of the time it should function identically to how it did on the PC.

The downside of using LOVE is that it's slower than having written and compiled the same thing in C/C++ (I won't get into why). You'll need to use C/C++ if you intend to write software that can interface with the Switch's OS (ie. use libnx). C/C++ doesn't hold your hand, however, so if you program something incorrectly and it isn't something that's picked up at compile time you'll probably find that your Switch keeps crashing... but it's all part of the learning process :)

If you're going to go down the C/C++ route I'd recommend starting out on linux, and writing a few basic programs there to get your head around the language first. Then once you've got a rough idea, you can move over to the Switch, where the only difference is that you now have a few libnx functions to retrieve/store data from Horizon.
 
  • Like
Reactions: mathew77

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Well start walking towards them +1