Weekly Recap #128-129: Back To Sugar (Patreon)
Content
These two weeks I've been working on important SUGAR features, such as screen rendering options, dynamic resolutions and controller support! (I've also been sick, that's why there was no recap last week, I had to slow down a little)
First off, I finally revamped the rendering (and scaling) of the pixel surface screen onto the actual screen so that it uses the GPU. (it used to be on the CPU) That gave off an important performance boost, which is very appreciable!
Then I went on to implement togglable fullscreen mode, borderless mode, window moving and resizing, and different scaling modes. We have the pixel perfect scaling (uses only integer scaling factors), the resolution-preservative scaling, and the stretchy scaling. All this is demonstrated in the gif above.
And then, I implemented the resizeable screen. When creating your game window with SUGAR, you have to choose a resolution for the game's screen space. (think of Pico-8's 128x128 resolution) Well now you can change that resolution at runtime. More, you can call 'screen_resizeable(true);' and the engine will automatically change the resolution of the game whenever you resize the window or switch between fullscreen and windowed mode.
All these things occupy a small, packed portion of the API, designed so that you only have to call one to three function to get the window to have the exact behavior you want, OR to let the player change the modes themselves in a settings screen. I'm very happy with it!
[VIDEO] => https://twitter.com/TRASEVOL_DOG/status/1051851307835887619
I spent the last few days working on controller support! I've been putting it off for so long but it's finally there, and it works, as proved in the video above!
At first it was the most boring thing! I had to read through most of SDL's Joystick and GameController API to understand how SDL handles it, and find out how I want to handle it in Sugar. After a few hours I had a draft of the system I wanted. The next day, my draft turned out to be seriously flawed, so I made some big corrections and read through some more of the API, and even looked into SDL's code for undocumented features!
In the end, here's what I have:
- The engine finds all the controllers plugged in and registers them. (the produced list gets updated when you plug one out, or one more in)
- You can assign any registered controller to a player.
- For each player you can register game controller inputs to check for through the existing button system.
- The system will check for those inputs on the player's assigned controller, if there is one.
- If the SDL has bindings for the controller you're using, you can use those for registering inputs. Otherwise, there's a ctrlr_query_input() function to let the player assign the controls themself.
- In the future, you'll be able to save all the button bindings of a player to a string, and then load those bindings on another player.
While working on all this I also made a few changes to the existing input system and noticed that there was quite some room for improvement, so I guess I'll be coming back to that system eventually. In the meantime, controller support is a go and works smoothly, so I'm happy with that too!
I do have to say that it's not exactly finished. Right now, popular game controllers are totally supported, but I want to go beyond that and also support cheap controllers, old joysticks and maybe even trackballs. But IndieCade Europe is coming up, so it'll have to wait...
... Because I have two important tasks this week in preparation for IndieCade Europe! (three if you include actually going to the event) I want to have a playable build of my Over The Top Breakout game! I haven't worked on it in over a month but as I recall, progression was the one thing that was missing.
And the second thing is to prepare my talk! I'll be giving a talk on (code, graphics and design) limitations in game development on Friday 19th, at 2:00pm. I'm going to talk about Pico-8, old retro games, the recent Minit (because it's a wonderful example for my talk), and SUGAR and the point of the talk will be about how to harvest personality and interesting designs from development constraints. If you're at the event, you should definitely come by, I promise to try and make it worth your time!
A written version of the talk will be available to my 8$ Patreon supporters sometime after the event!
Patreon is my main source of income at the moment and I'm ever so thankful to all my supporters on there! I couldn't keep on making my own stuff without them! Here are the names of all my 3$+ supporters:
☆Joseph White, ☆Spaceling, ☆Ryan Malm, Anne Le Clech, rotatetranslate, Andreas Bretteville, Austin East, berkfrei, Bitzawolf, Chris McCluskey, Christian Östman, Cole Smith, Dan Lewis, Dan Rees-Jones, Dave Hoffman, Flo Devaux, Giles Graham, HERVAN, HJS, Jearl, Jefff, Joel Jorgensen, Marcin Majewski, Marty Kovach, Meru, Paul Nguyen, Reza Esmaili, Sasha Bilton, slono, Thomas Wright, Tim and Alexandra Swast, Wojciech Rak, Zachary Cook, amy, Andrew Reitano, Brent Werness, Collin Caldwell, Finn Ellis, Giovan, Jakub Wasilewski, Pat LaBine, Qristy Overton, Sam Loeschen, Andrew Reist, hushcoil, Jacel the Thing, Jesse Bergerstock, Max Cahill, Pierre B., Sean S. LeBlanc, vaporstack, yunowadidis-musik
Please consider joining them if you can?
Those two weeks turned out to be pretty good! The progress I made on SUGAR was very important and I'm very happy with it!
This week I'm mostly preparing for IndieCade Europe!
Have a good week!
Take care!
TRASEVOL_DOG