PONG [PICO-8] Mac OS
Mac OS Build (Updated!) 59 MB. Just recently discovered this game and I have to say that I absolutely love the idea of a mixed pong genre! On Mac OS X, a folder or.love file can be dropped onto the love application bundle. On the Mac Terminal (command line), you can use love like this (assuming it's installed to the Applications directory). It’s a game of Pong, which, if you search the Mac App Store, is already available in many other iterations for macOS.But Sardesai’s version isn’t played in a window you’ll need to hide.
- Title Developer/publisher Release date Genre License Mac OS versions A-10 Attack! Parsoft Interactive 1995 Flight simulator Abandonware 7.5–9.2.2.
- Note: PICO-8 overwrites the config.txt file each time you exit the app. If you open PICO-8, edit the config file, then exit (or restart) PICO-8, you will lose your changes. Close PICO-8 before editing config.txt. Settings may be changed during runtime using the config command. For information on configuring game controllers, see Controllers.
In this tutorial series you will learn how to make a simple single-player Pong-like game for the Sega Mega Drive using SGDK! If you just want to see the full source code, you can get it from Github.
Megapong 1 - Hello Mega Drive World!
Welcome to my new tutorial series on Mega Drive development! In it we will be creating a Mega Drive game from scratch using SGDK, the Sega Genesis Development Kit. This awesome piece of software allows you to program games for the Mega Drive in C instead of ASM, which makes things a whole lot easier. I will show you how to set up your development environment, how to import graphics, how to put things on the screen, how to control them and have them collide…
And this is what we will be making:
I call it Megapong. It is a very simple single-player Ponglike where the goal is to keep the ball in play for as long as possible. Each time you hit it you’ll receive points and when you’ve hit the ball a certain number of times, it’ll get faster. The game is over when the ball leaves the screen at the bottom. No it’s not gonna knock any blue hedgehogs off the shelf, but it’s a very good game to learn the basics of Mega Drive programming. And that’s the whole point!
This tutorial will lead you through every step of making this game, from setting up your environment to the collision code. While I will try to make everything as simple and accessible as possible, don’t forget that coding for retro platforms is tricky. If you run into any issues, don’t hesitate to post them in the comments below!
And one last thing before we start: If you like what I’m doing, please consider supporting me on Patreon. I’d love to do more of these tutorials on a regular basis, also expanding to other genres like platformers. Becoming a patron lets me make more time for these, and it gets you some cool perks too!
Alright, without further ado: Let’s get this show on the road!
Setting up SGDK
First we have to install and set up SGDK. You can download the latest version here. Please note that out of the box, SGDK only works on Windows. Linux users can give the Gendev Project a try, of which there also exists a Mac OS version here. Keep in mind that I have used neither of these and thus can’t really help with setting them up. The actual coding will work the same across all platforms, since all environments use SGDK, but the stuff around it (setting up folders, toolchains etc.) will most likely be different.
Note: SGDK requires Java, so you will have to install that as well if you haven’t already. The latest version of SGDK uses Java to compile resources, which lets it do some pretty powerful and cool stuff.
Once you’ve downloaded SGDK, unzip the archive anywhere you want. I put mine in C:sgdk
so that I have paths like C:sgdkbin
.
Next we’ll have to define two environment variables and add sgdk to our PATH
. This site shows you how to access those settings on different versions of Windows. I recommend adding them to the user variables, not the system ones. That way, the changes only apply to your account, not to the whole computer. Here is what you need to do:
- Add an environment variable called
GDK
pointing to the installation directory in unix path format. In my case this would beC:/sgdk
. - Add an environment variable called
GDK_WIN
pointing to the installation directory in windows path format. The only difference here is that you use backslashes instead of regular slashes. So in my case, I’d add the pathC:sgdk
. - Finally, look for the variable called
Path
and click on edit. Add the path to thebin
directory of your SGDK installation to the list that appears. I would addC:sgdkbin
.
Alright, now for the last step: Compiling the library. Open a command prompt and type in the following line:
If you get an error message complaining that %GDK_WIN%
could not be found or something like that, restart your computer and try again. Sometimes new environment variables aren’t set right away.
If you’re still having trouble, try hardcoding your installation path instead of using the variable. So if you installed SGDK in C:sgdk
like I did, you would type:
SGDK will do its thing and if everything goes well, you will end up with a file called libmd.a
inside the lib
folder of your SGDK installation! You don’t have to do anything with it, SGDK just needs it to work.
Alright, that’s the first step taken care of! Time to make a project.
Setting up a project
A project in SGDK is just a folder with some stuff in it. The easiest way to set up a new one is to copy an empty template project. I’ve prepared one for you, so just download it below:
Unzip it anywhere you want, then rename the extracted folder to helloworld
. In the root of the folder you should now find the following things:
This is the structure of a basic SGDK project. The out
folder will contain our rom file once we have created one. res
will hold the resources (graphics, audio…) for our project. The src
folder contains our source code files. Inside you will find the main.c
file, which is where we will add all of our code. Finally, compile.bat
is a script I wrote that we’ll use in a second. But first, we need to do a final bit of setup.
Emulators
In order to test our games, we’ll need an emulator to load the roms we create. If you already have a favorite one, feel free to use it! Any reasonably up-to-date emulator should work. However, if you only want to use an emulator for Mega Drive development, you might want to use Gens KMod. It’s based on the famous Gens emulator codebase but adds a few debugging tools that are very useful for developers. Just download the archive and unpack it anywhere you want; it makes sense to keep it close to the SGDK folder, but it doesn’t really matter as long as you remember where it is.
Compiling and running Hello World
Now that we have finally set everything up, let’s see if we can actually get things running! We’ll do that by creating the old programmer standby, the Hello World program. Open up your project folder and open main.c
(it’s within src
, remember?) in your text editor of choice. You’ll see that there is already some code in there, but it doesn’t really do much. So add the following line of code at the beginning of the main()
function:
For reference, your main.c
file should now look like this:
I’ll explain what these lines do in a second, but first let’s try to compile and run our program! This is very simple: Simply double-click on the compile.bat
file I’ve included in the project folder. A command prompt should open up, do some stuff, then close again. And if you now check in the out
folder of your project, you should see a bunch of files, including one called rom.bin
. That is your rom file! So load it up in your emulator and you should see the following:
Success! You’ve made your first Mega Drive program. Give yourself a pat on the back! It may not look like much yet, but it is a big step on a brand new road. I mean, you just made a Mega Drive program. You wouldn’t have been able to do that yesterday!
But Wait, What Did I Just Write?
But now for a quick explanation of what you’ve actually typed. Most lines are simple boilerplate stuff that you’ll need for the program to even run. But two lines are of special interest for now. Let’s take a look:
As you can probably tell, this function draws text on the screen. To be more precise, in this case, it draws the text “Hello Mega Drive World!” on the screen, at the coordinates (8,12). We’ll learn about coordinates later, but feel free to change these numbers around and see what happens!
By the way: This function uses the VDP of the Mega Drive, or the Video Display Processor, which explains the VDP_
prefix. Basically every function starting with VDP_
in SGDK does something visual, in this case drawing text on the screen.
The next interesting line also has something to do with visuals:
This is a very important function. Basically, everything you put into the while(1){ ... }
loop is executed as quickly as possible, which might or might not sync up with your display. In order to avoid display issues, you have to tell your Mega Drive to wait until the screen display has been fully updated before it starts processing more stuff. And that’s what SYS_doVBlankProcess()
does!
If that sounds confusing to you, don’t worry - you don’t really need to know the details for now. Just remember to always put SYS_doVBlankProcess();
at the end of your game loop and things should be fine. Also note: If you’re using an earlier version of SGDK (<1.6) you’ll have to use VDP_waitVSync();
instead!
Wrapping Up
That was a lot of stuff at once, but you’ve made it through and ended up with a working rom. Congratulations! Here’s what we will be taking a look at next:
- Setting up VSCode as a development environment
- Automating compilation/loading of roms
It might not sound exciting, but it will make everything a lot easier and more pleasant. And once you’ve set everything up you can use it for any future Mega Drive project you might try your hands on.
Thank you for reading! Until next time and be excellent to each other!
If you've got problems or questions, join the official SGDK Discord! It's full of people a lot smarter and skilled than me. Of course you're also welcome to just hang out and have fun!
Download the Project Files!
All patrons on Patreon get the complete source code for this tutorial, as well as other perks such as early access! And Patreon support also ensures that I can keep working on tutorials like this one. Become a Patron!Check out the rest of this tutorial series!
Comments
By using the Disqus service you confirm that you have read and agreed to the privacy policy.
Please enable JavaScript to view the comments powered by Disqus.comments powered by DisqusRelated Posts
HaxeFlixel Tutorials!
If you’ve popped over to the tutorial section recently you might have noticed that I’ve added my very first HaxeFlixel tutorial! It shows how to implement a simple, pixel-perfect 2D water shader which I used for Go! Go! PogoGirl.But a few of you might be wondering what a HaxeFlixel is. Well, it’s a 2D game framework that is as powerful as it is underrated! It runs on the (also underrated) Haxe language, is extremely well documented, open source, and has built-in functions for almost anything you’d need.
Streets of Was
As I’m sure many of you will remember, the original Streets of Rage for the Mega Drive had multiple endings. The real canonical ending has you beat the crap out of Mr. X, thereby ending his reign of terror forever (yeah, right). However, if you confronted Mr. X with a buddy in tow, a new possible path unlocked.A quick refresher is in order. When you confront Mr. X he will ask you to join his organization.
Streets of Rage 2 Design Docs
A few years ago, Yuzo Koshiro posted a pile of old game design documents for Bare Knuckle 2 aka Streets of Rage 2 on the Ancient blog to commemorate the release of Streets of Rage 2 3D on the Nintendo 3DS. These documents gave a deep insight into the game’s inner workings, technical aspects, designs and even some cut content. They were an awesome resource for one of the most awesome games ever created.
This document serves as a quick-start guide and reference card for installing and using pong. Please refer to the software manual, which can be downloaded from the Ramachandran Lab website, for comprehensive information.
pong has been tested on Mac OS X (10.8-10.11), Linux (Ubuntu 15.04, Linux Mint 17.2), and Windows 7.
pong is hosted on PyPI and can thus be easily installed with pip
. In order to run pong, you need Python 2 (version 2.7.8 or newer) and a modern web browser (e.g. Chrome, Firefox, Safari). pong is not compatible with Internet Explorer.
To install pong, run:
Note as of March 2019:
The newest version of munkres, a pong dependency, is no longer compatible with Python 2; we will push an update of pong to pip ASAP. For now, use this workaround:
You should be able to fix the issue on your local machine by swapping out for the version of munkres that pong needs:
Linux-specific tips
On some Linux systems, the install command may fail due to a permissions error. In that case, try running sudo pip install pong
instead. You will be prompted to enter in your computer login password. If that doesn't work either, try running the command as the super user:
Mac-specific tips
Note that the Apple system default Python cannot run pong. Python 2.7 and pip
can be installed manually, but we find that setup is easiest if you have Homebrew and Homebrew-installed Python. Using Homebrew, pong's dependencies, and subsequently pong itself, can be installed [ or updated ] as follows:
pong is executed through the command line. To see a complete list of options, run:
Note to Windows users: On some Windows systems, pong may not be installed as an executable, and thus cannot be run using this command. Instead, replace pong
with python pathtopong
.
We have provided an example dataset on which you can run pong (download available at the Ramachandran Lab website). Using data from the 1000 Genomes Project Phase3 (2,426 individuals), we performed 8 runs of ADMIXTURE at each value of K from K=2 to K=8. To analyze the example dataset with pong, navigate to the unzipped example directory and run:
Information regarding pong's application to the input data will be displayed to your terminal window. After its algorithms complete, pong initializes a web server on localhost:4000 (you can change the port on which pong operates with the command line option --port
). Once you navigate to localhost:4000 on your web browser, pong will detect a new browser connection and begin rendering the visualization.
pong's setup was designed to be low-hassle. This section details the required and optional input files that pong handles.
Clustering output
pong accepts clustering output files, or Q matrices, from a variety of clustering inference programs. The command line option -c
, or --ignore_cols
, tells pong how many leading columns of each row of the input Q matrix files to skip before parsing individual membership coefficients. For example, use -c 5
for some versions of Structureindiv output to ignore covariate metadata. In the case that no leading columns should be skipped (e.g. for ADMIXTURE output), it is not necessary to provide -c 0
because the default value of -c
is 0.
A few related notes:
Pong Pico-8 Mac Os Update
- Don't worry about trailing columns; they will not be parsed (after
-c
leading columns are ignored, only the first K columns are used). - pong parses Q matrix files as whitespace-delimited by default. If, for some reason, this is not the case with your input data, you can specify any column delimiter with the option
--col_delim
(e.g.--col_delim ','
for CSV files, or--col_delim 't'
for tab-delimited files). - While pong does handle leading/trailing columns in Q matrices, it does not handle leading/trailing rows. These rows must be stripped prior to analysis with pong (i.e. for a dataset with n samples, every Q matrix file should have n lines).
filemap file
A bit of information about the input Q matrices must be provided, in the form of a filemap. A filemap is a three-column, tab-delimited file. Each line contains the following information about a single Q matrix:
- A unique ID (e.g.
iter5_K=7
; this must contain at least one letter, and cannot contain a hashmark/hashtag or a period. Integers, spaces, and other special characters are accepted.) - The K value
- The Q matrix file path, relative to the filemap. Thus, if the filemap is in the same directory as the Q matrix files, this is just the name of the Q matrix file.
It is important that the columns of your filemap are in the right order and that the file is tab-delimited. Use the filemap provided with the example dataset for reference. Use the command line option -m
, or --filemap
, to pass pong the path to your your filemap.
Population labels (optional)
ind2pop data
It is common for Q matrices to be annotated with population metadata. In many datasets, individuals are assigned a population code/label/number; we refer to this as ind2pop data. If provided with this information, pong's visualization will sort individuals by population, partition populations with black lines, and sort individuals within each population by their membership in the population's major cluster.* Other covariates, such as continent or language spoken, can also be used as ind2pop in place of population metadata.
You can provide ind2pop data with the command line option -i
, or --ind2pop
. The argument to this option can be either of the following:
- An integer, representing the Q matrix column number that contains ind2pop data. For example, use
-i 4
for standard Structure output. - The path to an ind2pop file, where line i of this file contains the ind2pop data (i.e. population code/label/number) for the individual represented by line i of the Q matrix files.
Note that the population codes/labels/numbers provided as ind2pop data should not contain any whitespace.
Population order and detailed names
If you provide ind2pop data, you may provide an additional file specifying the desired order in which to display the populations (as the argument to the command line option -n
). This file should have one population code/label/number per line; the top-to-bottom order of the file corresponds with the left-to-right display order of the populations.
You may want to more descriptive population names to be displayed (e.g. if the input ind2pop data are numbers, cryptic three-letter codes, etc.); in this case, you can add a second column (tab-delimited) to the population order file containing population names. Space characters are allowed in these names. See the file pop_order_expandednames.txt in the example dataset for reference.
Custom colors for visualization (optional)
pong provides default colors (unless K_max > 26), but it is possible to provide pong with a file containing a set of colors to use for visualization (using the command line option -l
). This file must contain at least K_max colors, with one color per line. Because pong's visualization is web-based, colors can be provided in any format that is accepted by CSS (e.g. #ff0000
, rgb(255,0,0)
, red
).
The example dataset, software manual, and other relevant materials can be found at the Ramachandran Lab website.
Pong Pico-8 Mac Os Catalina
Contact Aaron Behr or Sohini Ramachandran for more information.
Pong Pico-8 Mac Os Download
*We have found that this sorting operation makes it much easier to understand the distribution of cluster membership within each population. Note that pong performs this sorting operation on a single Q matrix (the bottom-most plot in the main visualization, which is the representative run of the major mode of the highest K-value) and propagates that order through all the other visualized Q matrices, such that the ordering of individuals is consistent across all plots.