CSCS1320 C/C++ Programming

PROJECT: FUN WITH GAMES (fwg1)

OBJECTIVE

Using your Vircon32 build and installation from fwg0, implement your own pong-like game: at least one paddle, at least one ball. Ball rebounds off the walls, reflects off the paddle. Simple score if the ball makes it past the paddle.

PROGRAM

You are to write a Vircon32 C pong game: display the usual assets, with the expected mechanics and interactions (paddle, ball, collision, score).

  • a paddle, guarding one of the walls
  • paddle moves based on control of the gamepad
  • ball moves independently around the screen, rebounding/reflecting
  • ball rebounds off non-paddle walls
  • ball reflects off paddle when a collision occurs
  • scoring based on ball making it past the paddle

NOTE: the first gamepad by default is mapped to the keyboard

CARTRIDGE BUILD PROCESS

All of these steps can be automated with the use of the provided Makefile simply by typing make at the prompt.

NOTE that with certain modifications, you'll first need to modify the XML file as appropriate.

COMPILE

First step is to compile the C code, which can be done with the following command from the Vircon32 developer tools C compiler (compile):

yoursystem:~/src/SEMESTER/cprog/fwg1$ compile fwg1.c -o fwg1.asm

This compiles, or translates, the C code into Vircon32 assembly language code, which will then need to be assembled to machine code:

ASSEMBLE

Once you've compiled your code successfully, you can use the Vircon32 assemble DevTool to assemble the assembly:

yoursystem:~/src/SEMESTER/cprog/fwg1$ assemble fwg1.asm -o fwg1.vbin

IMAGE CONVERSTION

Any PNG images you'd like to use need to be converted to Vircon32 texture format via the png2vircon tool:

yoursystem:~/src/SEMESTER/cprog/fwg1$ png2vircon background.png -o background.vtex
yoursystem:~/src/SEMESTER/cprog/fwg1$ png2vircon sprites.png -o sprites.vtex

Note that you'll also want to ensure the XML file has been updated to reference these textures:

  <binary path="fwg1.vbin" />
  <textures>
      <texture path="background.vtex" />
      <texture path="sprites.vtex" />
  </textures>

AUDIO CONVERSION

Should you have any WAV files you'd like to use need to be converted to the Vircon3 sound format via the wav2vircon tool:

yoursystem:~/src/SEMESTER/cprog/fwg1$ wav2vircon backgroundmusic.wav -o backgroundmusic.vsnd
yoursystem:~/src/SEMESTER/cprog/fwg1$ wav2vircon soundfx.wav -o soundfx.vsnd

Note that you'll also want to ensure the XML file has been updated to reference these sounds:

  <sounds>
      <sound path="backgroundmusic.vsnd" />
      <sound path="soundfx.vsnd" />
  </sounds>

PACKING THE ROM

Once all the components have been built, you can pack them together into a Vircon32 cartridge for use in the emulator via the packrom tool:

yoursystem:~/src/SEMESTER/cprog/fwg1$ packrom fwg1.xml

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

  • Project must be submit on time, by the deadline.
    • Late submissions will lose 33% credit per day, with the submission window closing on the 3rd day following the deadline.
  • Executed programs must display in a manner similar to provided output
    • output formatted, where applicable, must match that of project requirements
  • Processing must be correct based on input given and output requested
  • Output, if applicable, must be correct based on values input
  • Code must be nicely and consistently indented
  • Code must be consistently written, to strive for readability from having a consistent style throughout
  • Code must be commented
    • Any "to be implemented" comments MUST be removed
      • these "to be implemented" comments, if still present at evaluation time, will result in points being deducted.
      • Sufficient comments explaining the point of provided logic MUST be present
  • No global variables (without instructor approval), no goto statements, no calling of main()!
  • Track/version the source code in your private semester repository
  • Submit a copy of your source code to me using the submit tool by the deadline.

SUBMIT TOOL USAGE

Let's say you have completed work on the project, and are ready to submit, you would do the following:

lab46:~/src/SEMESTER/cprog/fwg1$ make submit

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

260:fwg1:final tally of results (260/260)
*:fwg1:code modified to meet project specifications [52/52]
*:fwg1:grabit of project data by Sunday prior to duedate [26/26]
*:fwg1:screenshot or video posted to class DISCORD of game running [26/26]
*:fwg1:working collision detection between paddle and ball [52/52]
*:fwg1:source file, XML file, build script, and cartridge submit [26/26]
*:fwg1:code compiles, cartridge builds with no warning or error [26/26]
*:fwg1:committed project related changes to private semester repo [52/52]

Additionally:

  • Solutions not abiding by spirit of project will be subject to a 50% overall deduction
  • Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
  • Solutions not utilizing indentation to promote scope and clarity or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction
  • Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction