• Stars
    star
    1,337
  • Rank 35,156 (Top 0.7 %)
  • Language
    C
  • License
    MIT License
  • Created over 3 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A cross-platform, top-down 2D space shooter written in C using only platform libraries.

space-shooter.c

A cross-platform, top-down 2D space shooter written in C using only platform libraries.

gif

Dependencies

  • Base: Win32 (Windows), Xlib (Linux), Emscripten (Web)
  • Rendering: OpenGL 3.3 (Windows/Linux), OpenGL ES 3.0 (Web)
  • Audio: XAudio2 (Windows), ALSA/pthread (Linux), OpenAL (Web)
  • Gamepad: XInput (Windows), evdev (Linux), Emscripten (Web)

Description

space-shooter.c is a cross-platform, top-down 2D space shooter written in standard C11 using only platform libraries (with platform libraries defined as anything included in the C standard library or supported platforms). space-shooter.c has been tested on Windows 10, Ubuntu Linux 16.04, Chrome 103 and Firefox 103. This project drew heavy inspiration from Handmade Hero and pacman.c.

The design and architecture of space-shooter.c is described here.

Caveat

I am not a professional game developer, nor a professional C programmer, so the design may be unconventional or sub-optimal in many ways. Happy to take feedback from any pros out there!

Building

Windows

  • In a shell with cl set up, run build.bat for a debug build or build.bat release for an optimized build.
  • Run space-shooter.exe from the build/ directory.

Linux

  • Make sure development headers for the Linux kernel, Xlib, glx and ALSA are installed.
    • E.g. on Ubuntu, run the following: sudo apt install linux-libc-dev libx11-dev mesa-common-dev libasound2-dev
  • Run make linux for a debug build or make linux-release for an optimized build.
  • Run ./space-shooter from the build/ directory.

Web

  • Make sure make and emscripten are installed.
  • Run make web for a debug build or make web-release for an optimized build.
  • Serve the build/ directory for debug builds or the site/ directory for release builds from a local web server (e.g. python -m SimpleHTTPServer), and open the page in Chrome or Firefox.

What About Mac?

I hope to work on a Mac platform layer as soon as I have a Mac machine to work on.

Contributing

Since this project is intended as a personal challenge, I am not accepting external contributions at this time. I am very open to feedback, however, so feel free to open an issue for anything that needs fixing.

Asset Credits

More Repositories

1

picogl.js

A minimal WebGL 2 rendering library
JavaScript
788
star
2

webgl2examples

Rendering algorithms implemented in raw WebGL 2.
HTML
531
star
3

simple-opengl-loader

An extensible, cross-platform, single-header C/C++ OpenGL loader library.
C
86
star
4

webgpu-examples

Rendering algorithms implemented in WebGPU.
JavaScript
79
star
5

glcheck

A testing framework for WebGL 1 and 2 applications
JavaScript
62
star
6

nano-server

An ultra-lightweight node.js HTTP server for web development.
JavaScript
60
star
7

mercator-gl

Tiny library for GLSL web mercator projections
JavaScript
45
star
8

xogl

Minimal OpenGL loader for X11.
C
23
star
9

xaudio2-c-demo

A small example of using the Windows XAudio2 API in C
C
20
star
10

scroll-em

A JavaScript library for creating scrolling animations.
JavaScript
19
star
11

cervit

Minimal, multi-threaded POSIX HTTP 1.1 server written in C using only system libraries.
C
19
star
12

tesseract-explorer

Interactive visualization of a 4-dimensional tesseract
JavaScript
17
star
13

gl-utils

A bare-bones WebGL library.
JavaScript
16
star
14

mesh-quantization-example

A minimal example of vertex quantization.
JavaScript
11
star
15

weekendraytracerjs

JavaScript port of the path tracing algorithm from Peter Shirley's "Ray Tracing in One Weekend"
JavaScript
11
star
16

gaza-data

Open JSON and CSV formatted data documenting the Palestinian and Israeli lives lost in the July 2014 attack on Gaza.
JavaScript
6
star
17

sketches

Daily graphics sketches
C
6
star
18

mesh-compression-examples

JavaScript
5
star
19

oFactory

A simple JavaScript library for creating factories.
JavaScript
4
star
20

picogl-tutorial

PicoGL.js tutorial source code.
HTML
3
star
21

webglx

Unified context API for WebGL 1 and 2.
JavaScript
3
star
22

simple-live-server

A mininal HTTP server with live reload capabilities.
TypeScript
2
star
23

climb

An HTML5 minimalist vertical platforming game.
JavaScript
2
star
24

khronos-webgl-workshop1

CSS
2
star
25

nywebperf-biodigital

CSS
2
star
26

in-gaza

An interactive memorial to the Gazans killed during Israeli Operation Protective Edge, July 2014.
JavaScript
2
star
27

siggraph-2018

CSS
1
star
28

tgame

A very basic JavaScript game engine.
JavaScript
1
star
29

space-music

JavaScript
1
star
30

nanogl.js

Moved to https://github.com/tsherif/picogl.js
HTML
1
star
31

egypt-population

Population density map of Egypt
JavaScript
1
star
32

tareksherif

Code for tareksherif.net
JavaScript
1
star
33

webgl2bugs

Minimal examples of bugs found in WebGL 2
HTML
1
star
34

asm-experiments

Random assembly sketches
Assembly
1
star