Skip to content

Commit

Permalink
Last big update for the first dev step
Browse files Browse the repository at this point in the history
  • Loading branch information
lynerlok committed Jul 17, 2020
1 parent 87fc422 commit a50b85a
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 84 deletions.
75 changes: 25 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# CalmWood-CPP
# ROS video game

WINDOWS AND LINUX ONLY. Unfortunaly, no unigine sdk is compatible with macOS.
# This future video game use V2E ( Virtual Ecosystem Engine )

# V2E is in the source folder named "V2E"

CPP files for multi agent system module
WINDOWS AND LINUX ONLY. Unfortunaly, no unigine sdk is compatible with macOS.

/!\ data directory is missing to avoid heavy GIT project !

/!\ This is a very early project with no good graphics optimization and only a debug ( development ) version !

Hardware in use to build and run the simulation :

* GPU : MSI Gaming X TRIO 2080 TI
* CPU : AMD Ryzen 9 3950X 3.5 Ghz, 8 cores, 16 threads
* RAM : Corsair LPX Vengeance 3200 MHz 32 Gio
* OS : Linux version 5.7.7-200.fc32.x86_64 ([email protected]) (gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC), GNU ld version 2.34-3.fc32) #1 SMP Wed Jul 1 19:53:01 UTC 2020

Please report your configuration in case of issue.


# DEV BUILD INSTRUCTIONS

Expand Down Expand Up @@ -50,58 +63,20 @@ https://developer.unigine.com/en/docs/2.11/code/environment/windows?rlang=cpp

# TO DO LIST

1. ~~Enlever "Dead" depuis "Move" ( remove statiety index from move move towards )~~

2. ~~Faire un README~~

3. ~~Décrémenter satiety index à chaque decision~~

4. ~~Check RNG, si on prend bien tout les animaux par RUN~~

5. ~~1 détection = 1 décision ( éviter les loop si movProba = 100 )~~

6. ~~Multiple spawn + implémenter correctement spawn GUI~~

7. ~~GUI déplacement non aléatoire~~

8. ~~GUI déplacement aléatoire~~

9. ~~Vérifier si protéger territoire est cohérent~~

10. Affiner proba

11. ~~GUI remove dead animal ( world --> delete animal system call world->deleteAnimal )~~

12. ~~Réduire amplitude en Z~~

13. ~~Bool isMoving dans GC_environment : while true = déplacement non aléatoire, while false = déplacement aléatoire~~

14. ~~Birth Date pour changer d'état ( State Date ) ==> relié avec 6 si on passe de 0 à 1 invoquer createGUIAnimal !~~

15. ~~Supprimer les proba inutiles~~

16. Texture animal

17. Faire des tiles avec maisons, forêt, marais, bord de marais

18. Interface user

19. ~~Passer tout les agents par RUN ???~~

20. Animation animal ( vol + se poser )
1. Probabilities correction.

21. Animation auxiliaire ( attaquer,... )
2. Texturing.

22. ~~Si rien de plus dans animal.run ( que detection ) supprimer animal.run au profit d'animal.detection~~
3. User interface.

23. ~~Review attack !!~~
4. System Integration.

24. ~~**BUG** DEAD !! SIGSEV~~
5. Special animation than land/take off.

25. ~~Rework detection + decision ==> collecter ttes les cases~~
6. Add other animals.

26. Ajouter biologie en fonction de l'environnement
7. Plants and Cells better integration.

27. Gérer plantes
18. User Interface.

28. Faire le cahier de maintenance ( comment ajouter des animaux modifier params... )
19. Optimization ( graphical and code )
8 changes: 4 additions & 4 deletions source/AppSystemLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#include <UnigineEngine.h>
#include <UnigineStreams.h>

#include "SMA/U_randomGenerator.hpp"
#include "SMA/C_animal.hpp"
#include "SMA/C_plant.hpp"
#include "SMA/C_environment.hpp"
#include "V2E/U_randomGenerator.hpp"
#include "V2E/C_animal.hpp"
#include "V2E/C_plant.hpp"
#include "V2E/C_environment.hpp"

#include "ComponentSystem/ComponentSystem.h"

Expand Down
25 changes: 18 additions & 7 deletions source/AppWorldLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#include <UnigineEngine.h>
#include <UnigineStreams.h>

#include "SMA/U_randomGenerator.hpp"
#include "SMA/C_animal.hpp"
#include "SMA/C_plant.hpp"
#include "SMA/C_environment.hpp"
#include "V2E/U_randomGenerator.hpp"
#include "V2E/C_animal.hpp"
#include "V2E/C_plant.hpp"
#include "V2E/C_environment.hpp"

#include "ComponentSystem/ComponentSystem.h"

Expand Down Expand Up @@ -144,16 +144,26 @@ int AppWorldLogic::createAnimal ( Animal * animal )

if ( animal->getGrowthState() == 2 ) {

meshPathStr = "animals_assets/" + animal->getName() + "_MESH.mesh" ;
meshPathStr = "animals_assets/A_" + animal->getName() + ".fbx/" + animal->getName() + ".mesh" ;
meshPathConst = meshPathStr.c_str();

temporaryMesh = ObjectMeshSkinned::create ( meshPathConst );

meshPathStr = "animals_assets/A_" + animal->getName() + ".fbx/A_" + animal->getName() + ".anim" ;

temporaryMesh->setAnimation ( 0, meshPathStr.c_str() );

temporaryMesh->setSpeed(60.0f);

temporaryMesh->play();

temporaryMesh->setLoop ( 1 );

direction = runRNG ( -180,180 );

agentLocation = animal->getLocation();

temporaryMesh->setPosition ( Vec3 ( ( float ) agentLocation[0], ( float ) agentLocation[1], getFloat ( 1, 3 ) ) );
temporaryMesh->setPosition ( Vec3 ( ( float ) agentLocation[0], ( float ) agentLocation[1], 0.5f ) );

temporaryMesh->setDirection ( Vec3 ( 0.0f, 0.0f, static_cast<float> ( direction ) ), Vec3 ( 0.0f, 0.0f, 1.0f ) );

Expand All @@ -170,3 +180,4 @@ int AppWorldLogic::createAnimal ( Animal * animal )

return 0;
}

1 change: 1 addition & 0 deletions source/AppWorldLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class AppWorldLogic : public Unigine::WorldLogic
vector<ObjectMeshSkinnedPtr>::iterator agent;
vector<Animal *>::iterator agentAnimal;
vector<Plant *>::iterator agentPlant;
MeshPtr mesh;

GAnimal * animal;
GPlant * plant;
Expand Down
10 changes: 5 additions & 5 deletions source/GraphicalClass/GC_animal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#include <UnigineConsole.h>
#include <UnigineRender.h>

#include "../SMA/U_randomGenerator.hpp"
#include "../SMA/C_animal.hpp"
#include "../SMA/C_plant.hpp"
#include "../SMA/C_environment.hpp"
#include "../V2E/U_randomGenerator.hpp"
#include "../V2E/C_animal.hpp"
#include "../V2E/C_plant.hpp"
#include "../V2E/C_environment.hpp"

#include "../ComponentSystem/ComponentSystem.h"

#include "../SMA/C_animal.hpp"
#include "../V2E/C_animal.hpp"
#include "GC_animal.hpp"

using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion source/GraphicalClass/GC_animal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected :
float X = 0.0f;
float Y = 0.0f;

float movement_speed = 5.0f;
float movement_speed = 3.0f;
float angleMultiplicator = 1.2f;
float angle = 0.0f;

Expand Down
2 changes: 1 addition & 1 deletion source/GraphicalClass/GC_plant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <UnigineControls.h>
#include <UnigineConsole.h>
#include <UnigineRender.h>
#include "../SMA/C_plant.hpp"
#include "../V2E/C_plant.hpp"

#include "../ComponentSystem/ComponentSystem.h"

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions source/SMA/C_animal.hpp → source/V2E/C_animal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Leucorrhinia: public Animal
{
public :
Leucorrhinia ( int id = 0,
std::string newName = "Leucorrhinia",
std::string newName = "leucorrhinia",
std::vector<unsigned int> lifeCycle = {1,24,1},
std::vector<int> probabilities = {100,0,0,0,50,0,0,60},
std::vector<int> detectionRadius = {1,1,2},
Expand All @@ -129,7 +129,7 @@ protected :
class Hyla: public Animal
{
public :
Hyla ( int id = 1, std::string newName = "Hyla" ) :Animal ( id, newName ) {}
Hyla ( int id = 1, std::string newName = "hyla" ) :Animal ( id, newName ) {}
~Hyla() {};
protected :
int decision ( Environment * environment, std::vector<std::unordered_multimap<int, Animal *>> * VisibleAnimals, std::vector<std::unordered_multimap<int, Plant * >> * VisiblePlants, std::vector<std::vector<int>> * CellSpecs );
Expand All @@ -138,7 +138,7 @@ protected :
class Phengaris: public Animal
{
public :
Phengaris ( int id = 2, std::string newName = "Phengaris" ) :Animal ( id, newName ) {}
Phengaris ( int id = 2, std::string newName = "phengaris" ) :Animal ( id, newName ) {}
~Phengaris() {};
protected :
int decision ( Environment * environment, std::vector<std::unordered_multimap<int, Animal *>> * VisibleAnimals, std::vector<std::unordered_multimap<int, Plant * >> * VisiblePlants, std::vector<std::vector<int>> * CellSpecs );
Expand All @@ -147,7 +147,7 @@ protected :
class Zootoca: public Animal
{
public :
Zootoca ( int id = 3, std::string newName = "Zootoca" ) :Animal ( id, newName ) {}
Zootoca ( int id = 3, std::string newName = "zootoca" ) :Animal ( id, newName ) {}
~Zootoca() {};
protected :
int decision ( Environment * environment, std::vector<std::unordered_multimap<int, Animal *>> * VisibleAnimals, std::vector<std::unordered_multimap<int, Plant * >> * VisiblePlants, std::vector<std::vector<int>> * CellSpecs );
Expand All @@ -156,7 +156,7 @@ protected :
class Vipera: public Animal
{
public :
Vipera ( int id = 4, std::string newName = "Vipera" ) :Animal ( id, newName ) {}
Vipera ( int id = 4, std::string newName = "vipera" ) :Animal ( id, newName ) {}
~Vipera() {};
protected :
int decision ( Environment * environment, std::vector<std::unordered_multimap<int, Animal *>> * VisibleAnimals, std::vector<std::unordered_multimap<int, Plant * >> * VisiblePlants, std::vector<std::vector<int>> * CellSpecs );
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected :
float antropizationRate = 0.0; // Default a super dry, cold and wild environment :)

// map, action field
const unsigned int mapLength = 50;
const unsigned int mapLength = 20;

MAP map{mapLength};

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,9 @@ inline std::vector<float> getDirection ( int lower, int upper )
srand (static_cast <unsigned> (time(0)));

for ( int i = 0; i < 3; ++i )
vector.push_back ( lower + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(upper-lower))) );
vector.push_back ( lower + static_cast <float> (rand()) / ( static_cast <float> (RAND_MAX/(upper-lower))) );

return vector ;
}

inline float getFloat ( int lower, int upper )
{
srand((unsigned int)time(NULL));
return (float(rand())/float((RAND_MAX)) * upper) + lower;
}
#endif // __RANDOMUTILS_H_INCLUDED__
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#include <UnigineEngine.h>
#include <UnigineStreams.h>

#include "SMA/U_randomGenerator.hpp"
#include "SMA/C_animal.hpp"
#include "SMA/C_plant.hpp"
#include "SMA/C_environment.hpp"
#include "V2E/U_randomGenerator.hpp"
#include "V2E/C_animal.hpp"
#include "V2E/C_plant.hpp"
#include "V2E/C_environment.hpp"

#include "ComponentSystem/ComponentSystem.h"

Expand Down

0 comments on commit a50b85a

Please sign in to comment.