Sunday, June 30, 2024
spot_img

Full UI Upscaling, Half 3: Dynamic Terminal Swapping


I used to be actually completely happy to have give you workable idea for a modal stock, in addition to producing a mass of mockups with confirmed options for all of the potential hurdles on the highway to dropping 15 rows from Cogmind’s interface. Or so I assumed.

Immediately on the finish of that course of, a overview of remaining UI programs revealed an sudden show-stopper: ending animations.

Cogmind has numerous totally different endings (at present 9, with extra to come back), and all of them function full-screen ASCII animations. Whereas a few of these are versatile sufficient to suit dynamically inside any terminal dimensions, a very good many had been designed to imagine a peak of 60 rows. The one strategy to match these into 45 rows can be a whole redesign…

I put numerous time into the present animations, they usually make good use of their area, so one would hope there should be one other manner…

Terminal Swapping

What if… the terminal was nonetheless 60 rows throughout ending animations?

In any case, there’s no sturdy want for the endings to be restricted to solely 45 rows–you’re primarily watching these animations for the general visible impact relatively than needing to interpret each little element for gameplay functions. As described on the starting of this sequence, the rationale for shrinking the bottom terminal dimensions is to allow bigger fonts throughout the board, however the intent there may be to facilitate studying and deciphering particulars, which we don’t want on this case.

So the idea is we use a 45-row terminal for regular play, however as soon as we have to do an ending animation merely swap over to a 60-row terminal to show that, then swap again when executed.

This jogs my memory of video games that swap to a unique show mode particularly for lower scenes, particularly widespread (and noticeable) in early video video games, after which later it grew to become a giant deal when these kinds of issues might be executed “in engine,” which is the norm these days. Cogmind has all the time been constant about its show, however on this case I might ideally proceed to utilize all of the work that’s already gone into the animations.

Now come the essential questions: Is the engine structure able to such a function, and what different roadblocks is perhaps in the best way?

Technically the thought instantly confirmed some promise based mostly on the truth that Cogmind already makes use of what I name “terminal swapping,” however solely between frames and behind the scenes, particularly for particular screenshotting functions.

The primary utilization is for map output, or making a composite PNG containing the whole present identified map. That is helpful for sharing attention-grabbing layouts with different gamers, or asking for recommendation about the place to discover.

cogmind_map_output_sample_terminus_research

Map output shared by Terminus, displaying a circuitous route by Analysis whereas searching for a selected exit (which ended up being close to the doorway :P). (open for full measurement)

I additionally used it to provide a picture marking the launch of Cogmind’s achievements, for which I wished the background to be a matrix of many achievement icons.

Cogmind 256 Achievement Icon Matrix

A picture celebrating Cogmind’s first batch of achievements, added in 2018. At some point that quantity goes to get a lot greater.

Each of those use circumstances required producing a picture bigger than the display, so a standard screenshot wouldn’t do.

Already armed with a built-in strategy to take a “screenshot” of the terminal contents (bypassing the display itself solely), if we construct a bigger terminal than the display we are able to simply as simply run the “screenshot” course of on that to provide a good bigger picture.

With only a small little bit of remoted code it’s fairly straightforward to quickly substitute the engine’s terminal with considered one of a unique desired measurement, write to that, generate the picture, then restore the unique terminal as if nothing occurred. We’re not really rendering to the display itself so decision doesn’t matter, we don’t want to alter the video mode, none of that is ever displayed, nor does any outdoors interplay happen.

This was a promising place to begin, at the very least offering a theoretical strategy for our ending animation administration.

REX, Once more

The above preliminary examples of primary terminal swapping are just about solely Cogmind-side. Because it’s occurring between frames for the only real goal of making a picture utilizing the conventional system, the engine doesn’t must know or care about what’s happening. All that was wanted was a easy operate permitting the foundation terminal to be swapped out for one more one.

Taking the subsequent step and swapping the terminal with a brand new one that might exist for an extended period, and even contain some degree of participant interplay, can be a way more difficult course of, that means it’s as soon as once more time to revisit the engine to increase its core capabilities, like I did not too way back with the quads and octs powering the map zooming system.

Additionally as soon as once more, as an engine function it makes extra sense to go again to the easier engine testing atmosphere to construct and debug it, relatively than utilizing Cogmind itself.

I used to be happy, and shocked, to search out that terminal swapping of an prolonged nature actually wasn’t an extremely advanced operation with many repercussions. So far as the engine was involved, it solely required altering a handful of core variables, though past that I needed to resolve some cursor-related points, like crashiness associated to its display place and hover knowledge, and the software program cursor soiled rect standing.

cogmind_source_REX_swap_root_simplified

A simplified view of the supply code for REX’s terminal swapping course of. Swapping again is actually simply reversing this process (usually dealt with by this identical methodology, however I lower all that out within the curiosity of readability).

It took a few day to implement terminal swapping and work out all of the kinks.

rex_root_swapping_first_success

The primary profitable root swap in REX, quickly changing the usual 80×60 demo terminal with a 120×90 terminal, whereas switching the font measurement from 6×12 to 4×8, so the window measurement stays constant. This habits simulates what can be required to run Cogmind’s animations utilizing a smaller font whereas sustaining the identical decision.

The following stage in constructing this function can be to import it into Cogmind whereas altering as few variables as attainable. It doesn’t must be particularly for endings, and we don’t even want to start out by really altering the terminal dimensions–simply swapping from the default 60-row terminal to a different 60-row terminal and again can be ample to weed out any points with regard enter or different primary performance. One step nearer to an actual use case state of affairs. That went high-quality as effectively!

When and The place

Having handed an easier check, it was time for the true factor, however precisely the place is the very best alternative for a swap to happen? Swapping is a fairly vital cutoff, in spite of everything, forming a transparent barrier between what’s earlier than and after, and there shouldn’t actually be a lot speaking between the 2 sides, at the very least not on an interface degree.

As said originally, the purpose right here was to permit animated endings to make use of 60 rows as a substitute of 45. Given the simplicity of terminal swapping on the engine degree, it appears straightforward sufficient…

As so many issues are, up shut it now not seemed really easy.

I initially imagined simply having the animation section of the ending in a unique terminal, and tried that for a bit, however the endings (there are such a lot of xD) are a comparatively advanced assortment of lessons and processes since they combine and match totally different elements, and it was actually laborious to untangle what wanted to be untangled. Even earlier than contemplating swapping wants, it seems that in lots of circumstances the method entails a number of home windows in various states of visibility and overlap. Whereas swapping proper earlier than an animation can be attainable, it might doubtless be fairly powerful to each implement and debug.

Then a brand new thought popped up: How about as a substitute of focusing so tightly on the animations we transfer one degree larger and deal with the complete recreation over course of in its personal separate terminal interface? This would come with the usual recreation over display (losses as effectively), stats, and restart menu and many others. This can be a a lot cleaner break, far simpler to drag off with out worrying about any critical issues.

cogmind_root_swapping_first_success

The aftermath of the primary [mostly] profitable root swap in Cogmind, having gone by an ending and beginning a brand new run. A few of you’ll acknowledge what’s happening there… Clearly some bugginess to be resolved, nevertheless it didn’t crash and we’re again in motion for a brand new run 😀

The one disadvantage is that stated stats display would then be within the 60-row terminal interface utilizing the unique font measurement. In different phrases, again to the smaller font. Nonetheless, this is perhaps high-quality because it’s 1) simply textual content, 2) not numerous textual content, 3) solely in that one spot, though if we wished to we might maybe use the brand new zoom textual content font measurement to show it. Doing so would require decreasing the variety of listed stats to be able to match within the out there area, at the very least if attempting to maintain the vertical design. They’re solely a tiny subset of these discovered within the huge scoresheet knowledge, anyway, however I don’t like the thought of additional slimming down the already quick consultant listing, so it’s both settle for a smaller font measurement for that specific display, or ultimately go so far as a extra vital redesign that makes extra use of horizontal area. I attempted a couple of mockups however didn’t like all of them, so nothing will most likely change with that initially.

Whereas engaged on this entire terminal swapping enterprise I additionally occurred to find that in case you handle to shut the sport window throughout an ending animation (together with the loss animation), it might not overlay the separate program shut animation that I added some variations again. This isn’t an unusual incidence, inadvertently uncovering obscure bugs in outdated, or in some circumstances very outdated, components of the supply that had been merely by no means encountered or seen earlier than. All the time a very good alternative to remain alert and sort things 🙂

cogmind_exit_program_during_death_animation_fixed

A snapshot of what it appears to be like like if closing Cogmind through the loss animation, together with the brand new zoom font used for the strip added in Beta 13. Technically at this level the terminal is swapped as effectively.

One ultimate notice: For an article about new tech to help ending animations, there’s a curious absence of samples demonstrating the first use case, however I figured I’d depart these out 😉

That is the third in a multi-part sequence about constructing Cogmind’s totally upscaled semi-modal interface format:

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles