The Making of MULTIDEFENDER: Exploring the Demoscene
Demoscene? No, I didn't hear that one
In the late 70s, the first home personal computers available to a wide range of consumers began to appear in the world. These included the Apple II, TRS-80, the first Commodore models, and other computers. These computers were intended not only for games, but also for teaching, programming, computing and design.
Around this time, enthusiasts began to appear who sought to make the computer do something amazing and unusual, not just calculations for spacecraft and nuclear rockets. So, these people formed a new cyber culture - the demoscene, the peculiarity of which was the creation of a demo - a story video sequence created by a computer in real time. Basically, a demo is a symbiosis of art and programming. Over time, the demoscene acquired a competitive character, and people began to organize demoparties - events where the creators of the demo met and held computer art contests.
The main genres of demoscene are demo, megademo, trackmo, and intro (small demos, limited in file size: 64kb, 16kb, 1kb and even 128, 64 and 32 bytes!). But that's where we will finish talking about the history of demoscene (you can read more about this subculture on the Wiki), and instead move on to the culture’s current activities, and even a peak behind the curtain of making a demo.
Demoscene today
Oddly enough, the demoscene is still alive, and demoparties are held on a regular basis around the world. For one of these demoparties, we decided to create a small intro, the purpose of which is to invite people to another party. Such a subgenre is called invitro (invitation + intro). Thus, our goal was to complete several tasks: create an intro, show it on a demoparty, and invite all the guests of this demoparty to our party in Russia. And that’s what we need:
- Demoparty where we will show our intro. We chose Revision 2020, which will take place annually in Saarbrücken, Germany.
- The platform for which we will be creating the intro. We chose NES, because we love NES.
- Demoparty, to which we will invite people. Multimatograf 2020, Vologda, Russia.
Since the NES capabilities (we chose CNROM mapper) are quite limited, we decided to create a simple scroll, like old Commodore 64 intros. We also decided to add an equalizer effect based on the Multimatograf logo. Despite its simplicity, our intro was ranked 7 out of 10. Let's watch the whole intro (party release).
Now it's time to figure out how it works, from start to finish.
Logo + EQ
It was this main part of the intro that was created first. We came up with the rest as we worked on the creeping line. We went through several gradient and logo options that we placed on the background layer of the console:
Until the current one was finally approved:
In order to make the blue gradient and the red logo, we had to use 3 palettes with common colors in each of them:
We wanted to create the illusion of a stationary gradient and a “flying” logo, so we decided to use a checkerboard gradient.
As it turned out later, this was a mistake, since chess-like dithering on CRT TVs will look completely different from what it looks like in the emulator:
Indeed, this moire does not look very good. However, since the background had already been created, and the intro was supposed to be shown from the emulator, we decided to leave it as it is.
Outcomes:
- The background and the moving logo are one piece. No sprites, just a solid background.
- A sinusoidal horizontal path controls the position of the entire background.
- To "separate" the background and the logo visually, a "european" chess style was chosen + added corner sprites in the middle of the screen on the right and left edges to further strengthen the illusion of a stationary background.
Scroll
The creeping line is separated from the main screen by a zero-hit. This technique has been used in many classic games, such as the HUD in Super Mario. But unlike Super Mario, both parts of our split screen have their own independent scrolling. It is very simple to implement one-way scrolling on the NES, in fact, all platformers are made this way: each new character (or landscape column in the case of Super Mario) is drawn in the next nametable every +16 pixels, then the camera moves 16 pixels to the right, and everything is repeated again.
To improve scrolling, two effects have been added:
- Smooth shift of the text color. To achieve this, we rendered the font with a checkerboard texture: even pixels with one palette index, odd pixels with another. Then we rolled the colors of these pixels one by one: first even, then odd. As a result, we got intermediate colors between the existing colors of the NES palette, so that visually the color change looks smoother.
- "Jumping" of the scrolling to the drum beat. To do this, we had to work with the buffer of the music player (famitone2) and its noise channel, and added a vertical one to the horizontal scrolling.
Outcomes:
NES allows you to split the screen into at least two parts, each of which can be scrolled autonomously. These two parts were enough for us both for the logo and for the scroller.
For clarity, we propose to see how the upper camera of the logo looks inside the console:
And the bottom one:
NESDEV logo
In fact, our team has little in common with the Nesdev Community, which we love and respect so much. This is also the name of the Telegram channel, in which we discuss everything related to consoles, their programming, and news. The look of the logo was chosen by analogy with the Titan logo in their Overdrive demo, which, in turn, parodied the style of Sega's corporate logo. l thought that went well:
But due to the limited amount of free space on the cartridge, after some revisions, it was decided to remove the large fade tables, so we made the fade effect simpler:
Also in the final release, we added a few details so as not to steal the name from the Nesdev community:
Vologda lacework
First, we googled the reference of the matching patterns:
Then we adapted it for the NES:
This picture contains 387 unique tiles, while a single NES page only allows 256 tiles.
To display the remaining 131 tiles, we also used the zero-hit technique: the first graphic page is displayed before the split, the second after.
Bank 1
Bank 2
Or that way: tileset #1 and #2
The palette has 3 colors + background. So we can implement 4 phases of monochrome animation within one tile using a combination of sprite tiles and background tiles.
To do this, we draw the first three phases of animation in the sprite tile with palette indices 1, 2, 3 (for clarity, each phase is highlighted in red, blue and green, respectively) and the background tile as the fourth animation tile.
In theory, it looks like this:
Phase 1: palette index 1 = white, others = background color (black);
Phase 2: palette 1 and 2 = white, others = background color;
Phase 3: palette 1, 2, 3 = white.
Phase 4: remove the sprite and print the final phase using background tile.
Let's see what happens in the console sprite layer at this time:
In order to simplify the work, a prototyping utility (javascript + html) was created:
Intro, game and corona
Among other things, we decided to fill the empty space of the cartridge with our next idea: we touched upon the “coronavirus” hysteria that is relevant today. And, looking at how the date of the Vologda party is postponed due to quarantine, we decided at all costs to “protect” the Multimatograf party from the coronavirus. We created several spline trajectories along which the viruses were supposed to fly, and placed the spacecraft at the bottom of the screen.
We assigned pilot Kevin to control the spaceship, then we created sound effects for the appearance of viruses chains, as well as a score counter, and a greetings list like a High score table:
But since there still was free space on the cartridge, we added a boss:
Inspired by the Castlevania boss, our bat has been refined into a great addition to our intro:
This was not enough for us, so we added a high score table, a screen with instructions, and we also redrawn all the sprites so as not to use the draft sprites that we borrowed from existing games (Galaga, Legendary Wings). So, we have created a simple - but quite suitable for tournament competition - game with unpretentious gameplay: in a limited time, the player must destroy as many nasty viruses as possible and score the maximum number of points.
Manual:
- Wait for the opening effect with Vologda laces to complete, after which the game will start in autopilot mode. You can read the text, or you can play.
- You can watch the intro, read the scrolling text and watch the pilot Kevin destroy viruses, or...
- Push the "Start" button.
- Shoot the viruses as fast as possible: there is not much time for the battle - only 6 minutes.
The time is displayed in the upper left corner as an hourglass icon. Approximately a minute before the end of the game, the clock icon will flicker, indicating that the time will expire soon.
Enemies attack in waves: 3 waves of viruses (“super viruses” may appear in each of these waves, it is not recommended to miss them, as additional points are awarded for them). After the completion of 3 waves, the boss spawns, then the game cycle repeats again: 3 waves and the boss, until the time runs out.
The boss has 10 hit points, for each of which the player earns 1 point. Additional points are awarded when you defeat the boss.
With each hit on the ship, the player loses 1 hit point and is temporarily stunned. If an encounter occurs during a boss fight, the boss regains 1 hit point.
Outcomes:
- We participated in the Revision demoparty;
- We invited everyone to the Multimatograf demoparty;
- We made a invitro (gamevitro though) for a platform that is unpopular at the scene.
- We are great because we finished the work in a little over a week.
We also took care of the music, using one of the old Soviet pop hits as an intro and covering this song for the main soundtrack with a nice bass line and funky beat.
The music was prototyped with the Vortex Tracker, ZX Spectrum chiptune editor.
Then we transferred the score from this tracker to FamiTracker and polished it up.
We wish you well. Play games and watch the demos!
Credits
Code, sound fx: Alexander “mr287cc” Tokmakov
Code, fx, graphics, javascript: Alexander “TMK” Solodkov
Music, sound fx: Oleg “n1k-o” Nikitin
Hardware wizard: Vladimir “dude_bfg” Ivanov
Mastermind of the pack: Damir “Adam Bazaroff” Nasyrov
Cart manufacturer: Mega Cat Studios
Source code: github
Playable ROM file (final release).