Giter VIP home page Giter VIP logo

wiiu-space's Introduction

Space Game

Space game is a graphical shooter game on the Wii U! This is a homebrew application from 2016. To view a more recent PC port of it, see this repo.

Logo

Credits and License

This program is licensed under the MIT license, which grants anyone permission to do pretty much whatever they want as long as the copyright notice stays intact.*

*The song ~*cruise*~ is available under CC BY-NC-ND, and is excluded from the MIT licensing.

In game

Techniques and Info

Since it was originally designed to be executed via the .mp4 exploit in 5.5.x, there were several challenges that were imposed on its development in terms of efficiency and storage. Some workarounds to the constraints are detailed below.

Compressing Bitmaps

A fair amount of the filesize, even after compression, is due to the bitmap image storing that is employed. Images are stored directly in images.c, with the assistance of this script that converts a bitmap to a compressed C char array. The bitmap is then drawn via modifications to the draw.c library. It does not use GX2 at this time.

My compresion algorithm is a little complicated, but it is detailed at the top of images.c. It tries to store information about streaks of pixels as efficiently as possible. The way I did it only allows for 125 total colors in a palette. The algorithm can also be used to compress arrays, the trick is storing sequences of similar numbers as instructions, such as: {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} becomes {8, 1, 3, 0, 10, 1} (eight ones, three zeroes, ten ones).

Trig functions

A big issue I had using this program was with not using the standard math library. I was not able to get it working without the file size shooting way up. As such, I implemented estimations for sin, cos, and arctan in math.h. These are primarly used to calculate angles and spin the spaceship. I found myself drawing many right traingles on paper and reciting SOHCAHTOA over and over again before I finally managed to get it right!

(Pseudo-)Random numbers

This was another area that I struggled with. Fortunately, there's a method to get the current time, so that can be used as a seed. The implementation I ended up going with is based on an older version of glibc's rand().

Matrix multiplication

In order to rotate the bitmap to the angle calculated by the trig functions, I had to use a rotation matrix. This is actually a lot easier than it looks once you have the algorithm to multiply two matrices. What did stump me for a while is that the matrix has to first be translated up and left by half its height and width before rotating, since the rotation happens around the top left point. By translating it, you put the center in the top left, which allows for the rotation to take place around the center. This is then rotated back.

I also make use of a scaling matrix for explosions, which similarly gets multiplied by the bitmap when it's time to blow up

Creating bitmaps

I created my bitmaps in Photoshop using Mode -> Index color. I extracted the palettes manually by using a hex editor. I've provided the three bitmaps that I used in this repo, although the actual image files are not used by the game. There are other ways to create bitmaps like this (I believe older mspaint supports it)

wiiu-space's People

Contributors

compucat avatar creepermario avatar vgmoose avatar xhp-creations avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wiiu-space's Issues

Needs Configurable Options

Needs a configurable options menu to control various settings:

  • control mode
  • sensitivity
  • player select
  • difficulty/level select?

Properly Looping Background Audio

Currently, @DimOK's resource functions define that an input audio file being played as background music must be played entirely, from beginning to end, and then played again.

I feel that it is a much better idea to implement an A-B looping setup, as shown in the screenshot below.

screen shot 2016-11-30 at 8 11 09 pm

In this screenshot, there is a highlighted portion of the Space Game soundtrack (~*cruise*~ by (T-T)b). We will consider the left-most portion of the highlighted area as point A and the right-most area of the selected portion as point B.

In Nintendo titles, the track will play from the beginning, past point A and continue to point B. Once the sound reaches point B, it traverses back to point A and continues playing there.

In this example, we play ~*cruise*~ from the beginning up until about 1:41, where we jump back to 0:15 and continue playing. This creates a sound that continues playing, without having to repeat the entire file.

The only issue with implementing this, however, is @DimOK's library permits users to load custom sound files into the game by simply placing them on the SD card. If the user adds a custom soundtrack, that means that the same hardcoded looping values used for ~*cruise*~ will be used in the custom soundtrack.

This means that, in order to implement this without bugs, we will need to either remove modding support (hopefully not) or provide an interface that allows the user to use custom looping values, or not use looping at all, and just repeat the entire file.

If there's anything you don't understand, feel free to ask, as I kinda rushed writing this due to time constraints.

Note: The name ~*cruise*~ was put in code blocks because of this: cruise
The name of the song was purposefully rigged so that it can't be mentioned in Markdown!

Persist level progress

Since the level passwords are randomly generated into an array, could this array be saved to a file and obfuscated if necessary? That way you can use level passwords across reboots of the game. Of course this may not work for 5.5.0 users who have to do the browser loading method and don't have permanent storage. I just hit level 16 by the way.

I can't shoot any lazers

The spacship flies around and around, but I just can't shoot the enemies. Why can't you shoot with the right-stick or something? That would be awesome.

Sound in RPX

In the wut branch, the RPX needs sound!

This would preferably be done via a content/ folder rather than by being embedded into the RPX

[HBL] Crashes when rotating!

See commit here: 961eb9c

Very weird behavior... Assigning to target only crashes if the math above it is performed. If the math is not performed, then it won't crash. I'm not sure how doing that math could affect target. Maybe the my_sin and my_cos functions are broken, however they are also used for determining the bullet angle, which does work.

This is the reason that makeScaleMatrix works however, and makeRotationMatrix does not.

@xhp-creations any insight? ๐Ÿ˜…

Trying to shoot lazers with touchpad

I figured out how to shot the lazers, but now I don't know where I am shooting. I can't look at my TV and gamepad at the same time. It's too complicated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.