Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

#1 2021-06-11 16:21:44

pajcek
New member
Registered: 2021-05-25
Posts: 4

How sparingly should structs and typedef structs be used?

Hello!

Reading through some documents I have, there is always focus on being the most minimal and efficient one can be. Somewhere I read that you should always choose global variables instead of local ones, etc.
But I am confused as to just how minimal one should go?
Should one not use structs, but just arrays?
Should one not use arrays, but use specific global variables?
Should you not have a lot of functions and helpers, but write every piece of code manually in the global scope?

I read somewhere there were more than 70k "clock cycles" per frame. That sounds like enough to handle anything you throw at it.

I don't know. can you give me some insight? Thank you!

Offline

 

#2 2021-06-15 16:16:42

bbbbbr
Member
Registered: 2019-03-04
Posts: 127

Re: How sparingly should structs and typedef structs be used?

If youa re using C / GBDK, here are some general guidelines. They aren't "final rules", but rather guidance to help avoid common problems and get better results.

https://gbdk-2020.github.io/gbdk-2020/d … lines.html

The Emulicious emulator has a profiler which can help you understand where the CPU is spending the most time.

In general, if you aren't doing much then there is often enough CPU horsepower. But when games become more complex and have more going on, it's not uncommon to run into the limitations.

Last edited by bbbbbr (2021-06-15 16:17:47)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson