Giter Site home page Giter Site logo

h4570 / tyra Goto Github PK

View Code? Open in Web Editor NEW
436.0 28.0 35.0 4.9 MB

Game engine for PlayStation 2™

License: Apache License 2.0

C++ 90.40% Makefile 0.67% Dockerfile 0.22% C 0.32% Assembly 7.88% PowerShell 0.51%
ps2 retro psx playstation playstation2 game library lib engine renderer

tyra's Introduction

tyra's People

Contributors

dooskington avatar foxar avatar freebytego avatar guidodqr avatar h4570 avatar israpps avatar nicholas477 avatar wellinator avatar wolf3s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tyra's Issues

New CameraBase

CameraBase needs refactoring, so far I noticed the following needs to be done:

  • Change p_position and p_up Vector3 pointers to normal Vector3 variables, and adjust the constructor for it.
  • Make the class abstract (?)

Rename mesh_material to mesh_subgroup

I feel like mesh_material is an incorrect name for the class considering that it is responsible for mesh data of sub-parts of another, bigger mesh.

Repo description

I don't quite think labeling tyra as a "renderer" does it justice. It manages model loading, sound playing, I/O for the controllers and we plan to add more, with renderer being only a part of it. @h4570

I suggest we change the description to not incude the 'renderer' part as it implies it's only that. "Game engine" or "Multimedia library" or such would be more accurate.

Concentrate all method's definitions in the .cpp files of their respective class

I'm not sure why some methods are defined within the header files while some in the cpp files of some classes. Good example is
mesh_frame.hpp
void setVertexFace(const u32 &t_index, const u32 &t_val) { vertexFaces[t_index] = t_val; }
void setSTFace(const u32 &t_index, const u32 &t_val) { stFaces[t_index] = t_val; }
void setNormalFace(const u32 &t_index, const u32 &t_val) { normalFaces[t_index] = t_val; }

I understand they are short and possibly self-explanatory from the name, but perhaps it'd be better to concentrate all definitions of a given class in one file to make finding definitions a bit easier. Need your opinion on it @h4570

Move into GCC11!

I did some tests through latest months, and from what I see, we can securely move to GCC11! :)

Enable rendering of meshes without textures / normals data.

Currently the renderer, as far as I'm aware is not capable of rendering texture or normals data. It'd be beneficient to allow such, limiting crashing and allowing to test models within Tyra without having to provide full set of data for them.

Add assert(), remove PRINT_ERR()

  • Use assert() in default Makefile task
  • Add second make task "release" to Makefile which will be NOT using assert()
  • Replace all PRINT_ERR() with assert()
  • Add optional string parameters to assert(), so there will be possible to do something like assert(file != NULL, "File: ", file.name, " cant be null!");

Refactor BBox constructors

Current bbox constructors are real mess.

I wondered about

  • static CoreBBox createByA()
  • static CoreBBox createByB()
  • ...

functions, to keep it more clear

Add "starter" sample

I think that there will be good idea to add "starter" sample, which should be an easy start with Tyra.

Check for possible "const &" and "inline" improvements.

I'm sure that many of getters/setters can have better performance by simply add inline keyword.
Also many of functions (math.cpp, vifsender.cpp, ...) do not have const & parameters where it should be.

Examples of lack of inline:

const u32 &getVertexCount() const { return vertexCount; };

Vector3 *getBoundingBox() { return boundingBox; };

Examples of lack of const &:

Vector3(float t_x, float t_y, float t_z);

Add stopAudio() to audio class.

Current problem is that, we cant really stop the ADPCM sample.
I wonder, that we can add wrapper to audsrv_stop_audio() in our audio class.
We need some check how this function works, and how we can use it in audio class.

Lighting support in draw()

Currently lighting is supported only in drawByPath3(), which have low performance and triangle clipping glitches.

Need to implement lighting in VU1 code (.vcl) file

2D sprites tile by default instead stretching

Commit that possibly broke it: #30

After I pulled the develop branch to my fork today I've discovered that the fullscreen sprite I'm using for underwater swimming tiles, instead of stretching.

It now looks like this:
pcsx2_UD0s7jgPj9

@h4570 Please elaborate on if this is meant to be the default behavior and if so, can sprites be made to stretch instead of tiling?

Allow arguments of volume and pitch to be used for ADPCM player.

Right now, if I want a sound to play at a specific volume, I have to go the long winded way of doing:

audio.setADPCMVolume(40, 2);
audio.playADPCM(sound, 2);

This also means the channel 2 will stay at volume 40, forcing the user to either:

  • Always set the volume they desire for the sound effect or
  • Creating some timer-based channel volume resets to 100.

I think either enabling the user to designate the volume (and pitch maybe) while using playADPCM() could simplify the first option, while also the timed mechanism i spoke of can also be introduced to Tyra.

I believe it's a good idea as Tyra's meant to be a simple way to make PS2 games, and such an automatic volume reset (opt2) / consolidation of parameter setting (opt1) may simplify the process.

PRINT_ERR String formatting

If we'd allow for syntax similar to printf and feeding variable values into PRINT_ERR it could allow for more informative error messages
Example:
PRINT_ERR("Failed to load file %s!\n",someString)

Create "Dolphin" sample

Dolphin sample TO-DO (might be changed later)

  • Animated water(mesh,code)
  • Collectible (mesh,code)
  • Seabed (mesh,code)
  • Readme

Create file service

Create file service which will work in other thread and receive "tasks" for reading certain files partially (read chunk) or completly.
Read chunk by chunk will be great for audio class. Next chunks of song data will be loaded in background, so there will be no "wait" in audio thread. Sometime's song is freezing for couple of miliseconds on real PS2, because of file loading.

void FileService::threadLoop()

chunkReadStatus = fread(wavChunk, 1, sizeof(wavChunk), wav);

Contributing document

Since as I expect we will have soon more developers on the project, I suggest we create a Contributions/Rules of conduct document.

Implement triangle clipping algorithm for big triangles. (Renderer, VU1)

Triangle clipping is not that broken like in drawByPath3() , but this need also some polishing.
When triangle is big and its partially outside of view frustum, we can see some weird behavior, that whole triangle is discarded.

fcset 0x000000 ; VCL won't let us use CLIP without first zeroing

clipw.xyz vertex, vertex ; Dr. Fortuna: This instruction checks if the vertex is outside

Static code analysis, C++ lint

I think that we can add CI to Tyra pull reqeuests, including:

  • Static code analysis
  • C++ lint check
  • Building all of the tutorials + demo

It should not be super hard, because we have cooked docker image

Add 2D font support

There are two ways of doing this.

  1. Use PS2SDK font library, but this will require for us impress.ini file which is not present in PS2SDK.

  2. Better option - do it similiar like in gsKit, but this require more effort

Add build tutorial

I'm wondering about some tutorial in .md format, where will be described:

  • How to build PS2SDK for Tyra.
  • How to build Tyra.
  • How to build samples.
  • How unpack samples assets.
  • What to do in PCSX2 to make Tyra samples running.

Change way of ID generation

Currently id numbers are generated via random() function which is really bad.
Probably we can implement 3rd-party lib or just increment it in separated class.

Add information about PCSX2 "hostfs=enabled"

Tyra loads at the beginning AUDSRV.IRX module.
When user have not "hostfs" set, this module will not be loaded (loading error).
It will be nice to have more clear error message there.
Maybe something like "First module loading failed. If you are using PCSX2, be sure that you have hostfs=enabled and assets files, are present in bin/ folder"

Include deltatime-based behavior in engine classes

Currently, the games built with Tyra need to manage the delta-time usage themselves. This means moving an object by speed * 60/currentFPS, to achieve a FPS-independent movement. I had an idea to introduce methods to classes like mesh.cpp whereby changes to their member variables would automatically be influenced by deltatime. Such as mesh::moveByDeltaTime(Vector3);

The plus side is it'd make it easier to create game with Tyra, having automated that process. The minus is it might be considered bloat and unnecessary as developers might have different ideas in mind for how to handle their physics and ignore such methods entirely.

I need your opinion, @h4570

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.