Do you debug by printing or inspecting? Is your logger function better than mine?

I'm interested: do you mainly set braikpoints to freeze your app and inspect values, or do you print values? If so, how do you process a long list of print statements?

Myself, I wrote a small "log" class to wrap the print statement. This way, I get 3 columns in the console window: time of calling (leading zeros), who called and the message. It also allows me to skip tostring() every time I print :slight_smile:

1 Like

when I was in lua, I had a basic logger that had 4 enum states defining severity you could provide it [warning, info, error, critical] and a group identifier. you could then set a global variable to control what severity gets output and provide a wildcard string to filter based on the group identifiers.

I still have it (minus the wildcard functionality) since I moved to C, but I just use visual studio's debugger which I've really come to like.

2 Likes

Good tips for searching and priority filtering, thanks!

Are you working on a game that requires C performance?

yeah, you can go really far with lua on the system (IME) so I wouldnt be discouraged! I just had a pretty intensive (computationally*) game that didnt quite fit (one ex: https://twitter.com/superfunc/status/1622815423719960576?s=20)

(*)

  • lots of animated items updating every frame (~30-40)
  • collision detection per frame (some day ill write up how I did this)
  • aggressive out of bounds culling
  • level/enemy pattern streaming

and probably a bunch of other stuff im forgetting, which resulted in me writing my own rendering routines, memory allocation system and collision system :sweat_smile:

2 Likes

Looks great! I emailed with your music designer after you tweeted about it :slight_smile: great game type too, I bought 2 for PS5.

Looking at season 1, I think we need more action games. I’m working on a platformer, loading lots of converted Blender animations. I just can’t bring the hardware down, no matter how much I load :slight_smile: but if you’re doing bitmap calculations, that’s another thing. I love that more and more Lua calls are very convenient and fast, like getting a faded copy of a bitmap or quickly inverting the screen.

We’ll see some very complex games in the coming years. If devs like us keep investing :slight_smile:

2 Likes

definitely, would love to see people take the performance baton and push past what I've done, as well as more and more arcade & action games for the system :slight_smile:

2 Likes

I use a mix of

  • on screen overlay
  • debug hotkeys to print values on demand (Simulator SDK feature)
  • print logging
2 Likes

On screen overlays is a good one too! I have a menubar that shows many numbers in debug mode, a bit like iStatMenus on Mac.

1 Like

I'm interested in your mention of tostring(). I don't think I've ever used it?!

My favourite thing to do with print is the built-in tab delimited output, eg. print(a,b,c)

Ah, didn't know print accepted multiple values. So I was always joining all my values into a single string, which requires you to toString() them before you can concat :slight_smile:

1 Like