Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.1.0 - First working demo with cleaned up code #2

Merged
merged 169 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 165 commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
b1465d9
add gitignore
ctmbl Jan 4, 2022
818f8d4
modify gitignore
ctmbl Jan 4, 2022
de6ec17
multiDrawable class should work
ctmbl Jan 4, 2022
59d836e
feature implemented v1
ctmbl Jan 6, 2022
bbe0efc
Initial commit : strategies constructors with and without default values
Jan 5, 2022
8e9dff4
Character default strategies, + some fixes in multi_drawable & schedu…
Jan 5, 2022
15978b2
Finished constructors
Jan 5, 2022
394cbbe
Wall constructor
Jan 5, 2022
0327d35
Résumé constructeurs entities
bnt-tlr Jan 8, 2022
a19e0b4
First commit
bassetmatt Jan 5, 2022
fe07388
Adjustments for entity displacement
bassetmatt Jan 12, 2022
4d5f64e
Should work
bassetmatt Jan 12, 2022
bea88fe
Added readme and polished code
bassetmatt Jan 19, 2022
29da4db
some addition of files, getters and setters in the entity part.
Xawav Dec 28, 2021
ec7e2d5
add and remove functions for vector in entity part.
Xawav Jan 12, 2022
54c1334
feature implemented v1
Xawav Jan 12, 2022
c15eeee
feature implemented v1.1
Xawav Jan 12, 2022
7f002e7
Not finished correction ETT
Feb 9, 2022
b905eea
starting integration of hitbox and collision, needed EttUpdate and li…
ctmbl Jan 26, 2022
36cdc3c
commit de readme de ses morts
bassetmatt Feb 9, 2022
18025ed
multi-draweable moved
Akainoru Feb 9, 2022
4d9ae43
Merge branch 'ett-merge' of https://github.com/iScsc/wiresmash into e…
Akainoru Feb 9, 2022
775f385
Starting working on main
bassetmatt Feb 9, 2022
5b4bc7e
damageable / .h et .cpp corriges
Akainoru Feb 9, 2022
d861302
controllabe should work: to be modified to use linked list
ctmbl Feb 9, 2022
60b25cf
Correction lib/lib vel and pos. Correction include issues
Feb 16, 2022
71b75b3
Correction numerous includes and littles bugs. Sketch pre_main
Feb 16, 2022
417ccca
quelques modifs sur multi_damageable.h/.cpp
Akainoru Feb 16, 2022
85a918f
quelques modif sur physical_entity.h/.cpp
Akainoru Feb 16, 2022
a54b428
très légère modif su strategy.h/.cpp
Akainoru Feb 16, 2022
bec45ac
très légère modif sur damageable.h/.cpp
Akainoru Feb 16, 2022
12873c7
Code main function, with Entity and a simple PhysicalEntity strategy
Feb 16, 2022
d559db4
Working premain test for updateCinematics. Missing on pfd acceleration.
Feb 28, 2022
9fff0aa
entities now have SPEED
gbrivady Mar 2, 2022
7076486
forces, but better for pfd
gbrivady Mar 2, 2022
3b7733c
N2L
gbrivady Mar 2, 2022
8caa1af
updated main
gbrivady Mar 2, 2022
ab5fe1a
phx part of collision checking
gbrivady Mar 2, 2022
35169c6
merged N2L on premain
gbrivady Mar 3, 2022
fb066ca
removed testing artifact
gbrivady Mar 3, 2022
2031d92
better strategy setters aka "TODO : so ugly"
gbrivady Mar 3, 2022
97435bc
Added vector and bugFix unsigned double
ctmbl Jan 26, 2022
c760689
Added get and has Strategy methods to Entity
ctmbl Jan 26, 2022
95348fd
starting integration of hitbox and collision, needed EttUpdate and li…
ctmbl Jan 26, 2022
73ead5b
Starting working on main
bassetmatt Feb 9, 2022
19ba65e
Correction lib/lib vel and pos. Correction include issues
Feb 16, 2022
856840c
Correction numerous includes and littles bugs. Sketch pre_main
Feb 16, 2022
fb8c0b9
Code main function, with Entity and a simple PhysicalEntity strategy
Feb 16, 2022
95f80ac
Working premain test for updateCinematics. Missing on pfd acceleration.
Feb 28, 2022
1c9368d
entities now have SPEED
gbrivady Mar 2, 2022
850f414
forces, but better for pfd
gbrivady Mar 2, 2022
e39d3dc
N2L
gbrivady Mar 2, 2022
cb142cc
updated main
gbrivady Mar 2, 2022
0bce1c8
Finish rebase, remove triple physical_entit*. Rename PhxParam.
Mar 9, 2022
a4d0c8a
cleanup of multi drawable
gbrivady Mar 12, 2022
cb2c66f
include paths no longer incomplete
gbrivady Mar 12, 2022
dfc0543
constructors public again
gbrivady Mar 12, 2022
a9bd6e5
erase function requires iterator, not index
gbrivady Mar 12, 2022
0b233f7
added collision fixing
gbrivady Mar 15, 2022
1a285ca
removed extra callback
gbrivady Mar 15, 2022
061e4ee
map not included
gbrivady Mar 15, 2022
36231d3
purged conductor to fix conflicts
gbrivady Mar 15, 2022
a1704c5
moved methods out of header file
gbrivady Mar 15, 2022
22de838
missing static modifier
gbrivady Mar 15, 2022
bb41da5
typo
gbrivady Mar 15, 2022
ff4c882
fixed missing override and missing method
gbrivady Mar 15, 2022
6d85682
type typo
gbrivady Mar 15, 2022
11a908d
Merge branch 'ett-merge' into pre_main
gbrivady Mar 16, 2022
1aa7b69
added binary output folder to gitignore
gbrivady Apr 13, 2022
ab097dd
prototype physic implementation
gbrivady Apr 13, 2022
dc7bb00
add proto-entity
gbrivady Apr 13, 2022
b7f8332
prototype of universe master
gbrivady Apr 13, 2022
9246451
comment old main, replace with new one
gbrivady Apr 13, 2022
fd6f127
create empty test file
gbrivady Apr 13, 2022
2f66cba
add root CMakeLists
gbrivady Apr 13, 2022
195c6a3
add src cmakelists
gbrivady Apr 13, 2022
ceb476a
create cmakelists for test directory
gbrivady Apr 13, 2022
05ebc3e
create cmakelists for engine module
gbrivady Apr 13, 2022
a9d4356
Placeholder/PoC main loop with Physic & Entity
Apr 24, 2022
d5cc392
Add demo gravity
Apr 25, 2022
2f7fa5c
add call to default constructor
gbrivady May 8, 2022
35245c6
link smfl in cmakelist
gbrivady May 8, 2022
07c4505
placeholder sprite for entities
gbrivady May 9, 2022
c5373d8
move position linking to friend space
gbrivady May 10, 2022
da0b8d4
demo display and hitboxes pre-implemantation
gbrivady Aug 19, 2022
11519b0
fix gravity direction
gbrivady Aug 20, 2022
a87e9f5
Add 1s delay to frames
gbrivady Aug 20, 2022
d8e5b30
Revert y axis when drawing
gbrivady Aug 20, 2022
b677c8c
remove old files
gbrivady Aug 20, 2022
a21972b
Add method to set sprite
gbrivady Aug 20, 2022
af6edcb
Create dev entity RedSquare
gbrivady Aug 20, 2022
4f0bf87
Correct name convention
gbrivady Aug 21, 2022
17d68e4
untested proto-hitboxes
gbrivady Aug 25, 2022
da7a3ec
Add Entity linking to Hitbox
gbrivady Aug 25, 2022
b2bea71
Add Hitbox to Entity
gbrivady Aug 25, 2022
3345a2f
Create demo routine for hitboxes in universe
gbrivady Aug 25, 2022
0a96501
Update README.md
Aug 25, 2022
2d70184
Merge pull request #1 from gbrivady/a_new_beginning_✨
gbrivady Aug 26, 2022
0f3b975
Limit hitbox to the necessary for development
gbrivady Aug 26, 2022
62b673d
Fix Rectangle-Rectangle collision
gbrivady Aug 27, 2022
660fa56
Fix base constructor call in RedSquare dev class
gbrivady Aug 27, 2022
db0a6e5
Fix iterator for hitbox destacking
gbrivady Aug 27, 2022
c1204b8
Implement collision demonstration
gbrivady Aug 27, 2022
22707b7
Add hitbox to dev entity Red Square
gbrivady Aug 27, 2022
474d946
Create blue terrain dev entity
gbrivady Aug 27, 2022
6d2caf5
Create header file for all dev entities
gbrivady Aug 27, 2022
26203f0
Cleaned physics and hitbox demonstration
gbrivady Aug 29, 2022
5650fae
Rename Hitbox to Box
gbrivady Aug 29, 2022
4df64c8
Move physic folder of engine to its own CMake file
gbrivady Aug 29, 2022
d7c110e
Templatise box classes
gbrivady Aug 29, 2022
49fb2de
Implement box for physic related collision
gbrivady Aug 29, 2022
7acc184
Add physic boxes to entities
gbrivady Aug 29, 2022
3c04510
Add physical boxes to dev entities
gbrivady Aug 29, 2022
594a761
Add physic collision subroutine to universe step
gbrivady Aug 29, 2022
8aab717
Add physic collision demonstration to main app
gbrivady Aug 29, 2022
2c29b52
Clean old files
gbrivady Aug 30, 2022
cb609ba
Implement a more natural phxbox adder to entity
gbrivady Aug 30, 2022
c9f77a4
Adapt dev entities to reflect last commit
gbrivady Aug 30, 2022
0815983
Pause the game when the window loses focus
gbrivady Oct 18, 2022
2f070ee
Swap all the physics back to double before I unlive myself
gbrivady Dec 2, 2022
786715c
Collision cleanup
gbrivady Dec 3, 2022
7875239
Rename collision to intersection
gbrivady Dec 3, 2022
4a62343
Document box class
gbrivady Dec 3, 2022
6e20f3c
Document rectangle-shaped boxes
gbrivady Dec 3, 2022
f3269ce
Document science
gbrivady Dec 3, 2022
9b68c2a
Document Physical (Collision-like) behaviour
gbrivady Dec 3, 2022
529d557
Document physics
gbrivady Dec 3, 2022
a233012
Document entity
gbrivady Dec 3, 2022
425fb1b
Document the universe
gbrivady Dec 3, 2022
5e882d0
Read keybindings from a file
gbrivady Dec 4, 2022
fc084fa
Add default bindings
gbrivady Dec 4, 2022
4e146ec
Update cmake files
gbrivady Dec 4, 2022
7eead20
Initialise keybinds of the universe using a file
gbrivady Dec 4, 2022
23ac94f
Fix string 'SPACE' not being detected as such
gbrivady Dec 4, 2022
a1650a8
Add jump to dev entities
gbrivady Dec 4, 2022
644fe1f
Remove empty if statement
gbrivady Dec 4, 2022
8136d31
Remove dev prints from rectangle class
gbrivady Dec 4, 2022
a154d4a
Remove old commentaries and dev prints from universe master
gbrivady Dec 4, 2022
d2a129d
Remove test subdirectory from build
gbrivady Dec 4, 2022
7b106f8
Update readme
gbrivady Dec 4, 2022
4200008
Document input handling
gbrivady Dec 4, 2022
a608e27
Document input reader from file
gbrivady Dec 4, 2022
0051744
Move keybind definition to input handler
gbrivady Dec 4, 2022
047cf5f
Add launch instruction to readme
gbrivady Dec 4, 2022
47b8955
Fix file path back to Linux-style
gbrivady Dec 4, 2022
62c27b1
Comment useless cmake instructions
gbrivady Dec 4, 2022
8623113
Add highlights to readme
gbrivady Dec 11, 2022
0fc8861
Fixe CMake files for consistency
gbrivady Dec 11, 2022
1fa2160
Remove dead code
gbrivady Dec 11, 2022
2d01138
Add indent for consistency
gbrivady Dec 11, 2022
60cdff3
Typos in box
gbrivady Dec 11, 2022
ccbbf0f
Typos in entity
gbrivady Dec 11, 2022
004f768
Typos in rectangle
gbrivady Dec 11, 2022
6019ab2
Merge branch 'a_new_beginning_✨' of https://github.com/iScsc/wiresmas…
gbrivady Dec 11, 2022
357db04
Revert a mistake
gbrivady Dec 11, 2022
4c52f6b
Merge branch 'a_new_beginning_✨' of https://github.com/iScsc/wiresmas…
gbrivady Dec 11, 2022
a311d57
Empty new lines at the end of universe master
gbrivady Dec 11, 2022
35c4bb8
Typo in physic doc
gbrivady Dec 11, 2022
f24ecb6
Remove empty new line
gbrivady Dec 11, 2022
7f84957
Typo : missing space
gbrivady Dec 11, 2022
828e726
Typo in phxbox
gbrivady Dec 11, 2022
0863910
Rename physic folder to physics
gbrivady Dec 11, 2022
f73753b
Correct cinematic to kinematics
gbrivady Dec 11, 2022
e32a5e2
Fix cinematic to kinematics in the documentation
gbrivady Dec 11, 2022
edb5533
Update README.md
gbrivady Dec 12, 2022
edd0351
Remove dead include from box
gbrivady Dec 20, 2022
a0a25cd
Remove useless SFML package from cmake
gbrivady Dec 20, 2022
2a9de19
Remove point typedef to prevent name ambiguity
gbrivady Jan 8, 2023
f72436c
Rename "Physic" to "Point"
gbrivady Jan 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

build
debug
.cache
.vscode
bin
10 changes: 2 additions & 8 deletions CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ cmake_minimum_required(VERSION 3.16)
project(
"Wiresmash"
VERSION
1.0
0.1
LANGUAGES
CXX
)

file(GLOB_RECURSE SRC_FILES src/*.cpp)
add_executable(app ${SRC_FILES})
target_include_directories(app PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
find_package(SFML 2 REQUIRED network audio graphics window system)
target_include_directories(app PUBLIC ${SFML_INCLUDE_DIR})
target_link_libraries(app sfml-graphics)

add_subdirectory(src)
49 changes: 48 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
IniInitt
# Wiresmash

Wiresmash is a Smash-like game currently under development by the iScsc dev team.

## Currently

The game is currently a very simple demo containing:

- simple physics system: gravity, collisions
- simple graphic system: shapes using SFML
- simple box system: only rectangles, used only for collisions so far
- simple input system, with keybindings read from a file

It consists of two red squares and a blue platform. The squares are controllable using (by default) the keys WASD/IJKL for up/left/down/right and Space/M for "jump".

## Next Step

- A simple combat prototype
- Better jump system
- Real kinematics system with management of velocity, more forces, ...

## Launching

Make sure to launch the executable from the `./bin` folder, or it will not find the keybinds and scream an error.

## Build

### Requirements

- a `C++` compiler of your choice
- `CMake`
- `SFML`

### Building with CMake

Clone the project using `git`, then run the following commands:

```bash
cmake -S ./ -B ./build/
```

to generate a build system, then run:

```bash
cmake --build ./build/
```

to build the executable. You will find the build executable in the `./bin` folder.
17 changes: 0 additions & 17 deletions include/conductor/Conductor.h

This file was deleted.

19 changes: 0 additions & 19 deletions include/conductor/Controllable.h

This file was deleted.

18 changes: 0 additions & 18 deletions include/conductor/ControllerHandler.h

This file was deleted.

18 changes: 0 additions & 18 deletions include/conductor/ScheduleHandler.h

This file was deleted.

101 changes: 101 additions & 0 deletions include/engine/box/box.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* @file box.h
* @author Grégory Brivady
* @brief Box template class definition
* @version 0.1.0
* @date 2022-08-25
*
*/
#ifndef ENGINE_BOX_BOX_H
#define ENGINE_BOX_BOX_H

#include <cmath>
#include <vector>
// #include "engine/entity.h"
typedef std::pair<double, double> point;

// class Entity;
ctmbl marked this conversation as resolved.
Show resolved Hide resolved

/**
* @brief Container for all the information about an intersection of two boxes.
*
* @tparam T behaviour of the boxes
*/
template <typename T>
struct Intersection
{
T* intersecting;
T* intersected ;
std::pair<double, double> intersectionVector = std::make_pair(0, 0); //Vector start from intersecting, towards intersected
Intersection() = default;
};

/**
* @brief Boxes are defined solely as geometrical objects. Their only purpose
* is to check if they intersect with other box-objects of the same type. By
* using the template parameter, one can specify the behaviour of such a box when it
* intersects with another box-object.
*
* @tparam T behaviour of the box
*/
template <typename T>
class Box
{
friend T;

public:

Box() = default;
~Box() = default;

point* getPos() {return pos;};
std::vector<point> getVertices() {return relVertices;};
T* getOwner() {return owner;};

/**
* @brief Check if this box and another one intersects.
*
* @param b
* @return an @see Intersection<T> object
*/
virtual Intersection<T> checkIntersection(Box<T>* b) = 0;

protected:
/**
* @brief direct link to owner's position
*
*/
std::pair<double, double>* pos;

/**
* @brief the behaviour who owns the box
*
*/
T* owner;

/**
* @brief Position of the vertices, relative to the box frame of reference.
* Vertices must be given in trigonometric order.
*/
std::vector<point> relVertices;

private:

/**
* @brief link the position of this box to the one of its owner.
*
* @param pos
*/
void linkPos(std::pair<double, double>* pos);

/**
* @brief link the box to its owner.
*
* @param t
*/
void linkOwner(T* t);
};

#include "../src/engine/box/box.tpp" //TODO : find a better way to include this

#endif
59 changes: 59 additions & 0 deletions include/engine/box/rectangle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* @file rectangle.h
* @author Grégory Brivady
* @brief A rectangle
* @version 0.1
* @date 2022-12-03
*
*/
#ifndef ENGINE_BOX_RECTANGLE_H
#define ENGINE_BOX_RECTANGLE_H

#include <iostream>
#include <algorithm>

#include "engine/box/box.h"

/**
* @brief A rectangle, defined by 4 vertices, starting from bottom-left, and then
* progressing in trigonometric order.
* @see Box<T>
*
* @tparam T Behaviour of the rectangle-box
*/
template <typename T>
class Rectangle: public Box<T>
{
public:

/**
* @brief Construct a new Rectangle object by using only its length
* and its height.
*
* @param x Length of the rectangle on the x (horizontal) axis
* @param y Height of the rectangle on the y (vertical) axis
*/
Rectangle(double x, double y);

/**
* @brief Construct a new Rectangle object by specifying all 4 points of the rectangle.
*
* @details If x1 < x2 and y1 < y2, its bottom-left corner and top-right corner will be:
* (x1, y1) and (x2, y2).
*
*
* @param x1
* @param y1
* @param x2
* @param y2
*/
Rectangle(double x1, double y1, double x2, double y2);

Intersection<T> checkIntersection(Rectangle<T>* ); //implemented by this class
//TODO : HORRIBLE
Intersection<T> checkIntersection(Box<T>* h) {return dynamic_cast<Rectangle<T>*>(h)->checkIntersection(this); }; //let the other class handle the collision
};
amtoine marked this conversation as resolved.
Show resolved Hide resolved

#include "../src/engine/box/rectangle.tpp" //Todo : same as box.tpp todo

#endif
Loading