From 293113c4d09c62239866e987a2b0f22773e423a9 Mon Sep 17 00:00:00 2001 From: h4570 Date: Wed, 24 Aug 2022 22:52:50 +0200 Subject: [PATCH] fixed readme --- README.MD | 168 ++++++++++++++++++++++++- template/02-sprite/Makefile | 24 ---- template/02-sprite/bin/.gitignore | 4 - template/02-sprite/inc/tutorial_02.hpp | 34 ----- template/02-sprite/obj/.gitignore | 4 - template/02-sprite/res/.gitignore | 4 - template/02-sprite/run.ps1 | 4 - template/02-sprite/src/main.cpp | 26 ---- template/02-sprite/src/tutorial_02.cpp | 112 ----------------- 9 files changed, 167 insertions(+), 213 deletions(-) delete mode 100644 template/02-sprite/Makefile delete mode 100644 template/02-sprite/bin/.gitignore delete mode 100644 template/02-sprite/inc/tutorial_02.hpp delete mode 100644 template/02-sprite/obj/.gitignore delete mode 100644 template/02-sprite/res/.gitignore delete mode 100644 template/02-sprite/run.ps1 delete mode 100644 template/02-sprite/src/main.cpp delete mode 100644 template/02-sprite/src/tutorial_02.cpp diff --git a/README.MD b/README.MD index acfff8c..6d604c6 100644 --- a/README.MD +++ b/README.MD @@ -1 +1,167 @@ -# Work in progress \ No newline at end of file +[![Contributors][contributors-shield]][contributors-url] +[![MIT License][license-shield]][license-url] +[![Discord](https://img.shields.io/badge/discord-Tyra-brightgreen?logo=discord)](https://discord.gg/NhhTmg3Gm5) +[![Discord](https://img.shields.io/badge/discord-PS2--Scene-brightgreen?logo=discord)](https://discord.gg/7dCr6ThSN5) + +
+

+ + Logo + + +

Tyra - 2.0

+ +

+ Open source game engine for PlayStation 2™ +
+ YouTube tutorials » +   +
+
+ Report Bug + · + Request Feature +

+

+ +[![Stargazers repo roster for h4570/tyra](https://reporoster.com/stars/h4570/tyra)](https://github.com/h4570/tyra/stargazers) + +## Table of Contents + +* [About the project](#about-the-project) + * [Description](#description) + * [Tutorials](#tutorials) + * [Features](#features) + * [Branches](#branches) +* [Contributing](#contributing) +* [License](#license) +* [Built With](#built-with) +* [Acronyms](#acronyms) +* [Thanks](#thanks) + +
+ +## About the Project +

+ Sample code + Sample game +

+ +--- +### Description +Tyra is a project that allows you to easily create games for the PlayStation 2 console. +When I tried to make a game for PS2 a few years ago, I realized how many things had to be done to tame this exotic console architecture. +Decision was simple - I need to create an engine which will handle 3D file loading, 2D/3D rendering, animation, audio, handling between PS2 CPUs, synchronization and it should be simple as possible - so people with no experience can create a simple game in a few hours. +**And that's what Tyra is all about.** + +### Tutorials +* Setup environment - [Text tutorial](https://github.com/h4570/tyra/tree/master/docs/install) or [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) +* Cook game assets - [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) +* Create game from template - [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) +--- +* 01 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/01-hello), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - Hello world +* 02 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/02-sprite), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - 2D rendering +* 03 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/03-minecraft), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - 3D minecraft blocks +* 04 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/04-de_dust2), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - `de_dust2.obj` rendering +* 05 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/05-animation), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - 3D animation +* 06 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/06-audio), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - Background music and sound effects +* 07 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/07-lighting), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - Static lightmap and dynamic directional lights +* 08 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/08-skybox-debug), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - Skybox and debug rendering +* 09 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/09-manual-mode), [Video (soon)](https://www.youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH) - Manual rendering (a'la OpenGL) + +--- + +### Features +* Docker image with Tyra, all tools and `PS2DEV` C++20 compiler +* 3D rendering via `VU1` coprocessor: + * Static rendering + * Morph animation rendering + * Super optimized, custom minecraft block renderer + * Debug rendering (lines, boxes, bboxes) + * Manual rendering (a'la `OpenGL`) +* 2D rendering +* Frustum culling: + * Simple - culling whole mesh + * Precise - culling only visible parts of mesh +* Clipping: + * Standard "fake", but fast PS2 clipping done in `VU1` + * Software triangle done in `EE Core` +* Optimized math functions via `VU0` coprocessor +* Background music and sound effects support +* Pad support +* `.wav` Audio file support +* `.obj` 3D file support +* `.md2` 3D file support +* `.png` Texture file support + +### Branches +* `master` - stable releases - tested on PS2 & PCSX2. +* `develop` - daily builds. + +See the [open issues](https://github.com/h4570/tyra/issues) for a list of proposed features (and known issues). + +
+ +## Contributing + +Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. + +1. Fork the Project +2. Create your Feature Branch (`git checkout -b feature/amazing-feature`) +3. Commit your Changes (`git commit -m 'Add some amazing-feature'`) +4. Push to the Branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +
+ +## License + +Distributed under the Apache License 2.0 License. See `LICENSE` for more information. + +
+ +## Built With + +* [PS2DEV](https://github.com/ps2dev/ps2dev) +* [VCLPP](https://github.com/glampert/vclpp) +* Sony VCL + +
+ +## Acronyms +* EE (Emotion Engine) - whole set of processors and subsystems that make up the PlayStation 2 +* EE Core - main PS2 CPU (c++ done here) +* GS (Graphic synthesizer) - configurable rasterizer and texture mapper. Has only 2MB~ memory for textures, but for the opposite have very high transfer rate, so you can switch textures in the blink +* VU0 - programmable (ASM) vector processor that is accessed by inline assembly code injected into C program. +* VU1 - programmable (ASM) vector processor, which is similar to vertex shader. Accessed via DMA. +* IOP - I/O processor which enables access to peripheral devices, such the game controller + +
+ +## Credits + +Without these guys, Tyra would not happen: +* Dr Henry Fortuna - for code sources, PS2 academy tutorials +* Rick Gaiser, fjtrujy - for maintaining PS2DEV +* Wellington Carvalho - for testing, contributing to Tyra and sharing cool ideas! +* Lukasz D.K. - for huge archive of PS2 stuff +* Guilherme Lampert - for code sources +* Jesper Svennevid, Daniel Collin - for openvcl's code samples +* Whole PS2DEV team +* Manieq - for nice splash screens! +* And so many other guys. Thanks! + +Project Link: [https://github.com/h4570/tyra](https://github.com/h4570/tyra) +Sandro Sobczyński - sandro.sobczynski@gmail.com +[![LinkedIn][linkedin-shield]](https://linkedin.com/in/sandro-sobczyński-28820b15a) + +
+ + Logo + + +[contributors-shield]: https://img.shields.io/github/contributors/h4570/tyra.svg?style=flat-square +[contributors-url]: https://github.com/h4570/tyra/graphs/contributors +[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555 +[license-shield]: https://img.shields.io/github/license/h4570/tyra.svg?style=flat-square +[license-url]: https://github.com/h4570/tyra/blob/master/LICENSE \ No newline at end of file diff --git a/template/02-sprite/Makefile b/template/02-sprite/Makefile deleted file mode 100644 index 7c46faf..0000000 --- a/template/02-sprite/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TARGET := tutorial_02.elf -ENGINEDIR := ../../engine - -#The Directories, Source, Includes, Objects, Binary and Resources -SRCDIR := src -INCDIR := inc -BUILDDIR := obj -TARGETDIR := bin -RESDIR := res -SRCEXT := cpp -VSMEXT := vsm -VCLEXT := vcl -VCLPPEXT := vclpp -DEPEXT := d -OBJEXT := o - -#Flags, Libraries and Includes -CFLAGS := -LIB := -LIBDIRS := -INC := -I$(INCDIR) -INCDEP := -I$(INCDIR) - -include ../Makefile.tutorials-base \ No newline at end of file diff --git a/template/02-sprite/bin/.gitignore b/template/02-sprite/bin/.gitignore deleted file mode 100644 index 44c5ea8..0000000 --- a/template/02-sprite/bin/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/template/02-sprite/inc/tutorial_02.hpp b/template/02-sprite/inc/tutorial_02.hpp deleted file mode 100644 index 34ef153..0000000 --- a/template/02-sprite/inc/tutorial_02.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -# _____ ____ ___ -# | \/ ____| |___| -# | | | \ | | -#----------------------------------------------------------------------- -# Copyright 2022, tyra - https://github.com/h4570/tyra -# Licensed under Apache License 2.0 -# Sandro Sobczyński -*/ - -#pragma once - -#include - -namespace Tyra { - -class Tutorial02 : public Game { - public: - Tutorial02(Engine* engine); - ~Tutorial02(); - - void init(); - void loop(); - - private: - void loadTexture(); - void loadSprite(); - - Engine* engine; - - Sprite sprite; -}; - -} // namespace Tyra diff --git a/template/02-sprite/obj/.gitignore b/template/02-sprite/obj/.gitignore deleted file mode 100644 index 44c5ea8..0000000 --- a/template/02-sprite/obj/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/template/02-sprite/res/.gitignore b/template/02-sprite/res/.gitignore deleted file mode 100644 index 44c5ea8..0000000 --- a/template/02-sprite/res/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/template/02-sprite/run.ps1 b/template/02-sprite/run.ps1 deleted file mode 100644 index 74646cc..0000000 --- a/template/02-sprite/run.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -$ConfigFile = Join-Path $PSScriptRoot '../../windows-pcsx2.ps1' -. $ConfigFile - -RunPCSX2 diff --git a/template/02-sprite/src/main.cpp b/template/02-sprite/src/main.cpp deleted file mode 100644 index dc470e1..0000000 --- a/template/02-sprite/src/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -# _____ ____ ___ -# | \/ ____| |___| -# | | | \ | | -#----------------------------------------------------------------------- -# Copyright 2022, tyra - https://github.com/h4570/tyra -# Licensed under Apache License 2.0 -# Sandro Sobczyński -*/ - -#include "engine.hpp" -#include "tutorial_02.hpp" - -/** - * In this tutorial we will learn how to: - * - Load png file and create texture from it - * - Create sprite class - * - Clear screen and render sprite - */ - -int main() { - Tyra::Engine engine; - Tyra::Tutorial02 game(&engine); - engine.run(&game); - return 0; -} diff --git a/template/02-sprite/src/tutorial_02.cpp b/template/02-sprite/src/tutorial_02.cpp deleted file mode 100644 index f4066f6..0000000 --- a/template/02-sprite/src/tutorial_02.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* -# _____ ____ ___ -# | \/ ____| |___| -# | | | \ | | -#----------------------------------------------------------------------- -# Copyright 2022, tyra - https://github.com/h4570/tyra -# Licensed under Apache License 2.0 -# Sandro Sobczyński -*/ - -#include -#include "tutorial_02.hpp" - -namespace Tyra { - -Tutorial02::Tutorial02(Engine* t_engine) : engine(t_engine) {} - -Tutorial02::~Tutorial02() { - engine->renderer.getTextureRepository().freeBySprite(sprite); -} - -void Tutorial02::init() { - engine->renderer.setClearScreenColor(Color(32.0F, 32.0F, 32.0F)); - - /** Sprite contains rectangle information. */ - loadSprite(); - - /** Texture contains png image. */ - loadTexture(); -} - -void Tutorial02::loop() { - auto& renderer = engine->renderer; - - /** Begin frame will clear our screen. */ - renderer.beginFrame(); - - /** Render sprite. */ - renderer.renderer2D.render(sprite); - - /** End frame will perform vsync. */ - renderer.endFrame(); -} - -void Tutorial02::loadSprite() { - const auto& screenSettings = engine->renderer.core.getSettings(); - - sprite.mode = SpriteMode::MODE_STRETCH; - - /** Let's scale it down */ - sprite.size = Vec2(256.0F, 128.0F); - - /** Set it in screen center */ - sprite.position = - Vec2(screenSettings.getWidth() / 2.0F - sprite.size.x / 2.0F, - screenSettings.getHeight() / 2.0F - sprite.size.y / 2.0F); - - TYRA_LOG("Sprite created!"); -} - -void Tutorial02::loadTexture() { - /** - * Renderer has high layer functions, - * which allows to render: - * - Sprite (2D) - * - Mesh (3D) - * - * It uses ONLY low layer functions which are in renderer.core - */ - auto& renderer = engine->renderer; - - /** - * TextureRepository is a repository of textures. - * It is a singleton class, with all game textures. - * We are linking these textures with sprite's (2D) and mesh (3D) materials. - */ - auto& textureRepository = renderer.getTextureRepository(); - - /** - * Texture is stored in "res" directory. - * Content of "res" directory is automatically copied into - * "bin" directory, which contains our final game. - * - * File utils automatically add's device prefix to the path, - * based on current working directory. - * - * In PS2 world: - * - USB has a "mass:" prefix - * - Our PC in PS2Link has a "host:" prefix - * - Our PC in PCSX2 has a "host:" prefix - */ - auto filepath = FileUtils::fromCwd("tyra.png"); - - /** - * Tyra supports following PNG formats: - * 32bpp (RGBA) - * 24bpp (RGB) - * 8bpp, palletized (RGBA) - * 4bpp, palletized (RGBA) - * - * 8bpp and 4bpp are the fastest. - * All of these formats can be easily exported via GIMP. - */ - auto* texture = textureRepository.add(filepath); - - /** Let's assign this texture to sprite. */ - texture->addLink(sprite.id); - - TYRA_LOG("Texture loaded!"); -} - -} // namespace Tyra