Browse Source

started working on training

meemknight 2 years ago
parent
commit
42baec33e7

BIN
Pika/engineResources/engineSaves/window1.bin


BIN
Pika/engineResources/engineSaves/window2.bin


BIN
Pika/engineResources/engineSaves/windowPos1.bin


BIN
Pika/engineResources/engineSaves/windowPos2.bin


+ 2 - 0
Pika/gameplay/containers.h

@@ -18,6 +18,7 @@ Container *getContainer(const char* name, pika::memory::MemoryArena *memoryArena
 #include "containers/mario/mario.h"
 #include "containers/mario/marioEditor.h"
 #include "containers/mario/marioNeuralVizualizer.h"
+#include "containers/mario/marioNeuralTrainer.h"
 #include "pluggins/immageviewer.h"
 #include "pluggins/threeDEditor.h"
 #include "pluggins/pikatextEditor.h"
@@ -41,6 +42,7 @@ Container *getContainer(const char* name, pika::memory::MemoryArena *memoryArena
 	PIKA_DECLARE_CONTAINER(PikaTextEditor) \
 	PIKA_DECLARE_CONTAINER(Mario) \
 	PIKA_DECLARE_CONTAINER(MarioEditor) \
+	PIKA_DECLARE_CONTAINER(MarioNeuralTrainer) \
 	PIKA_DECLARE_CONTAINER(MarioNeuralVizualizer)// \
 	//PIKA_DECLARE_CONTAINER(McDungeonsEditor) \
 	//PIKA_DECLARE_CONTAINER(McDungeonsGameplay) \

+ 146 - 0
Pika/gameplay/containers/mario/mario.cpp

@@ -363,5 +363,151 @@ end:
 
 }
 
+void getVision(char vision[visionSizeX * visionSizeY], mario::GameplaySimulation &simulator, PlayerSimulation &p)
+{
+	memset(vision, 0, sizeof(vision));
+	for (int y = 0; y < visionSizeY; y++)
+	{
+		for (int x = 0; x < visionSizeX; x++)
+		{
+			auto b = simulator.
+				getMapBlockSafe(
+				x + p.p.position.getCenter().x - 1,
+				y + p.p.position.getCenter().y - visionSizeY + 4);
+
+			vision[x + y * visionSizeX] = b.isCollidable();
+		}
+	}
+}
+
+bool performNeuralSimulation(PlayerSimulation &p, float deltaTime, mario::GameplaySimulation &simulator, mario::NeuralNetork
+	&network)
+{
+	if (p.p.position.position.x > p.maxFit)
+	{
+		p.maxFit = p.p.position.position.x;
+		p.killTimer = 0;
+	}
+	else
+	{
+		p.killTimer += deltaTime;
+		if (p.killTimer > 3)
+		{
+			//	return 0;
+		}
+	}
+
+	//simulator.moveDelta = 1;
+	//simulator.jump = 0;
+	char vision[visionSizeX * visionSizeY];
+	getVision(vision, simulator, p);
+
+	//input
+	network.compute(simulator.moveDelta, simulator.jump, vision);
+
+	if (!simulator.updateFrame(deltaTime, p.p))
+	{
+		return 0;
+	}
+	else
+	{
+		return 1;
+	}
+
+}
+
+void renderNeuralNetwork(gl2d::Renderer2D &renderer, char vision[mario::visionSizeX * mario::visionSizeY], float blockSizePreview, mario::NeuralNetork &network)
+{
+	auto renderLine = [&](glm::vec2 a, glm::vec2 b, glm::vec4 color)
+	{
+		float dist = glm::distance(a, b);
+		float thickness = 5;
+
+		glm::vec2 vect = b - a;
+
+		float angle = -std::atan2(vect.y, vect.x);
+		//float angle = 0;
+
+		renderer.renderRectangle({a, dist, thickness}, color, {-dist / 2.f,0}, glm::degrees(angle));
+	};
+
+	renderer.pushCamera();
+	renderer.renderRectangle(
+		glm::vec4(0, 0, mario::visionSizeX * (float)blockSizePreview, mario::visionSizeY * (float)blockSizePreview)
+		, {0.5,0.5,0.5,0.5});
+	for (int y = 0; y < mario::visionSizeY; y++)
+	{
+		for (int x = 0; x < mario::visionSizeX; x++)
+		{
+			auto b = vision[x + y * mario::visionSizeX];
+			if (b == 1)
+			{
+				renderer.renderRectangle(glm::vec4(x, y, 0.95, 0.95) * (float)blockSizePreview, {0,1,0,0.5});
+			}
+			//else
+			//{
+			//	renderer.renderer.renderRectangle(glm::vec4(x, y, 0.95, 0.95) * (float)blockSizePreview, {0.5,0.5,0.5,0.5});
+			//}
+		}
+	}
+	renderer.renderRectangle(
+		glm::vec4(
+		1,
+		mario::visionSizeY - 4,
+		PLAYER_SIZE) *
+		(float)blockSizePreview, {0,0,1,0.5});
+
+	glm::vec2 upkeyPositions(mario::visionSizeX * blockSizePreview * 3,
+		mario::visionSizeY * blockSizePreview * 0.5 - blockSizePreview * 2);
+
+	glm::vec2 leftkeyPositions(mario::visionSizeX * blockSizePreview * 3,
+		mario::visionSizeY * blockSizePreview * 0.5);
+
+	glm::vec2 rightkeyPositions(mario::visionSizeX * blockSizePreview * 3,
+		mario::visionSizeY * blockSizePreview * 0.5 + blockSizePreview * 2);
+
+
+	for (int i = 0; i < 3; i++)
+	{
+		for (int j = 0; j < mario::visionTotal; j++)
+		{
+
+			if (network.weights[i][j] != 0)
+			{
+				glm::vec4 color;
+				if (network.weights[i][j] > 0)
+				{
+					color = glm::vec4(0, 1, 0, network.weights[i][j] / 1.5);
+				}
+				else
+				{
+					color = glm::vec4(1, 0, 0, network.weights[i][j] / -1.5);
+				}
+
+				color.w = glm::clamp(color.w, 0.1f, 1.f);
+
+				glm::vec2 positions[] = {upkeyPositions, leftkeyPositions, rightkeyPositions};
+
+				renderLine((glm::vec2(j % mario::visionSizeX, j / mario::visionSizeX) + glm::vec2(0.5, 0.5)) * (float)blockSizePreview, positions[i] + glm::vec2(blockSizePreview) / 2.f,
+					color);
+
+			}
+
+
+		}
+	}
+
+	renderer.renderRectangle(
+		glm::vec4(upkeyPositions, blockSizePreview, blockSizePreview)
+		, {0,0,1,0.5});
+	renderer.renderRectangle(
+		glm::vec4(leftkeyPositions, blockSizePreview, blockSizePreview)
+		, {0,0,1,0.5});
+	renderer.renderRectangle(
+		glm::vec4(rightkeyPositions, blockSizePreview, blockSizePreview)
+		, {0,0,1,0.5});
+
+	renderer.popCamera();
+}
 
 };

+ 9 - 3
Pika/gameplay/containers/mario/mario.h

@@ -15,6 +15,7 @@ struct Mario: public Container
 
 	mario::GameplaySimulation simulator;
 	mario::GameplayRenderer renderer;
+	mario::Player player;
 	
 	pika::FileChanged fileChanged;
 
@@ -35,6 +36,9 @@ struct Mario: public Container
 
 	bool create(RequestedContainerInfo &requestedInfo, pika::StaticString<256> commandLineArgument)
 	{
+		player.position.position = {1,1};
+		player.lastPos = {1,1};
+
 		if (commandLineArgument.size() != 0)
 		{
 			mapFile = commandLineArgument.to_string();
@@ -85,16 +89,18 @@ struct Mario: public Container
 				simulator.jump = false;
 			}
 
-			if (!simulator.updateFrame(input.deltaTime))
+			if (!simulator.updateFrame(input.deltaTime, player))
 			{
-				simulator.player.position.position = {1,1};
-				simulator.player.lastPos = {1,1};
+				player.position.position = {1,1};
+				player.lastPos = {1,1};
 			}
 
 		
 		}
 		
 		renderer.update(input, windowState, simulator);
+		renderer.followPlayer(player, input, windowState);
+		renderer.drawPlayer(player);
 		renderer.render();
 
 		return true;

+ 91 - 62
Pika/gameplay/containers/mario/marioCommon.h

@@ -101,15 +101,13 @@ struct GameplaySimulation
 
 	bool create(RequestedContainerInfo &requestedInfo, std::string file)
 	{
-		player.position.position = {1,1};
+		//player.position.position = {1,1};
 
 		bool rez = loadMap(requestedInfo, file, &map, mapSize);
 
 		return rez;
 	}
 
-	Player player;
-
 	Block *map;
 	glm::ivec2 mapSize = {100, 100};
 
@@ -131,7 +129,7 @@ struct GameplaySimulation
 	int moveDelta = 0;
 	bool jump = 0;
 
-	bool updateFrame(float deltaTime)
+	bool updateFrame(float deltaTime, Player &player)
 	{
 		player.input = moveDelta;
 		if(jump)player.jump(50);
@@ -212,7 +210,7 @@ struct GameplayRenderer
 	}
 
 
-	void update(pika::Input input, pika::WindowState windowState,
+	void update(pika::Input &input, pika::WindowState &windowState,
 		GameplaySimulation &simulator)
 	{
 		{
@@ -232,10 +230,7 @@ struct GameplayRenderer
 		renderer.currentCamera.zoom = std::min(renderer.currentCamera.zoom, 70.f);
 		renderer.currentCamera.zoom = std::max(renderer.currentCamera.zoom, 50.f);
 
-		//todo update gl2d this function
-		renderer.currentCamera.follow(simulator.player.position.getCenter(), input.deltaTime * 3, 0.0001, 0.2, windowState.w, windowState.h);
-		
-
+	
 		auto viewRect = renderer.getViewRect();
 
 		glm::ivec2 minV;
@@ -260,14 +255,28 @@ struct GameplayRenderer
 				}
 		}
 
-		glm::vec4 pos(simulator.player.position.position, 1, 1);
-		//pos.y -= 1 / 8.f;
-		pos.x -= 1 / 8.f;
+		
+
+		
+
+
+	}
+
+	void followPlayer(mario::Player &p, pika::Input &input, pika::WindowState &windowState)
+	{
+		//todo update gl2d this function
+		renderer.currentCamera.follow(p.position.getCenter(), input.deltaTime * 3, 0.0001, 0.2, windowState.w, windowState.h);
 
-		renderer.renderRectangle(pos, {}, {}, marioTexture,
-			simulator.player.movingRight ? glm::vec4(0, 1, 1, 0) : glm::vec4(1, 1, 0, 0));
 
+	}
 
+	void drawPlayer(mario::Player &p)
+	{
+		glm::vec4 pos(p.position.position, 1, 1);
+		//pos.y -= 1 / 8.f;
+		pos.x -= 1 / 8.f;
+		renderer.renderRectangle(pos, {}, {}, marioTexture,
+			p.movingRight ? glm::vec4(0, 1, 1, 0) : glm::vec4(1, 1, 0, 0));
 	}
 
 	void render()
@@ -285,77 +294,97 @@ struct GameplayRenderer
 
 };
 
-struct NeuralSimulator
-{
-	mario::GameplaySimulation simulator;
+static constexpr int visionSizeX = 6;
+static constexpr int visionSizeY = 9;
 
-	float maxFit = 0;
-	float currentPos = 0;
-	float killTimer = 0;
+static constexpr int visionTotal = visionSizeX * visionSizeY;
 
-	bool create(RequestedContainerInfo &requestedInfo, std::string_view file)
-	{
-		bool rez = simulator.create(requestedInfo, std::string(file));
-
-		currentPos = simulator.player.position.position.x;
-
-		return rez;
-	}
-
-	static constexpr int visionSizeX = 6;
-	static constexpr int visionSizeY = 9;
-	char vision[visionSizeX * visionSizeY] = {};
+struct NeuralNetork
+{
+	float weights[3][visionTotal] = {};
 
-	bool updateFrame(float deltaTime)
+	void compute(int &moveDirection, bool &jump, char input[visionTotal])
 	{
-
-		if (simulator.player.position.position.x > maxFit)
-		{
-			maxFit = simulator.player.position.position.x;
-			killTimer = 0;
-		}
-		else
+		float rezult[3] = {};
+		for (int i = 0; i < 3; i++)
 		{
-			killTimer += deltaTime;
-			if (killTimer > 3)
+			for (int j = 0; j < visionTotal; j++)
 			{
-			//	return 0;
+				rezult[i] += input[j] * weights[i][j];
 			}
 		}
 
-		//simulator.moveDelta = 1;
-		//simulator.jump = 0;
-
-		memset(vision, 0, sizeof(vision));
-		for (int y = 0; y < visionSizeY; y++)
+		float dir = rezult[2] - rezult[1];
+		if (std::abs(dir) < 1) { moveDirection = 0; }
+		else if(dir > 0)
 		{
-			for (int x = 0; x < visionSizeX; x++)
-			{
-				auto b = simulator.
-					getMapBlockSafe(
-					x + simulator.player.position.getCenter().x - 1, 
-					y + simulator.player.position.getCenter().y - visionSizeY + 4);
-
-				vision[x + y * visionSizeX] = b.isCollidable();
-			}
+			moveDirection = 1;
+		}
+		else
+		{
+			moveDirection = -1;
 		}
 
-		if (!simulator.updateFrame(deltaTime))
+		if (rezult[0] > 1)
 		{
-			return 0;
+			jump = 1;
 		}
 		else
 		{
-			return 1;
+			jump = 0;
 		}
 
 	}
 
-	void cleanup()
+	float getRandomFloat(std::mt19937 &rng, float min, float max)
+	{
+		std::uniform_real_distribution<float> dist(min, max);
+		return dist(rng);
+	}
+
+	int getRandomInt(std::mt19937 &rng, int min, int max)
+	{
+		std::uniform_int_distribution<int> dist(min, max);
+		return dist(rng);
+	}
+
+	void addRandomNeuron(std::mt19937 &rng)
 	{
-		simulator.cleanup();
+		std::vector<glm::ivec2> positions;
+		positions.reserve(visionTotal*3);
+		for (int i = 0; i < 3; i++)
+			for (int j = 0; j < visionTotal; j++)
+			{
+				if (weights[i][j] == 0)
+				{
+					positions.push_back({i,j});
+				}
+			}
+
+		if (!positions.empty())
+		{
+			auto index = getRandomInt(rng, 0, positions.size() - 1);
+			weights[positions[index].x][positions[index].y] = getRandomFloat(rng, -1.5, 1.5);
+		}
+
 	}
 
 };
 
+struct PlayerSimulation
+{
+	mario::Player p;
+	float maxFit = 0;
+	float killTimer = 0;
+};
+
+bool performNeuralSimulation(PlayerSimulation &p, float deltaTime, mario::GameplaySimulation &simulator, mario::NeuralNetork
+	&network);
+
+void renderNeuralNetwork(gl2d::Renderer2D &renderer, char vision[mario::visionSizeX * mario::visionSizeY], 
+	float blockSizePreview, mario::NeuralNetork &network);
+
+void getVision(char vision[visionSizeX * visionSizeY], mario::GameplaySimulation &simulator, PlayerSimulation &p);
+
+
 };

+ 169 - 0
Pika/gameplay/containers/mario/marioNeuralTrainer.h

@@ -0,0 +1,169 @@
+#pragma once
+
+#include <gl2d/gl2d.h>
+#include <imgui.h>
+#include <baseContainer.h>
+#include <shortcutApi/shortcutApi.h>
+#include <pikaSizes.h>
+#include "marioCommon.h"
+#include <fileChanged.h>
+
+
+
+
+struct MarioNeuralTrainer: public Container
+{
+
+	mario::GameplayRenderer renderer;
+	mario::GameplaySimulation simulator;
+	pika::pikaImgui::FileSelector currentMap;
+
+	//todo user can request imgui ids; shortcut manager context; allocators
+	static ContainerStaticInfo containerInfo()
+	{
+		ContainerStaticInfo info = {};
+		info.defaultHeapMemorySize = pika::MB(100);
+
+		info.extensionsSuported = {".mario"};
+
+		info.requestImguiFbo = true;
+		info.pushAnImguiIdForMe = true;
+
+		return info;
+	}
+	
+	struct SimulationNetwork
+	{
+		mario::PlayerSimulation player;
+		mario::NeuralNetork network;
+	};
+
+	std::vector<SimulationNetwork> simulations;
+
+	bool create(RequestedContainerInfo &requestedInfo, pika::StaticString<256> commandLineArgument)
+	{
+		currentMap.setInfo("Training map", PIKA_RESOURCES_PATH "/mario", {".mario"});
+
+		if (commandLineArgument.size() != 0)
+		{
+			pika::strlcpy(currentMap.file, commandLineArgument.data(), sizeof(currentMap.file));
+		}
+		else
+		{
+			pika::strlcpy(currentMap.file, PIKA_RESOURCES_PATH "/mario/map1.mario", sizeof(currentMap.file));
+		}
+
+		bool rez = simulator.create(requestedInfo, currentMap.file);
+
+		rez &= renderer.init(requestedInfo);
+
+		std::mt19937 rng(std::random_device{}());
+
+		simulations.reserve(200);
+		for (int i = 0; i < 200; i++)
+		{
+			SimulationNetwork s;
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.network.addRandomNeuron(rng);
+			s.player.p.position.position = {1,1};
+			s.player.p.lastPos = {1,1};
+			simulations.push_back(s);
+		}
+
+		return rez;
+	}
+
+	float getFract(float v)
+	{
+		return v - (int)v;
+	}
+
+
+	bool update(pika::Input input, pika::WindowState windowState,
+		RequestedContainerInfo &requestedInfo)
+	{
+
+		//simulator.moveDelta = 0;
+		//simulator.jump = false;
+
+		int maxIndex = 0;
+		float maxFit = 0;
+		for (int i = 0; i < simulations.size(); i++)
+		{
+			if (simulations[i].player.p.position.position.x > maxFit)
+			{
+				maxFit = simulations[i].player.p.position.position.x;
+				maxIndex = i;
+			}
+		}
+
+		renderer.update(input, windowState, simulator);
+		renderer.followPlayer(simulations[maxIndex].player.p, input, windowState);
+
+		for (int i = 0; i < simulations.size(); i++)
+		renderer.drawPlayer(simulations[i].player.p);
+
+		{
+			char vision[mario::visionSizeX * mario::visionSizeY] = {};
+			getVision(vision, simulator, simulations[maxIndex].player);
+			mario::renderNeuralNetwork(renderer.renderer, vision, 20, simulations[maxIndex].network);
+		}
+
+		for (int i = 0; i < simulations.size(); i++)
+		{
+
+			if (!mario::performNeuralSimulation(simulations[i].player, 
+				input.deltaTime, simulator, simulations[i].network))
+			{
+				simulations.erase(simulations.begin() + i);
+				i--;
+				continue;
+			}
+
+
+		}
+
+		if (simulations.empty()) { return 0; }
+
+		
+		//simulator.simulator.player.position.position.x;
+
+
+
+		glBindFramebuffer(GL_FRAMEBUFFER, requestedInfo.requestedFBO.fbo);
+		renderer.render();
+
+		ImGui::Begin("Neural trainer");
+		{
+			ImGui::Text("Trainer");
+			ImGui::Separator();
+			currentMap.run(1);
+			ImGui::Separator();
+
+
+
+		}
+		ImGui::End();
+
+		return true;
+	}
+
+	void destruct() override
+	{
+		renderer.cleanup();
+		simulator.cleanup();
+	}
+
+
+
+};

+ 22 - 78
Pika/gameplay/containers/mario/marioNeuralVizualizer.h

@@ -14,8 +14,8 @@ struct MarioNeuralVizualizer: public Container
 {
 
 	mario::GameplayRenderer renderer;
-	mario::NeuralSimulator simulator;
-	//gl2d::FrameBuffer visionFBO;
+	mario::GameplaySimulation simulator;
+	mario::PlayerSimulation player;
 
 	//todo user can request imgui ids; shortcut manager context; allocators
 	static ContainerStaticInfo containerInfo()
@@ -33,7 +33,6 @@ struct MarioNeuralVizualizer: public Container
 
 	std::string mapFile = PIKA_RESOURCES_PATH "/mario/map1.mario";
 
-	const int blockSizePreview = 50;
 
 	bool create(RequestedContainerInfo &requestedInfo, pika::StaticString<256> commandLineArgument)
 	{
@@ -46,7 +45,14 @@ struct MarioNeuralVizualizer: public Container
 
 		rez &= renderer.init(requestedInfo);
 
-		//visionFBO.create(blockSizePreview * mario::NeuralSimulator::visionSizeX, blockSizePreview * mario::NeuralSimulator::visionSizeY);
+		std::mt19937 rng(std::random_device{}());
+
+		network.addRandomNeuron(rng);
+		network.addRandomNeuron(rng);
+		network.addRandomNeuron(rng);
+
+		player.p.position.position = {1,1};
+		player.p.lastPos = {1,1};
 
 		return rez;
 	}
@@ -56,6 +62,8 @@ struct MarioNeuralVizualizer: public Container
 		return v - (int)v;
 	}
 
+	mario::NeuralNetork network;
+
 	bool update(pika::Input input, pika::WindowState windowState,
 		RequestedContainerInfo &requestedInfo)
 	{
@@ -63,89 +71,26 @@ struct MarioNeuralVizualizer: public Container
 		//simulator.moveDelta = 0;
 		//simulator.jump = false;
 
-		if (!simulator.updateFrame(input.deltaTime))
-		{
-			return false;
-		}
-
-		renderer.update(input, windowState, simulator.simulator);
-
+		renderer.update(input, windowState, simulator);
+		renderer.followPlayer(player.p, input, windowState);
+		renderer.drawPlayer(player.p);
 
+		if (!mario::performNeuralSimulation(player, input.deltaTime, simulator, network))
 		{
-			int delta = 0;
-
-			if (input.hasFocus)
-			{
-				if (input.buttons[pika::Button::A].held())
-				{
-					delta -= 1;
-				}
-				if (input.buttons[pika::Button::D].held())
-				{
-					delta += 1;
-				}
-
-			}
-
-			simulator.simulator.moveDelta = delta;
-
-			if (input.buttons[pika::Button::Space].pressed())
-			{
-				simulator.simulator.jump = true;
-			}
-			else
-			{
-				simulator.simulator.jump = false;
-			}
-
+			return 0;
 		}
 
-		//visionFBO.clear();
-		renderer.renderer.pushCamera();
-		renderer.renderer.renderRectangle(
-			glm::vec4(0, 0, mario::NeuralSimulator::visionSizeX * (float)blockSizePreview, mario::NeuralSimulator::visionSizeY * (float)blockSizePreview)
-			, {0.5,0.5,0.5,0.5});
-		for (int y = 0; y < mario::NeuralSimulator::visionSizeY; y++)
-		{
-			for (int x = 0; x < mario::NeuralSimulator::visionSizeX; x++)
-			{
-				auto b = simulator.vision[x + y * mario::NeuralSimulator::visionSizeX];
-				if (b == 1)
-				{
-					renderer.renderer.renderRectangle(glm::vec4(x, y, 0.95, 0.95) * (float)blockSizePreview, {0,1,0,0.5});
-				}
-				//else
-				//{
-				//	renderer.renderer.renderRectangle(glm::vec4(x, y, 0.95, 0.95) * (float)blockSizePreview, {0.5,0.5,0.5,0.5});
-				//}
-			}
-		}
-		renderer.renderer.renderRectangle(
-			glm::vec4(
-			1 , 
-			simulator.visionSizeY - 4,
-			PLAYER_SIZE) *
-			(float)blockSizePreview, {0,0,1,0.5});
-
-		renderer.renderer.popCamera();
-		//renderer.renderer.flushFBO(visionFBO);
+		char vision[mario::visionSizeX * mario::visionSizeY] = {};
+		mario::getVision(vision, simulator, player);
+		mario::renderNeuralNetwork(renderer.renderer, vision, 20, network);
 		
-
-		//renderer.renderer.renderRectangle({10,10, blockSizePreview * mario::NeuralSimulator::visionSizeX,blockSizePreview * mario::NeuralSimulator::visionSizeY},
-		//	{}, 0, visionFBO.texture);
-
+		//simulator.simulator.player.position.position.x;
+	
 
 
 		glBindFramebuffer(GL_FRAMEBUFFER, requestedInfo.requestedFBO.fbo);
 		renderer.render();
 
-		//ImGui::Begin("Neural vision");
-		//{
-		//
-		//
-		//
-		//}
-
 
 		return true;
 	}
@@ -154,7 +99,6 @@ struct MarioNeuralVizualizer: public Container
 	{
 		renderer.cleanup();
 		simulator.cleanup();
-		//visionFBO.cleanup();
 	}
 };
 

+ 2 - 11
Pika/resources/logs.txt

@@ -1,11 +1,2 @@
-#2023-04-25 12:54:47: Created container: MarioNeuralVizualizer
-#2023-04-25 12:55:04: Reloaded dll
-#2023-04-25 13:01:24: Reloaded dll
-#2023-04-25 13:02:53: Reloaded dll
-#2023-04-25 13:03:46: Reloaded dll
-#2023-04-25 13:04:30: Reloaded dll
-#2023-04-25 13:04:53: Reloaded dll
-#2023-04-25 13:05:27: Reloaded dll
-#2023-04-25 13:09:04: Reloaded dll
-#2023-04-25 13:09:48: Reloaded dll
-#2023-04-25 13:10:16: Destroyed continer: MarioNeuralVizualizer #1
+#2023-04-26 00:23:42: Created container: MarioNeuralTrainer
+#2023-04-26 00:24:26: Destroyed continer: MarioNeuralTrainer #1

+ 1 - 1
Pika/thirdparty/gl2d/src/gl2d.cpp

@@ -1071,7 +1071,7 @@ namespace gl2d
 
 	void Renderer2D::clear()
 	{
-		white1pxSquareTexture.cleanup();
+		//white1pxSquareTexture.cleanup(); //todo move
 		glDeleteVertexArrays(1, &vao);
 		glDeleteBuffers(Renderer2DBufferType::bufferSize, buffers);