Limitiation or compromise if write program in c

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Limitiation or compromise if write program in c

Post by DRW »

GradualGames wrote:While I can imagine smarter folks benefiting from it, I just couldn't get used to it.
It doesn't really have to do with being smarter. In fact, I would actually prefer to be able to write code fluently in Assembly because it gives you control over every single byte that ends up in the ROM.

But while I can read and write code in Assembly, it takes much, much longer for me than it does in C.

I could never write a whole game in Assembly, but I've been programming in C-like languages for 14-15 years, so writing a game for the NES in C is easily doable for me.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
na_th_an
Posts: 558
Joined: Mon May 27, 2013 9:40 am

Re: Limitiation or compromise if write program in c

Post by na_th_an »

I think it has to do with your background. I've been coding games in C since I can remember. Before trying the NES, I had already completed games for several retro platforms... in C. So it feels natural. When you are my age and you have my (lack of) spare time, it's hard to empty your glass and start anew. In my case, besides - I'm not a very constant person. I have new ideas faster than I can make them real, so I just need results, even if they are not optimal.

So, long story short: I prefer C mainly because I can get results from it *now* and *fast*. And I'm pleased with such results.

Besides, it's entertaining to fight the compiler and try to get the most of it.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: Limitiation or compromise if write program in c

Post by GradualGames »

The ironic thing is I actually did make some small games in C for DOS years ago, then I was employed doing C/C++ for several years. So I apparently know the language well enough to have a job doing it, but on NES I just couldn't get used to it. I think I ran into at least one situation that I really had no idea about. Like, something in the cc65 compiler was stepping on variables I was allocating in my sound engine or something like that, and I couldn't figure out why. There's just so much noise like this to worry about. Doing C on a PC you rarely have to think about the actual linker configuration, on the NES it appears necessary to understand these things really well. Which I do, in pure asm. With cc65, it's like I suddenly have to understand the compiler itself in order to use it effectively. That's how it felt to me, irrationally, in any event.

I think the key phrase there na_th_an is that you like to fight the compiler to get the most out of it; I found this act too frustrating; I'd rather just write the asm code. By the time I was done wrestling with the C compiler I would have written the asm anyway, haha! :lol:

*Edit* I'll have to say though to answer the OP: I keep seeing amazing homebrews made in C. I don't think it would be a compromise, especially since you already know asm and can use it to get over performance issues. It really boils down to whether you're interested in the language and enjoy working with it on NES. So I'd say give it a try for a few months like I did and you'll quickly find out whether you like it or not.
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Limitiation or compromise if write program in c

Post by Banshaku »

@GradualGames

I guess the main reason I'm investigating if I should try in C or not is it has been sooo long that I didn't touch asm code that either of them will feel "unnatural" in the beginning anyway :lol: but in some of the game logic could be used in other scenario (for very basic games) then it could be interesting in C. I will try it soon.

An example of very good homebrew that came out 10 days ago and done in C but on another platform (sms) is Silver Valley. For such a long game I was quite impress by the result. Not to say that there was no good C homebrew on the nes (na_th_an and DRW have shown that is quite possible to do so).

Can't wait to touch some code after all those years.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: Limitiation or compromise if write program in c

Post by GradualGames »

Garth wrote:GradualGames, I had those problems and a lot more. I have partly come to the opinion that even for intelligent people, which programming language approach works best for a person depends partly on what kind of brain they're born with. For me, Forth was a natural. My enjoyment of assembly has also increased in recent years as I have done more to raise the level of the language, using macros to make nestable program structures. I really cannot understand how anyone could go for C.
Cool site. I've been building up my own set of macros to help, haven't taken it this far yet though. Maybe it has to do with one's comfort level with relinquishing or delegating control to something else. With assembly and macros, you maintain control. I like it this way.
Post Reply