Coder Social home page Coder Social logo

fjlj / sega Goto Github PK

View Code? Open in Web Editor NEW

This project forked from britown88/sega

0.0 2.0 0.0 23.73 MB

A straight-C game engine that renders with a homespun EGA emulator

Lua 0.15% C 97.88% C++ 1.81% Objective-C 0.14% GLSL 0.01% Batchfile 0.01% HLSL 0.01%

sega's Introduction

sEGA

The "Super EGA" C Game Engine Project

What is it?

The goal of the project is to create a full-featured modern game engine entirely in C which emulates the EGA Graphics Format for rendering to the screen. C has a wealth of quirky hacky things you can do that would be difficult in more verbose and strict languages so the "academic" goal of the project is to break some of the assumptions about C being unweildy.

What started as a small graphics demo rendering 16 colors from a palette to bitplanes quickly turned into a whole library of EGA functions including the ability to convert PNG images to the EGA format by generating an optimal palette from the EGA color space to use.

But wait is this a game?

Yes! Sort of... I plan on writing up some description of initial plans for the engine over on my hot new blog but the long and short is that the solution contains two games, Shift and BT. BT is my primary focus currently, a western CRPG. I'm tracking features and milestones on a public Trello board here!

How do I build it?

Visual Studio Community 2015 is free now! I feel like not using cmake-gcc-cross-platform-super-indie-python-something-makefile-build-pattern© is a bit of a taboo and so sorry for tarnishing github's fine image with this corporate trash but really, VS2015 has some really wonderful git integration and it's been a joy to work with.

Currently in the solution there is Sega Studio, a .NET app for creating EGA image files, and two game projects, BT and Shift. Everything uses the segalib library for EGA functions. If you want to use segalib, make sure to edit the config.h file to set which video mode you wish to compile it with. BT uses 320x200 and Shift uses 640x480!

What is Sega Studio?

A quick and dirty .Net App that uses C++/CLI to call my EGA library functions. You can open PNG files, create a full or partial palette to render it with, and then convert to EGA which will find the optimal way to encode the image with those colors. While in EGA edit mode you can also make palette changes and it will show the result in the viewer as you hover over the colors making it easy to test out palette-swaps!

If the app crashes loading certain PNG files it's probably due to the PNG not being RGB, which you should change using Gimp or some other image editor. I should really fix imagetools.h to make other formats work...

Fun C Things

I've enjoyed implementing some C++ niceties into C including std::unordered_map, std::vector, std::function (!), and even a priority quuee that uses an intrusive pairing heap which I use for my dijkstras solves. Most of these are in the segautils library so take a look!

EGA Emulator?

Rendering only allows a pixel resolution of 640x350 and each pixel is a 4-bit index into a 16-color palette which contains indices into a 64-color range. These restrictions arent just arbitrarily enforced, the render pipeline actually uses bitplanes and bitwise operations to and/or color data to the frame buffer. This adds in interesting restrictions for games. Just like the "Software Authors" of old who made several indie titles with the format long after it fell out of commercial use, the users of this engine will need to be mindful of the scene's palette and design their image files to use the right palette indices appropriately (Sega Studio is hugely helpful for this).

Text rendering is no different and uses a single font on a set text grid to emulate the text mode of the format and so background and UI needs to be designed with the grid in mind so that dynamic text will line up with UI Elements!

Questions?

You can shoot me an email at [email protected] or tweet at @p4r4digm

sega's People

Contributors

britown88 avatar fjlj avatar

Watchers

 avatar James Cloos avatar

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.