Skip to content

Commit

Permalink
Added OpenGL CGE - Thanks KrossX
Browse files Browse the repository at this point in the history
Also Made CGEGL into CGEGLOOP too!
  • Loading branch information
OneLoneCoder committed Jul 1, 2018
1 parent a71b31b commit 0c330c3
Show file tree
Hide file tree
Showing 14 changed files with 4,534 additions and 8 deletions.
54 changes: 54 additions & 0 deletions Core/BattleRoyaleRules.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
-- This is a battle plan file. Here you specify the rules and constraints
-- of the battle. During battle you will not have control of these parameters
-- as they will be set by tournament host

-- DO NOT CHANGE FROM HERE =======================================

-- Enable to stop on robot malfunction and show error message
DebugMode = true

-- Maximum number of robots allowed to enter
MaxRobots = 8

-- Starting Health of robot
MaxRobotHealth = 10

-- Starting energy of robot (in seconds)
MaxRobotEnergy = 30.0

-- Speed of step movement
RobotMoveSpeed = 30.0

-- Duration of step movement
RobotMoveTime = 0.4

-- Speed of turn movement (rad/s)
RobotTurnSpeed = math.pi / 2.0

-- Duration of turn movement
RobotTurnTime = 0.5

-- Maximum Game Time
MaxGameTime = 600.0

-- Gun Cooldown Time
GunCooldown = 0.2

-- Bullet Damage
BulletDamage = 1

-- Bullet Speed
BulletSpeed = 100.0

-- Self Destruct Bullet count
SelfDestructBullets = 10

-- DO NOT CHANGE ABOVE HERE =======================================


-- Robots can be loaded into teams
Teams = {}
Teams["OLC"] = {"javidbot.lua", "javidbot.lua", "javidbot.lua", "brankbot.lua"}
Teams["BadDudes"] = {"nullbot.lua", "nullbot.lua", "nullbot.lua", "nullbot.lua"}


11 changes: 8 additions & 3 deletions Core/BattleRoyale_Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ void OneLoneCoder_BattleRoyale::Update(float fElapsedTime)
// Update Bullets
for (auto &bullet : vecBullets)
{
bullet.x += bullet.vx * 100.0f * fElapsedTime;
bullet.y += bullet.vy * 100.0f * fElapsedTime;
bullet.x += bullet.vx * BattleRoyale_Parameters::fBulletSpeed * fElapsedTime;
bullet.y += bullet.vy * BattleRoyale_Parameters::fBulletSpeed * fElapsedTime;

// Has bullet left arena?
if (bullet.x<0.0f || bullet.x > 200.0f || bullet.y <0.0f || bullet.y > 200.0f)
Expand All @@ -102,7 +102,7 @@ void OneLoneCoder_BattleRoyale::Update(float fElapsedTime)
robot->muxUpdatingSensors.lock();
if (robot->status.health > 0)
{
robot->status.health--;
robot->status.health -= BattleRoyale_Parameters::nBulletDamage;
if (robot->status.health <= 0)
{
robot->status.health = 0;
Expand Down Expand Up @@ -131,6 +131,8 @@ void OneLoneCoder_BattleRoyale::Update(float fElapsedTime)
if (nAliveRobots == 1)
bBattleOver = true;

// Count unique teams that still have members that are alive

// Update Robots
for (auto &robot : vecRobots)
{
Expand Down Expand Up @@ -282,6 +284,9 @@ float OneLoneCoder_BattleRoyale::GetBattleDuration()

std::string OneLoneCoder_BattleRoyale::AddRobot(std::string sBotFile, int nTeamID)
{
if (vecRobots.size() == BattleRoyale_Parameters::nMaxRobots)
return "TOO MANY ROBOTS";

// Create new robot
cRobot* robot = new cRobot();
robot->status.id = vecRobots.size();
Expand Down
Binary file modified Releases/olcBattleRoyale_CGE_Big.exe
Binary file not shown.
Binary file added Releases/olcBattleRoyale_CGE_GL_Big.exe
Binary file not shown.
Binary file added Releases/olcBattleRoyale_CGE_RasterFont.exe
Binary file not shown.
Binary file modified Releases/olcBattleRoyale_CGE_Small.exe
Binary file not shown.
14 changes: 12 additions & 2 deletions VS2018_BUILD_CGE/BattleRoyale_Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,27 @@ SoundCloud: https://www.soundcloud.com/onelonecoder
// This class is just a wrapper that interfaces with the OLC Battle Royale Engine!
// You can create your own interfaces in whatever API you like!

#include <fstream>
#include "../Core/BattleRoyale_Engine.h"

#ifdef CGE_OLC
#include "olcConsoleGameEngineOOP.h"
#endif

#include "../Core/BattleRoyale_Engine.h"
#ifdef CGE_GL
#include "olcConsoleGameEngineGLOOP.h"
#endif


#include <fstream>

#ifdef CGE_OLC
class OneLoneCoder_BattleRoyaleConsole : public olcConsoleGameEngineOOP
#endif

#ifdef CGE_GL
class OneLoneCoder_BattleRoyaleConsole : public olcConsoleGameEngineGLOOP
#endif

{
public:
OneLoneCoder_BattleRoyaleConsole();
Expand Down
12 changes: 12 additions & 0 deletions VS2018_BUILD_CGE/olcBattleRoyale.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Global
Debug|x86 = Debug|x86
Release_CGE_Big|x64 = Release_CGE_Big|x64
Release_CGE_Big|x86 = Release_CGE_Big|x86
Release_CGE_GL_Big|x64 = Release_CGE_GL_Big|x64
Release_CGE_GL_Big|x86 = Release_CGE_GL_Big|x86
Release_CGE_Raster|x64 = Release_CGE_Raster|x64
Release_CGE_Raster|x86 = Release_CGE_Raster|x86
Release_CGE_Small|x64 = Release_CGE_Small|x64
Release_CGE_Small|x86 = Release_CGE_Small|x86
Release|x64 = Release|x64
Expand All @@ -25,6 +29,14 @@ Global
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Big|x64.Build.0 = Release_CGE_Big|x64
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Big|x86.ActiveCfg = Release_CGE_Big|Win32
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Big|x86.Build.0 = Release_CGE_Big|Win32
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_GL_Big|x64.ActiveCfg = Release_CGE_GL_Big|x64
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_GL_Big|x64.Build.0 = Release_CGE_GL_Big|x64
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_GL_Big|x86.ActiveCfg = Release_CGE_GL_Big|Win32
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_GL_Big|x86.Build.0 = Release_CGE_GL_Big|Win32
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Raster|x64.ActiveCfg = Release_CGE_Raster|x64
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Raster|x64.Build.0 = Release_CGE_Raster|x64
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Raster|x86.ActiveCfg = Release_CGE_Raster|Win32
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Raster|x86.Build.0 = Release_CGE_Raster|Win32
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Small|x64.ActiveCfg = Release_CGE_Small|x64
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Small|x64.Build.0 = Release_CGE_Small|x64
{57B3E944-D224-4D2A-92F9-674070570C12}.Release_CGE_Small|x86.ActiveCfg = Release_CGE_Small|Win32
Expand Down
Loading

0 comments on commit 0c330c3

Please sign in to comment.