GithubHelp home page GithubHelp logo

obscurelyme / coffeemaker Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 61.07 MB

A warm and fuzzy 2D Game Engine

License: GNU Lesser General Public License v2.1

CMake 2.60% C++ 94.99% Batchfile 0.43% Shell 0.93% Python 1.04%
game-engine 2d-game-engine 2d-game-framework sdl2 cpp

coffeemaker's Introduction

CoffeeMaker

A warm and fuzzy 2D game engine.

coffeemaker-ci CodeFactor

CoffeeMaker is an open source 2D game engine written in C++ with SDL2.

This engine is being built alongside an arcade 2D top-down space shooter game. All game specific files are located within src/Game.

Features


  • B-Spline creation
  • Events
    • SDL2 Mouse Event
    • SDL2 User Event
  • Window creation
  • 2D Renderer with SDL2
    • Sprites
  • Audio
    • Play music
    • Play sound effects
  • Animation
    • B-Spline Animations
    • Sprite Animations
  • Input Manager
    • Keyboard
  • Scenes
  • Physics
    • AABB
  • Fonts (TTF)
  • UI widgets
    • View
    • Buttons
    • Text
    • Flexbox-like positioning
  • Math
    • 2D Vectors
    • Bezier Curves
    • Lerps
    • Random Number Generation
  • Async
    • Timeouts
    • Intervals
  • Logging
    • Log to files
    • Log to consoles

Prerequisites

vcpkg is a required package manager for this project. If you do not have vcpkg installed, you can follow the instructions in the link to install and setup vcpkg.

Getting Started

  1. Clone
git clone https://github.com/obscurelyme/CoffeeMaker
  1. Download the assets from Google Drive into ./CoffeeMaker/assets.

  2. Run ./scripts/post-build.{sh | bat} to copy over assets into build directory.

  3. Configure

  4. Build

Follow the development of CoffeeMaker

Trello

coffeemaker's People

Contributors

obscurelyme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

coffeemaker's Issues

Cheap Asteroids: HUD

The player could use a HUD (Heads Up Display) to showcase information during the Main Scene.

Must haves

  • Ammo
  • Health
  • Score

Nice to have

  • Time spent in the level
  • Enemies remaining
  • Current Wave

UCI: Attach Animations to Player/Enemy

With the SpriteAnimation class in place, I need to connect the dots to the Player and Enemy instances so they actually play the animation when appropriate.

[UCI][Power Ups] - Warp Power Up

Warp Power up is a feature where the player is allowed to warp in the direction they are moving in. Warp will teleport the player a certain distance away. This feature should have N charges that are rechargeable.

Text component, order to operations should not matter to render Text on the screen

There is a slight bug in the Text component. The successful render of the Text component depends on the flowing calls be done IN THIS EXACT ORDER

Text text;
text.SetFont(FontManager::UseFont("OpenSans"));
text.SetColor(Color(255, 255, 255, 255));
text.SetText("Hello, World!");

If a programmer does not follow this order, a texture for the text content is not properly created. This is caused by a few things.

  1. If a font is not specified, a texture cannot be created.
  2. If a color is not specified, we might waste time making a texture we won't ever use
  3. If text content is set before anything, nothing works. Which effectively makes the const std::string& overloaded constructor useless because you'd have to call SetText anyway after setting both the font and color.

This lacks intuitiveness when working with this component that even I (the creator of the component) step into mines using Text. I'd like to make it so Text no longer depends on the ordering in which functions are called. Text should "just work".

[CoffeeMaker] Utility Window

Engine needs a utility window that first opens, is presented, and then proceeds to grab display information. Then it can close and reopen the final game window. This is because of the nature of SDL2, in order to see what kind of display we are dealing with we first need to have a window open.

Cheap Asteroids: Player/Enemy Animations

Enemies/Player need more animations. they have 2 states currently that are used for the movement animation.

Enemy Animations

  • Death
  • Movement

Player Animations:

  • Death
  • Damaged

Leverage Static Libraries

CoffeeMaker uses dynamic libraries on Win32 and static on OSX. I'd like to bridge the gap here and introduce parity. It'll also be more convenient for end users only needed to worry about a single executable rather than a bunch of DLLs. So I'd like for Win32 to be linking against the static libraries for all vendors.

[Feature][UCI] Player movement

Right now the player is fixed at the center of the screen. I think it'll be better gameplay to allow the player to move around the screen. Perhaps from right to left at the bottom of the screen. Enemies no longer move towards the player but rather they shot at the player.

I think it'll cool to keep the "enemies" that fly towards the player are now asteroids instead of alien ships.

UCI: State Machine

Player and Enemies need a state machine that allows for easy way to manipulate how the Update function will operate. There is a prototype of this working in TestBedScene. I'd like to port that to the general game and add that to the base enemy and player classes in the main scene.

Integrate Box2D for Physics Engine

Currently, CoffeeMaker does not use a proper Physics Engine. I'd like to leverage something that's more battle tested than my naïve O(n^2) AABB approach.

Box2D

Gtest + GMock

Right now, CoffeeMaker uses cppunit to run tests on the source code, and while this is helpful. I really need use of a mocking library as well, which cppunit does not provide. I'd like to see what it would take to swap over to Google test/mock.

Button mousein/mouseout textures are not consistent

The Button component does not properly set nor unset the hover color when a texture is applied to it. If a button has any png image displayed, on hover it will display a bright green box (just like the default buttons) and then on mouseout it will turn black (again, just like the default buttons). This looks to be due to a misuse of the SDL_SetTextureColorMod function.

When assigning a color to a Texture, CoffeeMaker does not take into consideration what the prior color was and as a result of this, Texture.SetColor permanently alters the Button's texture after mouse events have been emitted. Button needs to be aware of the prior Color assignments to its assigned Texture so it can undo the effects of the mousein event.

[CoffeeMaker] 9-part slicing for sprites

Like Unity3D, CoffeeMaker really needs to be able to generate 9-part slices from given UI sprites in order to keep corner resolutions the same yet still be able to scale horizontally and vertically to no end

ui-space.mp4

Cheap Asteroids: Play Again Menu

Cheap Asteroids needs a "Play Again" menu that will display when the player dies. The menu will inform the Player that they have lost the game and give 2 options...

  • Play Again
  • Quit

Play Again will reset the scene
Quit will return the player to the title scene.

Quit option should then toggle a sub menu that asks for the user to confirm if they really want to quit.

UI implement flexbox-like capabilities

I'd like for the UI components to have some sort of CSS3 flexbox-like capabilities. Things like

  • flex-grow
  • flex-stretch
  • space-around
  • space-between

Perhaps some kind of auto sizing of elements based on the size of the parent.

Enemy flight formations

Enemies fly in an independent manner. A better solution would be to implement formation movement for all enemies. This will allow the player to distinguish patterns as the game goes on.

As an enemy is created it can be added to an "echelon". The echelon is the thing that will move on the screen. Once an enemy flies onto the screen, it should then be assigned a state to move to the next available/or manually assigned echelon position. Once it moves into position the enemy no longer moves independently but instead it's position will be updated by the echelon instead.

[CoffeeMaker] Controller Support

The game engine and any games made with it should support controllers. The best MVP here would be to support XBox One controllers initially and then look into other solutions as needed.

Compilation Problems

Hello @obscurelyme,

My name is Rhett and I'm a student at Missouri State University. I'm currently working on a group project in which we use various testing techniques/software on an open source project. We found and chose CoffeeMaker. I'm contacting you because my team and I are having issues getting files to compile. This is because the libraries and header files included are not being found for some reason. We are not sure why this is happening. We've tried adjusting our VSCode and IntelliSense configurations to no avail. We have also started to use Docker to see if we could find a fix, but we are all new to Docker so nothing was found. If you could provide some information or a short walkthrough on how to get the project to compile from a a fresh clone of the repo we would greatly appreciate it. Thank you for your time!

Keep up the great work,
Rhett

Decouple sandbox executable and library

CoffeeMaker should be decoupled from the sandbox executable that it currently is attached to. This can be a lower priority task until the first game "Cheap Asteroids" has been created and I'm ready to move on to another game.

Timing Mechanism for Pausing/Unpausing game

CoffeeMaker needs a way to pause/unpause the game. I think that the best way to do this will be to leverage timers. All game entities will use a game timer to progress their state. When the game is paused so too will the game entities.

Layer System

Currently (as of this writing 10/3/2021), the game engine only supports "layering" if the programmer is smart enough to know the exact order of how things are to be drawn to the screen. This works for small levels, but as the engine and games grow there are going to be more and more elements that will be considerably more difficult to keep track of. It would be helpful if each graphical element could be assigned a "layer", and from there items can be drawn in a FIFO manner. Alternatively I think it's best if the programmer had even more control and could specify the exact "z-index" property of certain elements sort of in a "position: absolute" kind of fashion.

TLDR: The game engine needs a Layer System for all graphical elements. Think CSS z-index capabilities.

[UCI] Pause Menu Polishing

The pause menu needs some polishing. I propose a new UIComponent called Modal which includes a View and a new primitive called Backdrop. Backdrop is just a semi-transparent background that helps to make the View on top pop against the game in the background.

[UCI] HUD polish

The UI/UX for the HUD needs to be vastly improved. This will involve more art than programming.

[CoffeeMaker] Rebindable keys

The most feature complete inputs in modern day PC game include rebindable keys. This is a stretch goal and not a high priority item at this time, but this is something to consider long term.

CoffeeMaker Audio features

CoffeeMaker needs some Audio. Make it so. I'd like to leverage SDL Audio to start with, and get over any hurdles with that first before exploring other audio library options.

[BUG][Logger] Trace and Debug methods memory leak

Trace and Debug methods contain memory leaks that need to be addressed. Perhaps it has something to do with the runtime fmt functions. fmt can be done as a constexpr so perhaps look into that solution.

Cheap Asteroids: Player damage, death, and respawn

The player should be able to take damage, die, and respawn.

Respawn is going to be tricky because the enemies can still float around the area causing the player to spawn and immediately die. Will need to open another issue to make the enemies not go towards the player's position once dead. Alternatively, the player spawns and has immunity for a few seconds.

XML based resources for UI Components

I would like to see CoffeeMaker leverage XML based resources to construct the UI for scenes rather than the current way....

void handleClick() {
     std::cout << "Button was clicked" << std::endl;
}

...

View view{0, 0, 500, 500};  // top: 0, left: 0, width: 500, height: 500
Button button;
Text text{"Click Me!"};
button.AppendChild(&text);
button.On(ButtonEvent::Click, Delegate{handleClick});
view.AppendChild(&button);

...

view.Render();

In this example we can clearly see how verbose things are. And the reality is that this is a dead simple example. A more practical example has positioning functions being invoked per element. This amounts to a lot of heavy mental thinking and code just to get a simple UI working.

For the future, I'd like to see CoffeeMaker consume XML files that can be read and parsed in such a way that the above code would something the programmer need not think about, but rather becomes an automated step.

Something like the following, would be the direction I want to go in...

<View position="flex" x="centered" y="centered" width="500" height="500">
     <Button position="flex" x="left" y="centered" onClick="handleClick">
          <Text color="rgba(255, 0, 255, 255)" position="flex" x="centered" y="top">Hello, World!</Text>
     </Button>
     <Button position="flex" x="right" y="centered" onClick="handleClick">
          <Text color="rgba(255, 0, 255, 255)" position="flex" x="centered" y="top">Goodbye, World!</Text>
     </Button>
</View>

[CoffeeMaker][Engine][UI] Implement mouse event listener mechanism

Similar to how SDL_UserEvents can be listened to simply by implementing the IUserEventListener interface, I'd like for another interface to focus on mouse events. IMouseEventListener would listen for and could react to mouse button clicks, mouse button down/up, mouse movement, and mouse wheel events.

[CoffeeMaker] Fullscreen support

The game engine really could use fullscreen support in order to give any game made with it a more polished and standard look. Make it so.

Cheap Asteroids: Multiple enemies that can be killed in the main scene

Right now, only 1 non-killable enemy spawns in the left hand side of the main scene. It walks up the screen and wraps around once it exits the screen's border. I need to make multiple of these kinds of enemies throughout the duration of the Main Scene's lifespan and make sure that they have colliders and can be killed by the player's projectiles.

Cheap Asteroids: High Score Scene

When a Player sets a new High Score, and they die a High Score menu should be displayed asking the player to input initials so they may save their score. This issue will depend on some sort of persisted storage ticket.

[UCI] Controls menu scene

The game should have a controls scene that showcases the controls available to the end user. This scene should be dynamic enough that it could also be accessed from the pause menu too.

Window Resizing

Allow for the game window to be resized.

All graphical elements should render intuitively after the resize takes place. This feature is blocked by the flexbox-like UI system.

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.