Compare commits

...

101 Commits

Author SHA1 Message Date
Jace f31440b022 WIP 2016-03-01 22:51:28 +01:00
Jace 007dc2aace Updated Player.xml for multiple weapons 2016-03-01 22:51:28 +01:00
Jace b2eee10602 HACK: Added Activate button for spawners in editor. Right now it includes the event from Game, but SpawnerSystem should probably be moved to Engine. 2016-03-01 22:51:28 +01:00
Jace e4c6a19c38 New weapon behaviours 2016-03-01 22:51:28 +01:00
Jace 6eb0b83d6b Fixed editor camera speed changing when scrolling on UI elements 2016-03-01 22:47:43 +01:00
Jace c60e1ba7e4 Merge pull request #144 from teamfisk/RenderSetingsV2
Render settings
2016-03-01 13:49:38 +01:00
Tobias Dahl 63d205f56a Merge pull request #146 from teamfisk/EditorKeyboardFix
Fixed editor keyboard shortcuts getting mixed up with GUI input actions
2016-03-01 13:46:01 +01:00
Jace 36f6ade87a Fixed editor keyboard shortcuts getting mixed up with GUI input actions 2016-03-01 13:38:51 +01:00
Teejoon 724d7b1586 Merge remote-tracking branch 'origin/master' into RenderSetingsV2
Conflicts:
	src/Engine/Rendering/DrawFinalPass.cpp
2016-03-01 12:56:00 +01:00
Teejoon 8cda614de4 Added transparent object that disappeared from the merge 2016-03-01 12:54:01 +01:00
Teejoon 77eaa45702 Merge remote-tracking branch 'origin/master' into HEAD
Conflicts:
	src/Engine/Rendering/CubeMapPass.cpp
	src/Engine/Rendering/DrawFinalPass.cpp
2016-03-01 12:11:27 +01:00
Tobias Dahl dfa224b4dd Merge pull request #142 from teamfisk/Respawning
Added CapturePointGameMode component with RespawnTime
2016-03-01 11:28:56 +01:00
Jace 86df8f14f4 Merge pull request #143 from teamfisk/Transparency-fix
Transparency fix
2016-03-01 11:26:26 +01:00
Tleety eaea645068 Reflectance should now work as an inverse of the specular alpha value. 2016-03-01 11:19:44 +01:00
Tleety 21bf7f4df3 Glow should now legit be working through transparency. 2016-03-01 11:03:16 +01:00
William Moberg e2b7e5400d Check so CapturePointGameMode pool exists and has a size. 2016-03-01 10:20:52 +01:00
William Moberg 658eace093 Added component CapturePointGameMode that contains respawntime. 2016-02-29 18:20:14 +01:00
Joachim Pettersson c106768939 Merge pull request #135 from teamfisk/JumpHeightAdjustment
Player jump speed can be adjusted
2016-02-29 17:37:25 +01:00
William Moberg c7dad79e72 Merge branch 'master' into JumpHeightAdjustment
# Conflicts:
#	resources/Schema/Components.xsd
#	resources/Schema/Entities/Player.xml
#	resources/Schema/Entities/PlayerRed.xml
#	src/Game/Systems/PlayerMovementSystem.cpp
2016-02-29 17:28:40 +01:00
Joachim Pettersson d37f8cc350 Merge pull request #141 from teamfisk/BoxModelCollision
Collision jittering + disappearing weapon
2016-02-29 17:13:34 +01:00
William Moberg 3c35c0a956 Frustum culling octree updates after collisions, no more disappearing weapons. 2016-02-29 15:50:26 +01:00
William Moberg d47a806c64 Made a easy hack to solve jittering when standing still. Jittering should still be present when moving, but at least it is less prominent when moving. 2016-02-29 15:49:23 +01:00
William Moberg 8e21c5a5e4 Reverts last WIP since it probably added code without improving anything.
Revert "WIP, should take shortest resolution even if forced upwards because of slopes, not solving the jittering problem though. + debug code."

This reverts commit db5170c699.
2016-02-29 15:38:36 +01:00
Teejoon df7ace6626 We only uses one depth buffer now 2016-02-29 11:44:29 +01:00
William Moberg db5170c699 WIP, should take shortest resolution even if forced upwards because of slopes, not solving the jittering problem though. + debug code. 2016-02-29 09:37:51 +01:00
Jace bb76c9d248 WIP multi-weapon behaviours 2016-02-29 06:58:57 +01:00
Teejoon 9cbc6f7755 Added GenerateTexture, GenerateMipMapTexture and DeleteTexture to CommonFunctions 2016-02-28 16:16:22 +01:00
Teejoon d3a245606a SSAO and Glow is no longe conflicting with each other.
Texture should get the id = 0 when they are deleted and not assigned a new texture after. Else they will start to conflict with each other.
2016-02-28 15:02:40 +01:00
Teejoon b320d8d1e4 WIP 2016-02-26 18:01:38 +01:00
Teejoon 62e22d3821 Fix 2016-02-26 13:32:16 +01:00
Teejoon 0805375483 Deleted SSAO sliders except Quality 2016-02-26 13:25:19 +01:00
Jace 0c60b637c3 Who's merging without compiling? 2016-02-26 12:52:10 +01:00
William Moberg d411de894f Merge pull request #140 from teamfisk/FixNetworkBugs
Death explosion should always get triggered now.
2016-02-26 12:01:19 +01:00
Teejoon f56705d921 You can now change the quality of SSAO by sliding the SSAO Quality 2016-02-26 11:51:20 +01:00
Jocke 18450ff4f3 Death explosion should always get triggered now. (I hope) 2016-02-26 11:08:05 +01:00
William Moberg 22b473a0b6 Merge pull request #139 from teamfisk/EditorCopyPaste
Editor copy paste
2016-02-26 11:01:18 +01:00
Jace f161fce719 Merge pull request #138 from teamfisk/PlayerAtOriginFix
Teleporting to origin on spawn fixed.
2016-02-25 17:55:03 +01:00
Jace 0343683678 Fixed cubemaps being generated over and over again each frame. 2016-02-25 17:51:40 +01:00
Jace 9e6c67596d Basic editor copy and paste. Doesn't actually copy the entity until you paste it. 2016-02-25 17:51:28 +01:00
William Moberg 89d0d5753f Fix for player teleporting to (0,0,0). Saves player previous position in CollisionSystem instead of Physics component so it won't be saved when editing Players. 2016-02-25 16:16:24 +01:00
Adam Byléhn 748a178801 Merge pull request #136 from teamfisk/FixNetworkBugs
Fix network bugs
2016-02-25 16:09:08 +01:00
Jocke eac9a9daf6 Pull request #136 Merge remote-tracking branch 'origin/master' into FixNetworkBugs
# Conflicts:
#	src/Engine/Network/Client.cpp
2016-02-25 16:07:06 +01:00
Jocke 059fe5c6c0 Fixed typo m_EPDoubleJump to m_EDoubleJump. 2016-02-25 16:04:27 +01:00
Joachim Pettersson fb465ede81 Merge pull request #134 from teamfisk/HUDDesync
Good job! 👍
2016-02-25 15:53:07 +01:00
Jocke f66fa7a183 Merge remote-tracking branch 'origin/master' into FixNetworkBugs
# Conflicts:
#	include/Engine/Network/Client.h
#	include/Engine/Network/MessageType.h
#	include/Engine/Network/Server.h
#	include/Engine/Network/TCPServer.h
#	src/Engine/Network/Client.cpp
#	src/Engine/Network/TCPServer.cpp
2016-02-25 15:13:11 +01:00
Jocke 508d8a6f00 Fixed memory leak in TCPServer::AcceptNewConnections caused by acceptor->async_accept().
Fixed some formating and comments.
2016-02-25 14:24:38 +01:00
William Moberg cd315bbaa0 Added DoubleJump component and JumpSpeed in Player component so jumpheight can be adjusted for regular jump and double jump. 2016-02-25 12:12:44 +01:00
stiffly 8ce6308649 In snapshot: now sends player information and also CP information. Now it is no longer true that they will arrive in pre order. Appropriate actions were therefor implemented. 2016-02-25 11:56:40 +01:00
stiffly f10958c268 Capturepoint logic is now purely done on the serverside. 2016-02-25 11:50:29 +01:00
William Moberg da1c7b3093 Merge pull request #133 from teamfisk/AndersTest
Ammo,HealthPickup now takes in account for possible parenting/childin…
2016-02-25 09:58:14 +01:00
verysecrethero ef87102d1f Ammo,HealthPickup now takes in account for possible parenting/childing of the pickup. Also saved the xml files with the new scaling 2016-02-24 17:53:37 +01:00
Jace 9a41bda4cf Merge pull request #132 from teamfisk/CubeMap
Cube map
2016-02-24 16:03:49 +01:00
Tleety fc18932068 Merge remote-tracking branch 'origin/master' into CubeMap
# Conflicts:
#	src/Engine/Rendering/Renderer.cpp
2016-02-24 15:45:30 +01:00
Tobias Dahl b874ea8641 Merge pull request #131 from teamfisk/ResizeWindowFixFromSSAOMerge
Have fix the resizing errors
2016-02-24 15:22:12 +01:00
Tobias Dahl 2609a0253d Merge pull request #129 from teamfisk/HUDDesync
Networking improvements
2016-02-24 15:22:01 +01:00
William Moberg de309d3b9d Merge pull request #130 from teamfisk/AndersTest
CapturePointSystem fix, DamageIndicatorSystem fix
2016-02-24 15:17:36 +01:00
Tobias Dahl f7ef6707a7 Merge pull request #116 from teamfisk/SeeTeamMates
See team mates
2016-02-24 15:05:19 +01:00
Tleety feeff5b164 Debug tool for different CubeMap
changed cubemap influence.
2016-02-24 14:47:47 +01:00
stiffly 7394436e7a Removed unnecessary comment. 2016-02-24 14:23:54 +01:00
Tleety f41e0b29be assets 2016-02-24 14:21:48 +01:00
Tleety 607e83134d Cubemaps working 2016-02-24 14:16:49 +01:00
verysecrethero 5af4f9d8e7 Removed a comment originating from HUDDesynch branch 2016-02-24 14:06:41 +01:00
verysecrethero af68236e71 now using a define INDICATOR_TEST to activate the DamageIndicatorSystem test. 2016-02-24 13:58:05 +01:00
Tleety 6f9ce8a0c1 WIP 2016-02-24 13:57:54 +01:00
Teejoon 6465fe6ed6 Have fix the resizing errors 2016-02-24 13:22:41 +01:00
Jocke fa13c1d065 Double jump is now working. 2016-02-23 18:24:46 +01:00
verysecrethero e2831c5593 CapturePointSystem fix, DamageIndicatorSystem fix 2016-02-23 17:29:33 +01:00
Tleety 8d23c531af Cubemaps kinda functioning, still somthing wierd with the vectors. 2016-02-23 17:17:50 +01:00
Tleety 91b0ac5fbd Some groundwork for cubemaps. 2016-02-23 16:00:43 +01:00
stiffly d77119bb2d Fixed print for serverlist. 2016-02-23 11:47:44 +01:00
stiffly 27669b7383 Merge remote-tracking branch 'origin/master' into HUDDesync 2016-02-23 11:09:44 +01:00
stiffly fc7d62a5ad Various clean ups. 2016-02-23 11:07:56 +01:00
stiffly c42e1e0967 SoundSystem Fix. Now subscribes to an event that was thought to be listened to. 2016-02-23 11:07:41 +01:00
stiffly fe9dbf0b0f Serverlist fix. 2016-02-23 10:33:20 +01:00
Teejoon fe3e0bac5b Changed SpritIndicator values on player 2016-02-22 18:45:02 +01:00
Teejoon fa4f007604 Changed name from Indicator to SpriteIndicator. Can now be an indicator for a single team or every one 2016-02-22 18:35:00 +01:00
stiffly e5ff88d3c9 SoundSystem bug fix 2016-02-22 17:41:14 +01:00
stiffly 845a30ed0f Merge remote-tracking branch 'origin/DynamicPacketBuffer' into HUDDesync
# Conflicts:
#	include/Engine/Network/TCPServer.h
#	src/Engine/Network/TCPServer.cpp
2016-02-22 17:39:48 +01:00
Jocke 34a71b0767 Fixed linking issue. 2016-02-22 17:24:35 +01:00
stiffly 833006744a WIP 2016-02-22 17:00:25 +01:00
Jocke b2d8cddfb7 WE now send the map on connect after that only player information. 2016-02-22 16:46:31 +01:00
Teejoon 6fab971734 Merge branch 'master' of https://github.com/teamfisk/TacticalZ into SeeTeamMates
Conflicts:
	include/Engine/Rendering/SpriteJob.h
	resources/Schema/Components.xsd
	resources/Schema/Entities/Player.xml
	resources/Schema/Entities/PlayerRed.xml
2016-02-22 16:43:18 +01:00
Jocke ed9149fe63 Network buffer should now dynamically increase when needed. 2016-02-22 16:04:27 +01:00
stiffly 4c1a284636 Server now does Capture point logic too. 2016-02-22 11:30:31 +01:00
stiffly 23dc8e07b2 Will this do the trick? Now tells the server to send HUD entities too. 2016-02-22 10:41:37 +01:00
stiffly c7d31cac2d Merge remote-tracking branch 'origin/master' into FriendlyHost/Join
# Conflicts:
#	src/Engine/Network/Client.cpp
2016-02-22 10:19:48 +01:00
stiffly a1e932d261 Merge remote-tracking branch 'origin/master' into FriendlyHost/Join 2016-02-22 10:06:51 +01:00
stiffly 070f1bd394 Merge remote-tracking branch 'origin/FriendlyHost/Join' into FriendlyHost/Join
# Conflicts:
#	src/Engine/Network/Client.cpp
2016-02-22 10:06:25 +01:00
stiffly 993d804cef Added an event to search for servers.
Client now broadcasts a serverlistrequest.
An active server will then answer the request and send info about the server.
The client saves this data to a list and presents it to the user.
2016-02-22 10:05:47 +01:00
stiffly 2f259c3773 Added an event to search for servers.
Client now broadcasts a serverlistrequest.
An active server will then answer the request and send info about the server.
The client saves this data to a list and presents it to the user.
2016-02-19 15:38:09 +01:00
Teejoon c4d3c515e4 Marge with Master 2016-02-17 18:04:49 +01:00
Teejoon 7cc58dc94c Merge branch 'master' of https://github.com/teamfisk/TacticalZ into SeeTeamMates 2016-02-17 18:00:30 +01:00
Teejoon 5e3af7ac5d Player Indicator now working OK. Scaling depending on how far away you are makes the Indicator to hide players head behind it. Shields are making indicators to disappear. 2016-02-17 17:58:01 +01:00
stiffly 46987beefb Updated the serverlist, now prints adress and port of the server. 2016-02-17 17:05:10 +01:00
Teejoon 4fd0108443 Working billbording 2016-02-17 16:50:24 +01:00
stiffly 950ecba1c0 Merge remote-tracking branch 'origin/master' into FriendlyHost/Join 2016-02-17 15:52:58 +01:00
stiffly fdc8f753cb Implemented primitive server "heartbeat" logic, which sends server info from server to client without being connected. 2016-02-17 15:51:26 +01:00
Jocke 4432891437 Fixed crash in Client::parsePlayerDamage. 2016-02-17 10:21:50 +01:00
Jocke a006db9e63 WIP Fix dsync 2016-02-16 16:06:17 +01:00
Teejoon 17da9a8036 WIP 2016-02-16 15:56:58 +01:00
Jocke 717af2c4a4 Fixed bug in Client::parsePlayerDamage() 2016-02-16 10:22:15 +00:00
134 changed files with 3560 additions and 1215 deletions
+1 -1
Submodule assets updated: 1e7adc749e...10a611659d
@@ -24,6 +24,7 @@ public:
private:
Octree<EntityAABB>* m_Octree;
std::vector<EntityAABB> m_OctreeResult;
std::unordered_map<EntityWrapper, glm::vec3> m_PrevPositions;
};
#endif
+6
View File
@@ -29,16 +29,22 @@ struct EntityWrapper
EntityWrapper Parent();
EntityWrapper FirstChildByName(const std::string& name);
EntityWrapper FirstParentWithComponent(const std::string& componentType);
EntityWrapper Clone(EntityWrapper parent = EntityWrapper::Invalid);
std::vector<EntityWrapper> ChildrenWithComponent(const std::string& componentType);
void DeleteChildren();
bool IsChildOf(EntityWrapper potentialParent);
bool Valid() const;
ComponentWrapper operator[](const char* componentName);
ComponentWrapper operator[](const std::string& componentName);
bool operator==(const EntityWrapper& e) const;
bool operator!=(const EntityWrapper& e) const;
explicit operator EntityID() const;
private:
EntityWrapper firstChildByNameRecursive(const std::string& name, EntityID parent);
EntityWrapper cloneRecursive(EntityWrapper entity, EntityWrapper parent);
void childrenWithComponentRecursive(const std::string& componentType, EntityWrapper& entity, std::vector<EntityWrapper>& childrenWithComponent);
};
namespace std
+1 -1
View File
@@ -68,7 +68,7 @@ protected:
const std::string m_ComponentType;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt) = 0;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) = 0;
};
class ImpureSystem : public virtual System
+1 -1
View File
@@ -40,7 +40,7 @@ public:
// Change the parent of an entity
void SetParent(EntityID entity, EntityID parent);
// Get children of an entity
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> GetChildren(EntityID entity);
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> GetDirectChildren(EntityID entity);
// Get all component pools
const std::unordered_map<std::string, ComponentPool*>& GetComponentPools() const { return m_ComponentPools; }
// Get the entity children map
@@ -104,6 +104,11 @@ protected:
if (!m_Enabled) {
return false;
}
ImGuiIO& io = ImGui::GetIO();
if (io.WantCaptureMouse || io.WantCaptureKeyboard) {
return false;
}
m_SpeedMultiplier += e.DeltaY * (0.1 * m_SpeedMultiplier);
m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier);
+9
View File
@@ -22,6 +22,7 @@
#include "../Core/ELockMouse.h"
#include "../Core/EFileDropped.h"
#include "../Rendering/Texture.h"
#include "Game/Events/ESpawnerSpawn.h"
class EditorGUI
{
@@ -73,6 +74,12 @@ public:
// Called when the user means to rename an entity.
typedef std::function<void(EntityWrapper, const std::string&)> OnEntityChangeName_t;
void SetEntityChangeNameCallback(OnEntityChangeName_t f) { m_OnEntityChangeName = f; }
// Called when the user pastes an entity previously "copied"
// @param EntityWrapper The entity to copy
// @param EntityWrapper The entity to parent the new copy to
// @return The new copy of the entity
typedef std::function<EntityWrapper(EntityWrapper, EntityWrapper)> OnEntityPaste_t;
void SetEntityPasteCallback(OnEntityPaste_t f) { m_OnEntityPaste = f; }
// Called when the user means to attach a new component to an entity.
typedef std::function<void(EntityWrapper, const std::string&)> OnComponentAttach_t;
void SetComponentAttachCallback(OnComponentAttach_t f) { m_OnComponentAttach = f; }
@@ -111,6 +118,7 @@ private:
std::string m_DroppedFile = "";
bool m_Paused = false;
bool m_MouseLocked = false;
EntityWrapper m_CopyTarget = EntityWrapper::Invalid;
// Callbacks
OnEntitySelectedCallback_t m_OnEntitySelected = nullptr;
@@ -124,6 +132,7 @@ private:
OnComponentDelete_t m_OnComponentDelete = nullptr;
OnWidgetMode_t m_OnWidgetMode = nullptr;
OnWidgetSpace_t m_OnWidgetSpace = nullptr;
OnEntityPaste_t m_OnEntityPaste = nullptr;
// Events
EventRelay<EditorGUI, Events::KeyDown> m_EKeyDown;
+1
View File
@@ -56,6 +56,7 @@ private:
void OnEntityDelete(EntityWrapper entity);
void OnEntityChangeParent(EntityWrapper entity, EntityWrapper parent);
void OnEntityChangeName(EntityWrapper entity, const std::string& name);
EntityWrapper OnEntityPaste(EntityWrapper entityToCopy, EntityWrapper parent);
void OnComponentAttach(EntityWrapper entity, const std::string& componentType);
void OnComponentDelete(EntityWrapper entity, const std::string& componentType);
void OnWidgetSpace(EditorGUI::WidgetSpace widgetSpace);
+31 -5
View File
@@ -19,11 +19,26 @@
#include "Core/World.h"
#include "Core/EventBroker.h"
#include "Core/ConfigFile.h"
#include "Core/EPlayerDeath.h"
#include "Input/EInputCommand.h"
#include "Core/EPlayerDamage.h"
#include "../Game/Events/EDoubleJump.h"
#include "Network/EInterpolate.h"
#include "Network/SnapshotFilter.h"
#include "Core/EPlayerSpawned.h"
#include "Network/ESearchForServers.h"
struct ServerInfo
{
ServerInfo(std::string a, int b, std::string c, int d)
{
Address = a; Port = b; Name = c; PlayersConnected = d;
}
std::string Address = "";
int Port = 0;
std::string Name = "";
int PlayersConnected = 0;
};
class Client : public Network
{
@@ -34,7 +49,9 @@ public:
void Connect(std::string address, int port);
void Update() override;
private:
UDPClient m_Unreliable;
TCPClient m_Reliable;
std::vector<Events::PlayerSpawned> m_PlayerSpawnEvents;
void parseSpawnEvents();
// Save for children
@@ -82,10 +99,13 @@ public:
void parseTCPConnect(Packet& packet);
void parsePlayerConnected(Packet& packet);
void parsePing();
void parseServerlist(Packet& packet);
void parseKick();
void parsePlayersSpawned(Packet& packet);
void parseEntityDeletion(Packet& packet);
void parsePlayerDamage(Packet& packet);
void parseComponentDeletion(Packet& packet);
void parseDoubleJump(Packet& packet);
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseSnapshot(Packet& packet);
void identifyPacketLoss();
@@ -94,6 +114,7 @@ public:
void sendInputCommands();
void sendLocalPlayerTransform();
void becomePlayer();
void displayServerlist();
// Mapping Logic
// Returns if local EntityID exist in map
bool clientServerMapsHasEntity(EntityID clientEntityID);
@@ -109,10 +130,15 @@ public:
bool OnPlayerDamage(const Events::PlayerDamage& e);
EventRelay<Client, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
void parsePlayerDamage(Packet& packet);
private:
UDPClient m_Unreliable;
TCPClient m_Reliable;
EventRelay< Client, Events::SearchForServers> m_ESearchForServers;
EventRelay<Client, Events::DoubleJump> m_EDoubleJump;
bool OnDoubleJump(Events::DoubleJump & e);
bool OnSearchForServers(const Events::SearchForServers& e);
UDPClient m_ServerlistRequest;
std::vector<ServerInfo> m_Serverlist;
bool m_SearchingForServers = false;
std::clock_t m_StartSearchTime;
double m_SearchingTime = 2000; // Config I guess
};
#endif
@@ -0,0 +1,12 @@
#ifndef Events_SearchForServers_h__
#define Events_SearchForServers_h__
#include "Core/Event.h"
namespace Events
{
struct SearchForServers : public Event { };
}
#endif
-13
View File
@@ -1,13 +0,0 @@
#ifndef HybridClient_h__
#define HybridClient_h__
class HybridClient
{
public:
HybridClient();
~HybridClient();
private:
};
#endif
-12
View File
@@ -1,12 +0,0 @@
#ifndef HybridServer_h__
#define HybridServer_h__
class HybridServer
{
public:
HybridServer();
~HybridServer();
private:
};
#endif
+2
View File
@@ -19,6 +19,8 @@ enum class MessageType
EntityDeleted,
ComponentDeleted,
PlayerTransform,
OnDoubleJump,
ServerlistRequest,
Invalid
};
+4 -1
View File
@@ -9,13 +9,16 @@ typedef unsigned int PacketID;
class NetworkClient
{
public:
NetworkClient();
virtual ~NetworkClient();
virtual void Connect(std::string playerName, std::string address, int port) = 0;
virtual void Disconnect() = 0;
virtual void Receive(Packet& packet) = 0;
virtual void Send(Packet & packet) = 0;
virtual bool IsSocketAvailable() = 0;
protected:
char m_ReadBuffer[BUFFERSIZE] = { 0 };
char* m_ReadBuffer;
unsigned int m_BufferSize = BUFFERSIZE;
};
#endif
+4 -1
View File
@@ -10,12 +10,15 @@ typedef unsigned int PacketID;
class NetworkServer
{
public:
NetworkServer();
virtual ~NetworkServer();
virtual void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers) = 0;
virtual void Receive(Packet & packet, PlayerDefinition & playerDefinition) = 0;
virtual void Send(Packet & packet, PlayerDefinition & playerDefinition) = 0;
virtual void Send(Packet & packet) = 0;
protected:
char m_ReadBuffer[BUFFERSIZE] = { 0 };
char* m_ReadBuffer;
unsigned int m_BufferSize = BUFFERSIZE;
};
#endif
+9 -4
View File
@@ -17,6 +17,7 @@
#include "Core/EPlayerDamage.h"
#include "Network/EPlayerDisconnected.h"
#include "Core/EPlayerSpawned.h"
#include "../Game/Events/EDoubleJump.h"
#include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h"
@@ -32,6 +33,7 @@ private:
// Network channels
TCPServer m_Reliable;
UDPServer m_Unreliable;
UDPServer m_ServerlistRequest;
// dont forget to set these in the childrens receive logic
boost::asio::ip::address m_Address;
int m_Port = 27666;
@@ -54,7 +56,7 @@ private:
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
//Timers
std::clock_t m_StartPingTime;
// Packet loss logic
PacketID m_PacketID = 0;
PacketID m_PreviousPacketID = 0;
@@ -64,6 +66,7 @@ private:
void reliableBroadcast(Packet& packet);
void unreliableBroadcast(Packet& packet);
void sendSnapshot();
void addPlayersToPacket(Packet& packet, EntityID entityID);
void addChildrenToPacket(Packet& packet, EntityID entityID);
void addInputCommandsToPacket(Packet& packet);
void sendPing();
@@ -77,10 +80,12 @@ private:
void parsePlayerTransform(Packet& packet);
void parseOnInputCommand(Packet& packet);
void parseClientPing();
void parsePing();
void parseUDPConnect(Packet & packet);
void parseTCPConnect(Packet & packet);
void parsePing();
bool parseDoubleJump(Packet& packet);
void parseUDPConnect(Packet& packet);
void parseTCPConnect(Packet& packet);
void parseDisconnect();
void parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint);
bool shouldSendToClient(EntityWrapper childEntity);
// Debug event
+1 -1
View File
@@ -20,7 +20,7 @@ private:
boost::asio::ip::tcp::endpoint m_Endpoint;
boost::asio::io_service m_IOService;
std::unique_ptr<boost::asio::ip::tcp::socket> m_Socket;
size_t readBuffer(char* data);
size_t readBuffer();
PacketID m_SendPacketID = 0;
bool m_IsConnected = false;
};
+10 -4
View File
@@ -16,16 +16,22 @@ public:
void Send(Packet & packet, PlayerDefinition & playerDefinition);
void Send(Packet & packet);
void Disconnect();
int Port() { return m_Port; }
std::string Address() { return m_Address; }
private:
// TCP logic
boost::asio::io_service m_IOService;
std::unique_ptr<boost::asio::ip::tcp::acceptor> acceptor;
boost::shared_ptr<boost::asio::ip::tcp::socket> lastReceivedSocket;
void handle_accept(boost::shared_ptr<boost::asio::ip::tcp::socket> socket,
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
const boost::system::error_code& error);
int readBuffer(char* data, PlayerDefinition& playerDefinition);
int readBuffer(PlayerDefinition& playerDefinition);
PlayerID getPlayerIDFromEndpoint(const std::map<PlayerID, PlayerDefinition>& connectedPlayers,
boost::asio::ip::address address, unsigned short port);
int GetPort();
std::string GetAddress();
int m_Port = 0;
std::string m_Address = "";
};
#endif
+2 -1
View File
@@ -14,13 +14,14 @@ public:
void Disconnect();
void Receive(Packet& packet);
void Send(Packet & packet);
void Broadcast(Packet& packet, int port);
bool IsSocketAvailable();
private:
// Assio UDP logic
boost::asio::io_service m_IOService;
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
boost::shared_ptr<boost::asio::ip::udp::socket> m_Socket;
int readBuffer(char* data);
int readBuffer();
PacketID m_SendPacketID = 0;
};
+5 -2
View File
@@ -8,18 +8,21 @@ class UDPServer : public NetworkServer
{
public:
UDPServer();
UDPServer(int port);
~UDPServer();
void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers);
void Receive(Packet & packet, PlayerDefinition & playerDefinition);
void Send(Packet & packet, PlayerDefinition & playerDefinition);
void Send(Packet & packet);
void Send(Packet & packet);
void Send(Packet & packet, boost::asio::ip::udp::endpoint endpoint);
void Broadcast(Packet & packet, int port);
bool IsSocketAvailable();
private:
// UDP logic
boost::asio::io_service m_IOService;
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
std::unique_ptr<boost::asio::ip::udp::socket> m_Socket;
int readBuffer(char* data);
int readBuffer();
};
#endif
+27
View File
@@ -0,0 +1,27 @@
#ifndef CubeMapPass_h__
#define CubeMapPass_h__
#include "IRenderer.h"
#include "ShaderProgram.h"
class CubeMapPass
{
public:
CubeMapPass(IRenderer* renderer);
~CubeMapPass() { }
void LoadTextures(std::string input);
void FillCubeMap(glm::vec3 originPosition);
void GenerateCubeMapTexture();
//GLuint CubeMapTexture() const { return m_CubeMapTexture; }
GLuint m_CubeMapTexture = -1;
private:
IRenderer* m_Renderer;
std::string m_PreviusCubeMapTexture;
std::vector<Texture*> m_CubeMapTextures;
};
#endif
+15 -8
View File
@@ -12,7 +12,7 @@
class DrawBloomPass
{
public:
DrawBloomPass(IRenderer* renderer /* ,Texture or finalpass*/ );
DrawBloomPass(IRenderer* renderer, ConfigFile* config);
~DrawBloomPass() { }
void InitializeTextures();
void InitializeFrameBuffers();
@@ -23,26 +23,33 @@ public:
void FillGaussianBuffer(FrameBuffer* fb);
void Draw(GLuint texture);
void ChangeQuality(int quality);
void OnWindowResize();
//Getters
//Return the blurred result of the texture that was sent into draw
GLuint GaussianTexture() const { return m_GaussianTexture_vert; }
GLuint GaussianTexture() const {
if (m_Quality == 0) {
return m_BlackTexture->m_Texture;
} else {
return m_GaussianTexture_vert;
}
}
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
Texture* m_WhiteTexture;
Texture* m_BlackTexture;
Model* m_ScreenQuad;
const IRenderer* m_Renderer;
ConfigFile* m_Config;
//const LightCullingPass* m_LightCullingPass
GLuint m_iterations = 9;
int m_Iterations;
int m_Quality = 0;
GLuint m_GaussianTexture_horiz;
GLuint m_GaussianTexture_vert;
GLuint m_GaussianTexture_horiz = 0;
GLuint m_GaussianTexture_vert = 0;
FrameBuffer m_GaussianFrameBuffer_horiz;
FrameBuffer m_GaussianFrameBuffer_vert;
+9 -7
View File
@@ -4,6 +4,8 @@
#include "IRenderer.h"
#include "DrawFinalPassState.h"
#include "LightCullingPass.h"
#include "CubeMapPass.h"
#include "SSAOPass.h"
#include "FrameBuffer.h"
#include "ShaderProgram.h"
#include "Util/UnorderedMapVec2.h"
@@ -13,12 +15,12 @@
class DrawFinalPass
{
public:
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass);
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass, GLuint* depthBuffer);
~DrawFinalPass() { }
void InitializeTextures();
void InitializeFrameBuffers();
void InitializeShaderPrograms();
void Draw(RenderScene& scene, GLuint SSAOTexture);
void Draw(RenderScene& scene);
void ClearBuffer();
void OnWindowResize();
@@ -33,11 +35,8 @@ public:
FrameBuffer* FinalPassFrameBufferLowRes() { return &m_FinalPassFrameBufferLowRes; }
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene, GLuint SSAOTexture);
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
@@ -60,14 +59,17 @@ private:
GLuint m_SceneTexture;
GLuint m_BloomTextureLowRes;
GLuint m_SceneTextureLowRes;
GLuint m_DepthBuffer;
GLuint* m_DepthBuffer;
GLuint m_DepthBufferLowRes;
GLuint m_CubeMapTexture;
//maqke this component based i guess?
GLuint m_ShieldPixelRate = 16;
const IRenderer* m_Renderer;
const LightCullingPass* m_LightCullingPass;
const CubeMapPass* m_CubeMapPass;
const SSAOPass* m_SSAOPass;
ShaderProgram* m_ForwardPlusProgram;
ShaderProgram* m_ExplosionEffectProgram;
+2
View File
@@ -5,11 +5,13 @@
#include "../OpenGL.h"
#include "../GLM.h"
#include "../Core/Util/Rectangle.h"
#include "../Core/ConfigFile.h"
#include "Util/ScreenCoords.h"
#include "Camera.h"
#include "RenderQueue.h"
#include "Model.h"
#include "../Core/World.h" //So temp
#include "Util/CommonFunctions.h"
struct PickData
+1 -1
View File
@@ -184,7 +184,7 @@ struct ModelJob : RenderJob
void CalculateHash() override
{
Hash = TextureID + ModelID << 10 + ShaderID << 20;
Hash = ShaderID << 20 + ModelID << 10 + TextureID;
}
};
+1 -3
View File
@@ -28,15 +28,13 @@ public:
const ShaderProgram& PickingProgram() const { return *m_PickingProgram; }
//const std::unordered_map<glm::ivec2, EntityID>& PickingColorsToEntity() const { return m_PickingColorsToEntity; }
GLuint PickingTexture() const { return m_PickingTexture; }
GLuint DepthBuffer() const { return m_DepthBuffer; }
GLuint* DepthBuffer() { return &m_DepthBuffer; }
const FrameBuffer& PickingBuffer() const { return m_PickingBuffer; }
PickData Pick(glm::vec2 screenCoord);
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
EventBroker* m_EventBroker;
const IRenderer* m_Renderer;
+2
View File
@@ -24,6 +24,8 @@ public:
bool StencilFunc(GLenum func, GLint ref, GLuint mask);
bool StencilMask(GLuint mask);
bool DepthMask(GLboolean flag);
bool DepthFunc(GLenum func);
bool AlphaFunc(GLenum func, GLclampf thresholder);
private:
std::vector<std::function<void(void)>> m_ResetFunctions;
+9 -8
View File
@@ -17,6 +17,7 @@
#include "DrawBloomPass.h"
#include "DrawColorCorrectionPass.h"
#include "SSAOPass.h"
#include "CubeMapPass.h"
#include "../Core/EventBroker.h"
#include "ImGuiRenderPass.h"
#include "Camera.h"
@@ -31,8 +32,9 @@ class Renderer : public IRenderer
static void glfwFrameBufferCallback(GLFWwindow* window, int width, int height);
public:
Renderer(EventBroker* eventBroker)
: m_EventBroker(eventBroker)
Renderer(EventBroker* eventBroker, ConfigFile* config)
: m_EventBroker(eventBroker)
, m_Config(config)
{ }
virtual void Initialize() override;
@@ -46,6 +48,7 @@ private:
//----------------------Variables----------------------//
static std::unordered_map <GLFWwindow*, Renderer*> m_WindowToRenderer;
ConfigFile* m_Config;
EventBroker* m_EventBroker;
TextPass* m_TextPass;
@@ -58,13 +61,10 @@ private:
Model* m_UnitSphere;
int m_DebugTextureToDraw = 0;
int m_CubeMapTexture = 0;
bool m_ResizeWindow = false;
float m_SSAO_Radius = 1.0f;
float m_SSAO_Bias = 0.05f;
float m_SSAO_Contrast = 1.5f;
float m_SSAO_IntensityScale = 1.0f;
int m_SSAO_NumOfSamples = 24;
int m_SSAO_NumOfTurns = 7;
int m_SSAO_Quality = 0;
int m_GLOW_Quality = 2;
PickingPass* m_PickingPass;
LightCullingPass* m_LightCullingPass;
@@ -74,6 +74,7 @@ private:
DrawBloomPass* m_DrawBloomPass;
DrawColorCorrectionPass* m_DrawColorCorrectionPass;
SSAOPass* m_SSAOPass;
CubeMapPass* m_CubeMapPass;
//----------------------Functions----------------------//
void InitializeWindow();
+36 -10
View File
@@ -13,15 +13,32 @@
class SSAOPass
{
public:
SSAOPass(IRenderer* rendere);
SSAOPass(IRenderer* renderer, ConfigFile* config);
~SSAOPass() { };
void ChangeQuality(int quality);
void Draw(GLuint depthBuffer, Camera* camera);
void Setting(float radius, float bias, float contrast, float intensityScale, int numOfSamples, int NumOfTurns);
void Setting(float radius, float bias, float contrast, float intensityScale, int numOfSamples, int numOfTurns, int iterations, int quality);
void ClearBuffer();
void OnWindowResize();
//Return the SSAO of the texture sent to Draw
GLuint SSAOTexture() const { return m_DrawBloomPass->GaussianTexture(); }
GLuint SSAOTexture() const {
if (m_Quality == 0) {
return m_WhiteTexture->m_Texture;
} else {
return m_Gaussian_vert;
}
}
int TextureQuality() const {
if (m_Quality == 0) {
return 13;
} else {
return m_TextureQuality;
}
}
private:
void InitializeTexture();
@@ -29,15 +46,13 @@ private:
void InitializeShaderProgram();
void InitializeBuffer();
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
void ComputeAO(GLuint depthBuffer, Camera* camera);
//void blurHorizontal(GLuint depthBuffer);
//void blurVertical(GLuint depthBuffer);
Model* m_ScreenQuad;
const IRenderer* m_Renderer;
ConfigFile* m_Config;
float m_Radius;
float m_Bias;
@@ -45,17 +60,28 @@ private:
float m_IntensityScale;
int m_NumOfSamples;
int m_NumOfTurns;
int m_Iterations;
int m_TextureQuality;
int m_Quality = 0;
GLuint m_SSAOTexture;
Texture* m_WhiteTexture;
GLuint m_SSAOTexture = 0;
FrameBuffer m_SSAOFramBuffer;
GLuint m_SSAOViewSpaceZTexture;
GLuint m_SSAOViewSpaceZTexture = 0;
FrameBuffer m_SSAOViewSpaceZFramBuffer;
GLuint m_Gaussian_horiz = 0;
GLuint m_Gaussian_vert = 0;
FrameBuffer m_GaussianFrameBuffer_horiz;
FrameBuffer m_GaussianFrameBuffer_vert;
ShaderProgram* m_SSAOProgram;
ShaderProgram* m_SSAOViewSpaceZProgram;
DrawBloomPass* m_DrawBloomPass;
ShaderProgram* m_GaussianProgram_horiz;
ShaderProgram* m_GaussianProgram_vert;
};
#endif
+6 -3
View File
@@ -17,7 +17,7 @@
struct SpriteJob : RenderJob
{
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted)
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted, bool isIndicator)
: RenderJob()
{
Model = ResourceManager::Load<::Model>("Models/Core/UnitQuad.mesh");
@@ -30,7 +30,7 @@ struct SpriteJob : RenderJob
StartIndex = matProp.material->StartIndex;
EndIndex = matProp.material->EndIndex;
Matrix = matrix;
Matrix = matrix;
Color = cSprite["Color"];
Entity = cSprite.EntityID;
Position = Transform::AbsolutePosition(world, cSprite.EntityID);
@@ -41,7 +41,8 @@ struct SpriteJob : RenderJob
}
World = world;
Pickable = world->HasComponent(cSprite.EntityID, "Button");
IsIndicator = isIndicator;
FillColor = fillColor;
FillPercentage = fillPercentage;
};
@@ -61,7 +62,9 @@ struct SpriteJob : RenderJob
unsigned int StartIndex = 0;
unsigned int EndIndex = 0;
World* World;
bool Pickable;
bool IsIndicator = false;
glm::vec4 FillColor = glm::vec4(0);
float FillPercentage = 0.0;
+1
View File
@@ -18,6 +18,7 @@ public:
void Bind(GLenum textureUnit = GL_TEXTURE0);
GLuint m_Texture = 0;
unsigned char* Data = nullptr;
};
@@ -9,6 +9,10 @@
namespace CommonFunctions
{
Texture* LoadTexture(std::string path, bool threaded);
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type);
void GenerateMultiSampleTexture(GLuint* texture, int numSamples, glm::vec2 dimensions, GLint internalFormat);
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps);
void DeleteTexture(GLuint* texture);
};
#endif
+1 -1
View File
@@ -8,7 +8,7 @@ namespace Events
struct DoubleJump : public Event
{
EntityID entityID;
};
}
+1
View File
@@ -26,6 +26,7 @@ private:
double AmmoGain;
double RespawnTimer;
double DecreaseThisRespawnTimer;
EntityID parentID;
};
std::vector<NewAmmoPickup> m_ETriggerTouchVector;
};
+17 -1
View File
@@ -14,11 +14,13 @@
#include <glm/gtx/vector_angle.hpp>
#include "Rendering/Util/CommonFunctions.h"
//#define INDICATOR_TEST
class DamageIndicatorSystem : public System
class DamageIndicatorSystem : public ImpureSystem
{
public:
DamageIndicatorSystem(SystemParams params);
virtual void Update(double dt) override;
private:
EventRelay<DamageIndicatorSystem, Events::PlayerDamage> m_EPlayerDamage;
@@ -28,6 +30,20 @@ private:
bool OnSetCamera(const Events::SetCamera& e);
EntityID m_CurrentCamera = -1;
struct DamageIndicatorStruct {
EntityWrapper spriteEntity;
glm::vec3 enemyPosition;
DamageIndicatorStruct(EntityWrapper sprite, glm::vec3 pos)
: spriteEntity(sprite)
, enemyPosition(pos) {}
};
std::vector<DamageIndicatorStruct> updateDamageIndicatorVector;
float CalculateAngle(EntityWrapper player, glm::vec3 enemyPos);
//for tests
#ifdef INDICATOR_TEST
glm::vec3 DamageIndicatorTest(EntityWrapper player);
int m_TestVar = 0;
#endif
};
#endif
+1
View File
@@ -27,6 +27,7 @@ private:
double HealthGain;
double RespawnTimer;
double DecreaseThisRespawnTimer;
EntityID parentID;
};
std::vector<NewHealthPickup> m_ETriggerTouchVector;
};
+5 -1
View File
@@ -34,10 +34,14 @@ private:
glm::vec3 m_LastPosition = glm::vec3();
// The logic for making the sound play when player is moving
void playerStep(double dt);
// Spawn a hexagon at origin of an Entity
void spawnHexagon(EntityWrapper target);
EventRelay<PlayerMovementSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(Events::PlayerSpawned& e);
EventRelay<PlayerMovementSystem, Events::DoubleJump> m_EDoubleJump;
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e);
void updateMovementControllers(double dt);
void updateVelocity(double dt);
void updateVelocity(EntityWrapper player, double dt);
};
+2 -4
View File
@@ -13,8 +13,6 @@ public:
PlayerSpawnSystem(SystemParams params);
virtual void Update(double dt) override;
static void SetRespawnTime(float respawnTime) { m_RespawnTime = respawnTime; };
private:
struct SpawnRequest
@@ -31,8 +29,8 @@ private:
//EntityWrapper ID -> Player ID.
std::map<EntityID, int> m_PlayerIDs;
static float m_RespawnTime;
float m_Timer;
float m_ForcedRespawnTime;
bool m_DbgConfigForceRespawn;
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
bool OnInputCommand(Events::InputCommand& e);
@@ -1,37 +1,33 @@
#ifndef AssaultWeaponBehaviour_h__
#define AssaultWeaponBehaviour_h__
#include "Sound/EPlaySoundOnEntity.h"
#include "Collision/Collision.h"
#include "Rendering/AnimationSystem.h"
#include "Core/ConfigFile.h"
#include "WeaponBehaviour.h"
#include "../SpawnerSystem.h"
#include "Core/EPlayerDamage.h"
#include "Core/EShoot.h"
class AssaultWeaponBehaviour : public WeaponBehaviour
class AssaultWeaponBehaviour : public WeaponBehaviour<AssaultWeaponBehaviour>
{
public:
AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity);
virtual void Fire() override;
virtual void CeaseFire() override;
virtual void Reload() override;
AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
: WeaponBehaviour(systemParams, "AssaultWeapon", renderer, collisionOctree)
{ }
virtual void Update(double dt) override;
protected:
virtual void OnPrimaryFire(WeaponInfo& wi) override;
virtual void OnCeasePrimaryFire(WeaponInfo& wi) override;
virtual void OnReload(WeaponInfo& wi) override;
private:
EntityWrapper m_FirstPersonModel;
EntityWrapper m_ThirdPersonModel;
// State
bool m_Firing = false;
bool m_Reloading = false;
double m_ReloadTimer = 0.0;
EntityWrapper m_FirstPersonReloadImpersonator;
EntityWrapper m_ThirdPersonReloadImpersonator;
double m_TimeSinceLastFire = 0.0;
EventRelay<WeaponBehaviour, Events::AnimationComplete> m_EAnimationComplete;
bool OnAnimationComplete(Events::AnimationComplete& e);
EntityWrapper m_FirstPersonReloadImpostor;
bool hasAmmo();
void fireRound();
@@ -47,3 +43,5 @@ private:
bool shoot(double damage);
void showHitMarker();
};
#endif
@@ -0,0 +1,30 @@
#include "WeaponBehaviour.h"
#include "Collision/Collision.h"
#include "Core/EPlayerDamage.h"
class DefenderWeaponBehaviour : public WeaponBehaviour<DefenderWeaponBehaviour>
{
public:
DefenderWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
: System(systemParams)
, WeaponBehaviour(systemParams, "DefenderWeapon", renderer, collisionOctree)
, m_RandomEngine(m_RandomDevice())
{ }
void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override;
void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) override;
void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override;
void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override;
bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) override;
private:
std::random_device m_RandomDevice;
std::mt19937 m_RandomEngine;
// Weapon functions
void fireShell(ComponentWrapper cWeapon, WeaponInfo& wi);
void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage);
// Utility
Camera cameraFromEntity(EntityWrapper camera);
};
@@ -0,0 +1,33 @@
#include "WeaponBehaviour.h"
#include "Collision/Collision.h"
#include "Core/EPlayerDamage.h"
class SidearmWeaponBehaviour : public WeaponBehaviour<SidearmWeaponBehaviour>
{
public:
SidearmWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
: System(systemParams)
, WeaponBehaviour(systemParams, "SidearmWeapon", renderer, collisionOctree)
, m_RandomEngine(m_RandomDevice())
{ }
void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override;
void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) override;
void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override;
void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override;
void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) override;
void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override;
private:
std::random_device m_RandomDevice;
std::mt19937 m_RandomEngine;
// Weapon functions
void fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi);
//void dealDamage(WeaponInfo& wi, glm::vec3 direction, double damage);
// Utility
bool canFire(ComponentWrapper cWeapon);
bool playerInFirstPerson(EntityWrapper player);
//float traceRayDistance(glm::vec3 origin, glm::vec3 direction);
};
+227 -13
View File
@@ -5,30 +5,244 @@
#include "Rendering/IRenderer.h"
#include "Core/Octree.h"
#include "Collision/EntityAABB.h"
#include "Input/EInputCommand.h"
#include "Systems/SpawnerSystem.h"
#include "Rendering/ESetCamera.h"
class WeaponBehaviour : public System
template <typename ETYPE>
class WeaponBehaviour : public PureSystem
{
friend class WeaponSystem;
public:
WeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper player)
: System(systemParams)
WeaponBehaviour(SystemParams params, std::string componentType, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
: System(params)
, PureSystem(componentType)
, m_Renderer(renderer)
, m_CollisionOctree(collisionOctree)
, m_Player(player)
{ }
{
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &WeaponBehaviour::_OnInputCommand)
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &WeaponBehaviour::_OnSetCamera)
}
virtual ~WeaponBehaviour() = default;
WeaponBehaviour(const WeaponBehaviour&) = delete;
WeaponBehaviour& operator=(const WeaponBehaviour &) = delete;
virtual void Fire() = 0;
virtual void CeaseFire() { }
virtual void Reload() { }
virtual void Update(double dt) { }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override
{
auto weapon = getActiveWeapon(entity);
if (!weapon) {
return;
} else {
UpdateWeapon(cWeapon, *weapon, dt);
}
}
protected:
struct WeaponInfo
{
EntityWrapper Player;
EntityWrapper WeaponEntity;
EntityWrapper FirstPersonEntity;
EntityWrapper ThirdPersonEntity;
};
IRenderer* m_Renderer;
EntityWrapper m_CurrentCamera;
Octree<EntityAABB>* m_CollisionOctree;
EntityWrapper m_Player;
std::unordered_map<EntityWrapper, WeaponInfo> m_ActiveWeapons;
virtual void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { }
virtual void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { }
virtual void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { }
virtual void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) { }
virtual void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) { }
virtual void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) { }
virtual bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) { return false; }
bool isPlayerInFirstPerson(EntityWrapper player)
{
if (!m_CurrentCamera.Valid()) {
return false;
} else {
return m_CurrentCamera == player || m_CurrentCamera.IsChildOf(player);
}
}
// Returns wi.FirstPersonEntity or wi.ThirdPersonEntity depending on
// if the player is in first person mode or not.
EntityWrapper getRelevantWeaponModelEntity(WeaponInfo& wi)
{
if (isPlayerInFirstPerson(wi.Player)) {
return wi.FirstPersonEntity;
} else {
return wi.ThirdPersonEntity;
}
}
float traceRayDistance(glm::vec3 origin, glm::vec3 direction)
{
float distance;
glm::vec3 pos;
auto entity = Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos);
if (entity) {
return distance;
} else {
return 100.f;
}
}
private:
EventRelay<ETYPE, Events::SetCamera> m_ESetCamera;
bool _OnSetCamera(const Events::SetCamera& e)
{
m_CurrentCamera = e.CameraEntity;
return true;
}
EventRelay<ETYPE, Events::InputCommand> m_EInputCommand;
bool _OnInputCommand(const Events::InputCommand& e)
{
EntityWrapper player = e.Player;
if (e.PlayerID == -1) {
player = LocalPlayer;
}
// Make sure the player is alive
if (!player.Valid()) {
return false;
}
// Make sure the player has this weapon
auto cWeapon = getWeaponComponent(player);
if (!cWeapon) {
return false;
}
// Weapon selection
if (e.Command == "SelectWeapon") {
if (e.Value > 0) {
if (static_cast<ComponentInfo::EnumType>(e.Value) == static_cast<ComponentInfo::EnumType>((*cWeapon)["Slot"])) {
selectWeapon(*cWeapon, player);
} else {
holsterWeapon(*cWeapon, player);
}
}
}
// Only handle weapon actions if the weapon is active
auto activeWeapon = getActiveWeapon(player);
if (!activeWeapon) {
return false;
}
// Fire
if (e.Command == "PrimaryFire") {
if (e.Value > 0) {
OnPrimaryFire(*cWeapon, *activeWeapon);
} else {
OnCeasePrimaryFire(*cWeapon, *activeWeapon);
}
}
// Reload
if (e.Command == "Reload" && e.Value != 0) {
OnReload(*cWeapon, *activeWeapon);
}
return OnInputCommand(*cWeapon, *activeWeapon, e);
}
boost::optional<ComponentWrapper> getWeaponComponent(EntityWrapper player)
{
if (!player.HasComponent(m_ComponentType)) {
return boost::none;
}
return player[m_ComponentType];
}
boost::optional<WeaponInfo&> getActiveWeapon(EntityWrapper player)
{
auto it = m_ActiveWeapons.find(player);
if (it == m_ActiveWeapons.end()) {
return boost::none;
}
WeaponInfo& activeWeapon = it->second;
if (!activeWeapon.FirstPersonEntity.Valid() && !activeWeapon.ThirdPersonEntity.Valid()) {
return boost::none;
}
return activeWeapon;
}
void selectWeapon(ComponentWrapper cWeapon, EntityWrapper player)
{
// Don't reselect weapon if it's already active
if (getActiveWeapon(player)) {
return;
}
// Find the weapon attachments matching the weapon type
std::vector<EntityWrapper> weaponAttachments = player.ChildrenWithComponent("WeaponAttachment");
EntityWrapper firstPersonAttachment;
EntityWrapper thirdPersonAttachment;
for (auto& attachment : weaponAttachments) {
ComponentWrapper cWeaponAttachment = attachment["WeaponAttachment"];
if ((std::string&)cWeaponAttachment["Weapon"] == m_ComponentType) {
ComponentWrapper::SubscriptProxy person = cWeaponAttachment["Person"];
if ((ComponentInfo::EnumType)person == person.Enum("FirstPerson")) {
firstPersonAttachment = attachment;
} else if ((ComponentInfo::EnumType)person == person.Enum("ThirdPerson")) {
thirdPersonAttachment = attachment;
}
}
}
if (!firstPersonAttachment.Valid() && !thirdPersonAttachment.Valid()) {
LOG_WARNING("No weapon attachment found for %s of player #%i", m_ComponentType.c_str(), player.ID);
return;
}
// Spawn the weapon(s)
EntityWrapper firstPersonWeapon;
EntityWrapper thirdPersonWeapon;
if (firstPersonAttachment.Valid()) {
firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment);
}
if (thirdPersonAttachment.Valid()) {
thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment);
}
WeaponInfo& wi = m_ActiveWeapons[player];
wi.Player = player;
wi.WeaponEntity = player;
wi.FirstPersonEntity = firstPersonWeapon;
wi.ThirdPersonEntity = thirdPersonWeapon;
OnEquip(cWeapon, wi);
}
void holsterWeapon(ComponentWrapper cWeapon, EntityWrapper player)
{
auto activeWeapon = getActiveWeapon(player);
if (!activeWeapon) {
return;
}
WeaponInfo& wi = *activeWeapon;
// Send holster event
OnHolster(cWeapon, wi);
// Delete weapon entities
if (wi.FirstPersonEntity.Valid()) {
m_World->DeleteEntity(wi.FirstPersonEntity.ID);
}
if (wi.ThirdPersonEntity.Valid()) {
m_World->DeleteEntity(wi.ThirdPersonEntity.ID);
}
// Make weapon inactive
m_ActiveWeapons.erase(player);
}
};
#endif
+34 -1
View File
@@ -36,4 +36,37 @@ ResourceLoading=true
[Sound]
BGMVolume=1.0
SFXVolume=1.0
Announcer=female
Announcer=female
[SSAO]
Quality=0
[SSAO1]
Radius=1.0
Bias=0.02
Contrast=1.5
Intensity=1.0
NumSamples=8
NumTurns=3
NumIterations=5
TextureQuality=2
[SSAO2]
Radius=1.0
Bias=0.02
Contrast=1.5
Intensity=1.0
NumSamples=16
NumTurns=13
NumIterations=9
TextureQuality=1
[SSAO3]
Radius=1.0
Bias=0.02
Contrast=1.5
Intensity=1.0
NumSamples=24
NumTurns=17
NumIterations=13
TextureQuality=0
+6
View File
@@ -44,5 +44,11 @@
<xs:include schemaLocation="Components/Menu.xsd"/>
<xs:include schemaLocation="Components/KillFeed.xsd"/>
<xs:include schemaLocation="Components/Page.xsd"/>
<xs:include schemaLocation="Components/SpriteIndicator.xsd"/>
<xs:include schemaLocation="Components/Button.xsd"/>
<xs:include schemaLocation="Components/DoubleJump.xsd"/>
<xs:include schemaLocation="Components/WeaponAttachment.xsd"/>
<xs:include schemaLocation="Components/DefenderWeapon.xsd"/>
<xs:include schemaLocation="Components/SidearmWeapon.xsd"/>
<xs:include schemaLocation="Components/CapturePointGameMode.xsd"/>
</xs:schema>
@@ -8,4 +8,5 @@
<RPM>120</RPM>
<ViewPunch>0.01</ViewPunch>
<ReloadTime>2</ReloadTime>
<Slot><Primary/></Slot>
</AssaultWeapon>
@@ -2,6 +2,7 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:include schemaLocation="../Types/WeaponSlotEnum.xsd"/>
<xs:element name="AssaultWeapon">
<xs:complexType>
@@ -28,6 +29,7 @@
<xs:element name="ReloadTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Time it takes to reload the weapon in seconds</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Slot" type="WeaponSlotEnum" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CapturePointGameMode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePointGameMode.xsd">
<RespawnTime>0.0</RespawnTime>
<MaxRespawnTime>8.0</MaxRespawnTime>
</CapturePointGameMode>
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="CapturePointGameMode">
<xs:complexType>
<xs:all>
<xs:element name="RespawnTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The time since the last respawn wave. Players will be spawned when this reaches MaxRespawnTime.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MaxRespawnTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Players will be spawned when RespawnTime reaches this.</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<DefenderWeapon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DefenderWeapon.xsd">
<MagazineAmmo>8</MagazineAmmo>
<MagazineSize>8</MagazineSize>
<Ammo>64</Ammo>
<MaxAmmo>64</MaxAmmo>
<BaseDamage>90</BaseDamage>
<SpreadAngle>0.174533</SpreadAngle> <!-- 0.174533 = 10 degrees -->
<NumPellets>10</NumPellets>
<RPM>120</RPM>
<ViewPunch>0.01</ViewPunch>
<ReloadTime>0.5</ReloadTime>
<Slot><Primary/></Slot>
<IsFiring>false</IsFiring>
<TimeSinceLastFire>0</TimeSinceLastFire>
</DefenderWeapon>
+56
View File
@@ -0,0 +1,56 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:include schemaLocation="../Types/WeaponSlotEnum.xsd"/>
<xs:complexType name="WeaponStateEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="Idle" type="t:int" fixed="0" minOccurs="0"/>
<xs:element name="Firing" type="t:int" fixed="1" minOccurs="0"/>
<xs:element name="Reloading" type="t:int" fixed="2" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="DefenderWeapon">
<xs:complexType>
<xs:all>
<xs:element name="MagazineAmmo" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Ammo currently loaded into the magazine</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MagazineSize" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Max number of rounds in a magazine</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Ammo" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Current ammo carried</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MaxAmmo" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Maximum ammo able to be carried</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="BaseDamage" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Damage dealt if all shotgun pellets hit</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="SpreadAngle" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>Spread angle in radians</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="NumPellets" type="t:int" minOccurs="0"/>
<xs:element name="RPM" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Rate of fire in rounds per minute</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ViewPunch" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>View punch in radians for each shell fired</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ReloadTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Time it takes to load ONE SHELL into the weapon in seconds</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Slot" type="WeaponSlotEnum" minOccurs="0"/>
<xs:element name="IsFiring" type="t:bool" minOccurs="0"/>
<xs:element name="TimeSinceLastFire" type="t:double" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<DoubleJump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DoubleJump.xsd">
<DoubleJumpSpeed>4.0</DoubleJumpSpeed>
</DoubleJump>
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="DoubleJump">
<xs:annotation><xs:documentation>Enables a Player to double jump.</xs:documentation></xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="DoubleJumpSpeed" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>Vertical velocity set on double jump.</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
-1
View File
@@ -2,7 +2,6 @@
<Physics xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Physics.xsd">
<Velocity X="0" Y="0" Z="0"/>
<Gravity>true</Gravity>
<PrevOrigin X="-9876.5" Y="-9876.5" Z="-9876.5"/>
<IsOnGround>false</IsOnGround>
<VerticalStepHeight>0.33</VerticalStepHeight>
</Physics>
-1
View File
@@ -13,7 +13,6 @@
<xs:annotation><xs:documentation>m/s^2</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Gravity" type="t:bool" minOccurs="0"/>
<xs:element name="PrevOrigin" type="t:Vector" minOccurs="0"/>
<xs:element name="IsOnGround" type="t:bool" minOccurs="0"/>
<xs:element name="VerticalStepHeight" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The largest height of a "stair-step" that can be walked over</xs:documentation></xs:annotation>
+2
View File
@@ -2,5 +2,7 @@
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
<MovementSpeed>3</MovementSpeed>
<CrouchSpeed>1.5</CrouchSpeed>
<JumpSpeed>4.0</JumpSpeed>
<CurrentWishDirection X="0" Y="0" Z="0"/>
<CurrentWeapon></CurrentWeapon>
</Player>
+4
View File
@@ -11,7 +11,11 @@
<xs:all>
<xs:element name="MovementSpeed" type="t:float" minOccurs="0"/>
<xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/>
<xs:element name="JumpSpeed" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>Vertical velocity set when jumping.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="CurrentWishDirection" type="t:Vector" minOccurs="0"/>
<xs:element name="CurrentWeapon" type="t:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SidearmWeapon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SidearmWeapon.xsd">
<MagazineAmmo>16</MagazineAmmo>
<MagazineSize>16</MagazineSize>
<BaseDamage>20</BaseDamage>
<RPM>500</RPM>
<Automatic>false</Automatic>
<ViewPunch>0.01</ViewPunch>
<ReloadTime>0.5</ReloadTime>
<EquipTime>0.5</EquipTime>
<Slot><Secondary/></Slot>
<TriggerHeld>false</TriggerHeld>
<FireCooldown>0</FireCooldown>
<IsReloading>false</IsReloading>
<ReloadTimer>0</ReloadTimer>
</SidearmWeapon>
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:include schemaLocation="../Types/WeaponSlotEnum.xsd"/>
<xs:complexType name="WeaponStateEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="Idle" type="t:int" fixed="0" minOccurs="0"/>
<xs:element name="Firing" type="t:int" fixed="1" minOccurs="0"/>
<xs:element name="Reloading" type="t:int" fixed="2" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="SidearmWeapon">
<xs:complexType>
<xs:all>
<xs:element name="MagazineAmmo" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Ammo currently loaded into the magazine</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MagazineSize" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Max number of rounds in a magazine</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="BaseDamage" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Damage dealt if all shotgun pellets hit</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="RPM" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Rate of fire in rounds per minute</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Automatic" type="t:bool" minOccurs="0"/>
<xs:element name="ViewPunch" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>View punch in radians for each shell fired</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ReloadTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Time it takes to load ONE SHELL into the weapon in seconds</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="EquipTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Time it takes from selecting the weapon until it's ready to fire</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Slot" type="WeaponSlotEnum" minOccurs="0"/>
<xs:element name="TriggerHeld" type="t:bool" minOccurs="0"/>
<xs:element name="FireCooldown" type="t:double" minOccurs="0"/>
<xs:element name="IsReloading" type="t:bool" minOccurs="0"/>
<xs:element name="ReloadTimer" type="t:double" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SpriteIndicator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SpriteIndicator.xsd">
<MinScale>10</MinScale>
<VisibleForSingleTeamOnly>false</VisibleForSingleTeamOnly>
</SpriteIndicator>
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="SpriteIndicator">
<xs:annotation>
<xs:documentation>Billbord a Sprite around global Y axis</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="MinScale" type="t:double" minOccurs="0"/>
<xs:element name="VisibleForSingleTeamOnly" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Add a Team component to this Entity or Parent to make it visible only for that team</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Trigger xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Trigger.xsd">
</Trigger>
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="Weapon">
<xs:complexType>
<xs:all>
<xs:element name="MagSize" type="t:int" minOccurs="0"/>
<xs:element name="MaxAmmo" type="t:int" minOccurs="0"/>
<xs:element name="CurrentAmmoInMag" type="t:int" minOccurs="0"/>
<xs:element name="CurrentAmmo" type="t:int" minOccurs="0"/>
<xs:element name="RPM" type="t:double" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<WeaponAttachment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="WeaponAttachment.xsd">
<Weapon></Weapon>
<Person><FirstPerson/></Person>
</WeaponAttachment>
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:complexType name="PersonEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="FirstPerson" type="t:int" fixed="0" minOccurs="0"/>
<xs:element name="ThirdPerson" type="t:int" fixed="1" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="WeaponAttachment">
<xs:annotation><xs:documentation>Combine with a spawner to define a weapon attachment point</xs:documentation></xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="Weapon" type="t:string" minOccurs="0">
<xs:annotation><xs:documentation>The weapon component type this attachment refers to</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Person" type="PersonEnum" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+5 -5
View File
@@ -2,18 +2,18 @@
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:AABB/>
<c:AmmoPickup/>
<c:Model>
<Resource>Models/Props/PickUps/AmmoPickUp.mesh</Resource>
</c:Model>
<c:RaptorCopter>
<Speed>0.1</Speed>
<Axis X="0" Y="1" Z="0"/>
<Speed>8</Speed>
<Axis X="0" Y="0.100000001" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Position X="0" Y="1" Z="0"/>
<Scale X="0.3" Y="0.3" Z="0.3"/>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="18717.9453" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
+99
View File
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.12043038" Y="-0.244988307" Z="-0.181454808"/>
<Orientation X="0.010404544" Y="-0.00268173823" Z="0.0428441577"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+40
View File
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.163429111" Y="1.0235405" Z="-0.215489209"/>
<Orientation X="-0.0631071255" Y="-0.0576644838" Z="0.118255548"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+40
View File
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Shield" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="Shield">
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Shield/>
<c:Transform>
<Scale X="1.11800003" Y="0.0320000015" Z="1.9180001"/>
<Orientation X="-1.57079995" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="VisibleSide">
<Components>
<c:Shielded/>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="0" B="1" G="0" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="0.0179871861"/>
<Scale X="1.01900005" Y="0.0120000001" Z="1.91000009"/>
<Orientation X="-1.57079995" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+95
View File
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="DefenderWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderGunBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0.0350000001" Z="-0.295000017"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00191565475" Y="0.0324025005" Z="-0.2021029"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0490000024" Y="0.0520000011" Z="-0.063000001"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+99
View File
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0480000004" Z="-0.183000013"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/DefenderGunRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.120430306" Y="0.775375426" Z="1.36542225"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00191565475" Y="0.0324025005" Z="-0.2021029"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0490000024" Y="0.0520000011" Z="-0.063000001"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0320000015" Z="-0.165000007"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderGunBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.162026152" Y="1.05794585" Z="-0.380744517"/>
<Orientation X="-0.0628969446" Y="-0.0509683639" Z="0.118739031"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.000284185546" Y="0.0318552479" Z="-0.193328083"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0320000015" Z="-0.165000007"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/DefenderGunRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.162026152" Y="1.05794585" Z="-0.380744517"/>
<Orientation X="-0.0628969446" Y="-0.0509683639" Z="0.118739031"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.000284185546" Y="0.0318552479" Z="-0.193328083"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+5 -5
View File
@@ -2,18 +2,18 @@
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:AABB/>
<c:HealthPickup/>
<c:Model>
<Resource>Models/Props/PickUps/HealthPickUp.mesh</Resource>
</c:Model>
<c:RaptorCopter>
<Speed>0.1</Speed>
<Axis X="0" Y="1" Z="0"/>
<Speed>8</Speed>
<Axis X="0" Y="0.100000001" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Position X="0" Y="1" Z="0"/>
<Scale X="0.3" Y="0.3" Z="0.3"/>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="18767.0273" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
+1 -252
View File
@@ -10,7 +10,7 @@
<Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
<EntityFile>Schema/Entities/PlayerRed.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
@@ -118,257 +118,6 @@
</Entity>
</Children>
</Entity>
<Entity name="Player">
<Components>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon>
<RPM>600</RPM>
</c:AssaultWeapon>
<c:Collidable/>
<c:DashAbility/>
<c:Health/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
</c:Player>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="0" Y="0.0288832653" Z="2.64837074"/>
</c:Transform>
</Components>
<Children>
<Entity name="Camera">
<Components>
<c:Camera/>
<c:Transform>
<Position X="0" Y="1.27700007" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="PlayerName">
<Components>
<c:Text>
<Resource>Fonts/DroidSans.ttf,100</Resource>
<Color A="1" B="0" G="1" R="0"/>
</c:Text>
<c:Transform>
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
<Orientation X="0" Y="3.14199996" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="CameraModel">
<Components>
<c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
<Scale X="1.30000007" Y="1.50000012" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="HUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="HealthBar">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0" B="1" G="0" R="0"/>
</c:Fill>
<c:HealthHUD/>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
</c:Model>
<c:Transform>
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
<Orientation X="0" Y="0.594000041" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Crosshair">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.200000003"/>
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Hands">
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>1.9569972344146196</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:Model>
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponModel">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0.120748013" Y="-0.228470564" Z="-0.151475638"/>
<Orientation X="0.010404693" Y="-0.00268176314" Z="0.0428441502"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/WeaponReloadEffect.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ThirdPersonCamera">
<Components>
<c:Camera/>
<c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="-0.284000009" Y="1.83800006" Z="1.18900001"/>
<Orientation X="5.95600033" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="PlayerModel">
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>1.8055945618467364</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:AnimationOffset>
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="ThirdPersonWeaponModel">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0.158578917" Y="1.02878916" Z="-0.215411991"/>
<Orientation X="-0.0626687407" Y="-0.0361274257" Z="0.120101407"/>
</c:Transform>
</Components>
<Children>
<Entity name="ThirdPersonWeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="AABBStanding">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.427450985" B="1" G="1" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
<Scale X="1" Y="1.60000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AABBCrouching">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.745098054" B="1" G="0" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+118 -121
View File
@@ -6,24 +6,28 @@
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon>
<RPM>600</RPM>
</c:AssaultWeapon>
<c:Collidable/>
<c:DashAbility/>
<c:DefenderWeapon>
<TimeSinceLastFire>102.85760837900634</TimeSinceLastFire>
</c:DefenderWeapon>
<c:DoubleJump/>
<c:SidearmWeapon/>
<c:Health/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
<CurrentWeapon></CurrentWeapon>
</c:Player>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform/>
<c:Transform>
<Position X="-1.42731023" Y="0.0288832653" Z="3.63052702"/>
</c:Transform>
</Components>
<Children>
@@ -60,6 +64,7 @@
<c:Sprite>
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
<DepthSort>false</DepthSort>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.200000003"/>
@@ -110,6 +115,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:HealthHUD/>
@@ -135,6 +141,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -152,6 +159,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -167,6 +175,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -185,6 +194,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -200,6 +210,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite>
<c:Transform>
@@ -217,6 +228,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -232,6 +244,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -249,6 +262,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -264,6 +278,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
</c:Sprite>
<c:Transform>
@@ -279,6 +294,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -304,6 +320,7 @@
<Entity name="KillFeed1">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
@@ -316,6 +333,7 @@
<Entity name="KillFeed2">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
@@ -330,6 +348,7 @@
<Entity name="KillFeed3">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
@@ -349,8 +368,10 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>1.8314163732853146</Time1>
<Time1>1.8348644854054612</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:Model>
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
@@ -359,99 +380,41 @@
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponModel">
<Entity name="PrimaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.120430619" Y="-0.229687244" Z="-0.181454629"/>
<Orientation X="0.0104048112" Y="-0.0026817855" Z="0.0428442657"/>
<Position X="0.120430619" Y="-0.229639441" Z="-0.181454554"/>
<Orientation X="0.0104045719" Y="-0.00268170005" Z="0.0428441055"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:WeaponAttachment>
<Weapon>SidearmWeapon</Weapon>
</c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/SidearmWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.120430619" Y="-0.229639441" Z="-0.181454554"/>
<Orientation X="0.0104045719" Y="-0.00268170005" Z="0.0428441055"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -475,13 +438,16 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.16333512901638159</Time1>
<Time1>0.013134522267137072</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:AnimationOffset>
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:Shielded/>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
@@ -490,41 +456,41 @@
<c:Transform/>
</Components>
<Children>
<Entity name="ThirdPersonWeaponModel">
<Entity name="PrimaryAttachment">
<Components>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:WeaponAttachment>
<Weapon>SidearmWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/SidearmWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.158296332" Y="1.03131664" Z="-0.21615544"/>
<Orientation X="-0.0626514703" Y="-0.0352048129" Z="0.12013837"/>
<Position X="0.156846598" Y="1.03287792" Z="-0.216207206"/>
<Orientation X="-0.0626498386" Y="-0.0301200207" Z="0.12067578"/>
</c:Transform>
</Components>
<Children>
<Entity name="ThirdPersonWeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
<Children/>
</Entity>
</Children>
</Entity>
@@ -570,6 +536,37 @@
</Components>
<Children/>
</Entity>
<Entity name="Indicator">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Arrow.png</DiffuseTexture>
<DepthSort>false</DepthSort>
<GlowMap></GlowMap>
<Color A="1" B="1" G="0.309803933" R="0"/>
</c:Sprite>
<c:HiddenForLocalPlayer/>
<c:SpriteIndicator>
<MinScale>50</MinScale>
<VisibleForSingleTeamOnly>true</VisibleForSingleTeamOnly>
</c:SpriteIndicator>
<c:Transform>
<Position X="0" Y="1.84019077" Z="0"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ShieldAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderShield.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.859000027" Z="-0.976999998"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+112 -130
View File
@@ -7,23 +7,31 @@
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon>
<RPM>600</RPM>
<Slot>
<Secondary/>
</Slot>
</c:AssaultWeapon>
<c:Collidable/>
<c:DashAbility/>
<c:DefenderWeapon>
<TimeSinceLastFire>1.6944730461160304</TimeSinceLastFire>
</c:DefenderWeapon>
<c:DoubleJump/>
<c:Health/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
<CurrentWeapon></CurrentWeapon>
</c:Player>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform/>
<c:Transform>
<Position X="0" Y="0.0288832653" Z="3.63052702"/>
</c:Transform>
</Components>
<Children>
@@ -60,6 +68,7 @@
<c:Sprite>
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
<DepthSort>false</DepthSort>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.200000003"/>
@@ -110,6 +119,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:HealthHUD/>
@@ -135,6 +145,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -152,6 +163,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -167,6 +179,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -185,6 +198,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -200,6 +214,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite>
<c:Transform>
@@ -217,6 +232,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -232,6 +248,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -249,6 +266,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -264,6 +282,7 @@
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
</c:Sprite>
<c:Transform>
@@ -279,6 +298,7 @@
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -304,6 +324,7 @@
<Entity name="KillFeed1">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
@@ -316,6 +337,7 @@
<Entity name="KillFeed2">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
@@ -330,6 +352,7 @@
<Entity name="KillFeed3">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
@@ -349,8 +372,10 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.018170670865885086</Time1>
<Time1>0.67172915251515519</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:Model>
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
@@ -359,99 +384,29 @@
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponModel">
<Entity name="PrimaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.120430693" Y="-0.2284486" Z="-0.181454509"/>
<Orientation X="0.0104046017" Y="-0.00268172775" Z="0.0428442247"/>
</c:Transform>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponViewRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectViewRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
</c:WeaponAttachment>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -475,13 +430,15 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.11675631578762591</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:AnimationOffset>
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:Shielded/>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
@@ -490,41 +447,35 @@
<c:Transform/>
</Components>
<Children>
<Entity name="ThirdPersonWeaponModel">
<Entity name="PrimaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.157842755" Y="1.03184748" Z="-0.216178894"/>
<Orientation X="-0.0626459867" Y="-0.0335309952" Z="0.120309927"/>
</c:Transform>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorldRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
</Components>
<Children>
<Entity name="ThirdPersonWeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorldRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -563,13 +514,44 @@
<Color A="1" B="0" G="1" R="0"/>
</c:Text>
<c:Transform>
<Position X="0.100000001" Y="1.50199997" Z="-0.248000011"/>
<Position X="0.100000001" Y="1.50176644" Z="-0.248000011"/>
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
<Orientation X="0" Y="3.14199996" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Indicator">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Arrow.png</DiffuseTexture>
<DepthSort>false</DepthSort>
<GlowMap></GlowMap>
<Color A="1" B="1" G="0.309803933" R="0"/>
</c:Sprite>
<c:HiddenForLocalPlayer/>
<c:SpriteIndicator>
<MinScale>50</MinScale>
<VisibleForSingleTeamOnly>true</VisibleForSingleTeamOnly>
</c:SpriteIndicator>
<c:Transform>
<Position X="0" Y="1.84019077" Z="0"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ShieldAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderShield.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.859000027" Z="-0.976999998"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="1" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0.690654039" Z="2.69841838"/>
<Scale X="2" Y="0.0260000005" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+43
View File
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform>
<Scale X="0" Y="1" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="1" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-50"/>
<Scale X="100" Y="0.0260000005" Z="0"/>
<Orientation X="0" Y="-1.57099998" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="1" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-50"/>
<Scale X="100" Y="0.0260000005" Z="0"/>
<Orientation X="0" Y="-1.57099998" Z="3.1400001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SidearmWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Model>
<Resource>Models/Weapons/SecondaryWeapon.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-0.00200000009" Y="0.0600000024" Z="-0.297000021"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/Ray2Red.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.105000004" Z="-0.256000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0300000012" Y="0.077000007" Z="-0.063000001"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00300000003"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>16</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="0" Y="-0.00600000005" Z="0"/>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Infinity!">
<Components>
<c:Text>
<Content>8</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="0.0150000006" Y="-0.029000001" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
<Orientation X="0" Y="0" Z="1.5710001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SidearmWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Model>
<Resource>Models/Weapons/SecondaryWeapon.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-0.0160000008" Y="0.0800000057" Z="-0.275000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0123999491" Y="0.102453232" Z="-0.273824364"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+3
View File
@@ -50,6 +50,9 @@
<xs:element ref="c:Menu" minOccurs="0"/>
<xs:element ref="c:Page" minOccurs="0"/>
<xs:element ref="c:Button" minOccurs="0"/>
<xs:element ref="c:WeaponAttachment" minOccurs="0"/>
<xs:element ref="c:DefenderWeapon" minOccurs="0"/>
<xs:element ref="c:SidearmWeapon" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:complexType name="WeaponSlotEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="Primary" type="t:int" fixed="1" minOccurs="0"/>
<xs:element name="Secondary" type="t:int" fixed="2" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
+15 -4
View File
@@ -12,6 +12,8 @@ uniform vec4 FillColor;
uniform vec4 AmbientColor;
uniform float FillPercentage;
uniform float GlowIntensity = 10;
uniform vec3 CameraPosition;
uniform int SSAOQuality;
uniform vec2 DiffuseUVRepeat;
uniform vec2 NormalUVRepeat;
@@ -22,6 +24,7 @@ layout (binding = 1) uniform sampler2D DiffuseTexture;
layout (binding = 2) uniform sampler2D NormalMapTexture;
layout (binding = 3) uniform sampler2D SpecularMapTexture;
layout (binding = 4) uniform sampler2D GlowMapTexture;
layout (binding = 5) uniform samplerCube CubeMap;
#define TILE_SIZE 16
@@ -123,7 +126,7 @@ vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textu
void main()
{
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy), 0).r;
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy) >> int(SSAOQuality), 0).r;
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
@@ -132,7 +135,11 @@ void main()
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-position);
vec4 viewVec = normalize(-position);
vec3 I = normalize(vec3(M * vec4(Input.Position, 1.0)) - CameraPosition);
vec3 R = reflect(-I, Input.Normal);
//R = vec3(P * vec4(R, 1.0));
vec4 reflectionColor = texture(CubeMap, R);
vec2 tilePos;
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
@@ -163,6 +170,9 @@ void main()
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a;
color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal;
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
@@ -172,9 +182,10 @@ void main()
color_result += FillColor;
}
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
color_result += glowTexel*GlowIntensity;
//sceneColor = vec4(reflectionColor.xyz, 1);
color_result.xyz += glowTexel.xyz*GlowIntensity;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), clamp(color_result.a, 0, 1));
bloomColor = vec4(max(color_result.xyz - 1.0, 0.0), clamp(color_result.a, 0, 1));
//Tiled Debug Code
/*
+4 -4
View File
@@ -23,12 +23,12 @@ out VertexData{
void main()
{
gl_Position = P*V*M * vec4(Position, 1.0);
mat4 TIM = transpose(inverse(M));
Output.Position = Position;
Output.TextureCoordinate = TextureCoords;
Output.Normal = vec3(M * vec4(Normal, 0.0));
Output.Tangent = vec3(M * vec4(Tangent, 0.0));
Output.BiTangent = vec3(M * vec4(BiTangent, 0.0));
Output.Normal = vec3(TIM * vec4(Normal, 0.0));
Output.Tangent = vec3(TIM * vec4(Tangent, 0.0));
Output.BiTangent = vec3(TIM * vec4(BiTangent, 0.0));
Output.ExplosionColor = vec4(1.0);
Output.ExplosionPercentageElapsed = 0.0;
}
@@ -11,6 +11,7 @@ uniform vec4 DiffuseColor;
uniform vec4 FillColor;
uniform vec4 Color;
uniform vec4 AmbientColor;
uniform int SSAOQuality;
//Get bineded at the same time as the textures
uniform vec2 DiffuseUVRepeat1;
@@ -177,7 +178,7 @@ vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
void main()
{
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy), 0).r;
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy) >> int(SSAOQuality), 0).r;
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
+7 -12
View File
@@ -2,11 +2,11 @@
//Number of samples per pixel
uniform int uNumOfSamples;
//#define NUM_SAMPLES (11)
//#define uNumOfSamples (11)
//Number of turns around the cirle
uniform int uNumOfTurns;
//#define NUM_TURNS (7)
//#define uNumOfTurns (7)
layout (binding = 0) uniform sampler2D ViewSpaceZ;
@@ -16,15 +16,16 @@ uniform float uProjScale;
//#define ProjScale 500
uniform float uRadius;
//#define Radius 1.0f
//#define uRadius 1.0f
uniform float uBias;
//#define Bias 0.012f
//#define uBias 0.05f
uniform float uContrast;
//#define IntensityDivR6 1
//#define uContrast 1.5f
uniform float uIntensityScale;
//#define uIntensityScale 1.0f
out float AO;
@@ -88,13 +89,7 @@ void main() {
vec3 origin = getVSPosition(originScreenCoord);
float radius;
if(origin.z < uRadius){
radius = origin.z;
} else {
radius = uRadius;
}
float radius = min(origin.z, uRadius);
vec3 originNormal = getVSFaceNormal(origin);
+5
View File
@@ -2,7 +2,12 @@
layout (location = 0) in vec3 Position;
out VertexData{
vec2 TextureCoordinate;
}Output;
void main()
{
gl_Position = vec4(Position, 1.0);
Output.TextureCoordinate = (vec2(Position) + 1) / 2;
}
+5 -1
View File
@@ -3,11 +3,15 @@
layout (binding = 0) uniform sampler2D DepthBuffer;
uniform vec3 ClipInfo;
in VertexData{
vec2 TextureCoordinate;
}Input;
out float depthLinear;
//Just for Debug, should be depthLinear
//out vec4 fragmentColor;
void main() {
float depthSample = texelFetch(DepthBuffer, ivec2(gl_FragCoord.xy), 0).r;
float depthSample = texture2D(DepthBuffer, Input.TextureCoordinate).r;
depthLinear = ClipInfo[0] / (ClipInfo[1] * depthSample + ClipInfo[2]);
//float depthLinear = (NearClip) / ( -depthSample + 1.0f);
//fragmentColor = vec4(depthLinear, depthLinear, depthLinear, 1.0f);
+49 -44
View File
@@ -12,55 +12,56 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
if (!boundingBox) {
return;
}
ComponentWrapper& cTransform = entity["Transform"];
EntityAABB& boxA = *boundingBox;
bool everHitTheGround = false;
glm::vec3 size = boxA.Size();
float diameter = std::min(size.x, size.z);
glm::vec3 prevOrigin = (glm::vec3)cPhysics["PrevOrigin"];
glm::vec3 toCurrentPos = boxA.Origin() - prevOrigin;
float rayLength = glm::length(toCurrentPos) + 0.5f*diameter;
//If the entity has moved farther than the size of its box, we need to handle it specially.
bool traceCollision = rayLength > diameter;
//hack solution: If prevOrigin is less than -9000 in all dimensions,
//then it means it is not set, i.e. this is the first collision check for the entity.
if (traceCollision && glm::any(glm::greaterThan((glm::vec3)cPhysics["PrevOrigin"], glm::vec3(-9000.f)))) {
Ray ray(prevOrigin, toCurrentPos);
m_OctreeResult.clear();
m_Octree->ObjectsPossiblyHitByRay(ray, m_OctreeResult);
for (auto& boxB : m_OctreeResult) {
if (boxA.Entity == boxB.Entity) {
continue;
}
bool hit;
float dist;
if (boxB.Entity.HasComponent("Model")) {
RawModel* model;
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
try {
model = ResourceManager::Load<RawModel, true>(res);
} catch (const std::exception&) {
auto prevPosIt = m_PrevPositions.find(entity);
if (prevPosIt != m_PrevPositions.end()) {
glm::vec3 size = boxA.Size();
float diameter = std::min(size.x, size.z);
glm::vec3 prevOrigin = prevPosIt->second;
glm::vec3 toCurrentPos = boxA.Origin() - prevOrigin;
float rayLength = glm::length(toCurrentPos) + 0.5f*diameter;
//If the entity has moved farther than the size of its box, we need to handle it specially.
if (rayLength > diameter) {
Ray ray(prevOrigin, toCurrentPos);
m_OctreeResult.clear();
m_Octree->ObjectsPossiblyHitByRay(ray, m_OctreeResult);
for (auto& boxB : m_OctreeResult) {
if (boxA.Entity == boxB.Entity) {
continue;
}
float u, v;
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, Transform::ModelMatrix(boxB.Entity), dist, u, v);
} else {
hit = Collision::RayVsAABB(ray, boxB, dist);
}
if (hit && dist < rayLength) {
//Set the entity to where it was colliding, minus the maximum box size.
//TODO: Perhaps this should be done slightly more properly.
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
glm::vec3 resolve = newOriginPos - boxA.Origin();
(glm::vec3&)cTransform["Position"] += resolve;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolve.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
bool hit;
float dist;
if (boxB.Entity.HasComponent("Model")) {
RawModel* model;
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
try {
model = ResourceManager::Load<RawModel, true>(res);
} catch (const std::exception&) {
continue;
}
float u, v;
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, Transform::ModelMatrix(boxB.Entity), dist, u, v);
} else {
hit = Collision::RayVsAABB(ray, boxB, dist);
}
if (hit && dist < rayLength) {
//Set the entity to where it was colliding, minus the maximum box size.
//TODO: Perhaps this should be done slightly more properly.
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
glm::vec3 resolve = newOriginPos - boxA.Origin();
(glm::vec3&)cTransform["Position"] += resolve;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolve.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
}
break;
}
break;
}
}
}
@@ -86,10 +87,13 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
bool notMovingxz = glm::all(glm::lessThan(glm::abs(glm::vec2(inOutVelocity.x, inOutVelocity.z)), glm::vec2(0.01f))) && prevPosIt != m_PrevPositions.end();
bool isOnGround = (bool)cPhysics["IsOnGround"];
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
(glm::vec3&)cTransform["Position"] += resolutionVector;
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector.
(glm::vec3&)cTransform["Position"] += notMovingxz ? prevPosIt->second - boxA.Origin() : resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity);
cPhysics["Velocity"] = inOutVelocity;
if (isOnGround) {
everHitTheGround = true;
@@ -99,6 +103,7 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
} else if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
//Enter here if boxB has no Model.
(glm::vec3&)cTransform["Position"] += resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolutionVector.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
@@ -112,5 +117,5 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
(bool)cPhysics["IsOnGround"] = false;
}
(glm::vec3&)cPhysics["PrevOrigin"] = boxA.Origin();
m_PrevPositions[entity] = boxA.Origin();
}
+79 -1
View File
@@ -51,6 +51,40 @@ EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& compone
return EntityWrapper::Invalid;
}
EntityWrapper EntityWrapper::Clone(EntityWrapper parent /*= Invalid*/)
{
if (!Valid()) {
return EntityWrapper::Invalid;
}
EntityWrapper clone = cloneRecursive(*this, EntityWrapper::Invalid);
this->World->SetParent(clone.ID, parent.ID);
return clone;
}
std::vector<EntityWrapper> EntityWrapper::ChildrenWithComponent(const std::string& componentType)
{
std::vector<EntityWrapper> childrenWithComponent;
childrenWithComponentRecursive(componentType, *this, childrenWithComponent);
return childrenWithComponent;
}
void EntityWrapper::DeleteChildren()
{
auto itPair = this->World->GetDirectChildren(this->ID);
if (itPair.first == itPair.second) {
return;
}
std::vector<EntityID> entitiesToDelete;
for (auto it = itPair.first; it != itPair.second; it++) {
entitiesToDelete.push_back(it->second);
}
for (auto& e : entitiesToDelete) {
this->World->DeleteEntity(e);
}
}
bool EntityWrapper::IsChildOf(EntityWrapper potentialParent)
{
EntityWrapper entity = *this;
@@ -90,6 +124,11 @@ ComponentWrapper EntityWrapper::operator[](const char* componentName)
}
}
ComponentWrapper EntityWrapper::operator[](const std::string& componentName)
{
return this->operator[](componentName.c_str());
}
bool EntityWrapper::operator==(const EntityWrapper& e) const
{
return (this->ID == e.ID) && (this->World == e.World);
@@ -111,7 +150,7 @@ EntityWrapper EntityWrapper::firstChildByNameRecursive(const std::string& name,
return EntityWrapper::Invalid;
}
auto itPair = this->World->GetChildren(parent);
auto itPair = this->World->GetDirectChildren(parent);
if (itPair.first == itPair.second) {
return EntityWrapper::Invalid;
}
@@ -131,3 +170,42 @@ EntityWrapper EntityWrapper::firstChildByNameRecursive(const std::string& name,
return EntityWrapper::Invalid;
}
EntityWrapper EntityWrapper::cloneRecursive(EntityWrapper entity, EntityWrapper parent)
{
EntityWrapper clone = EntityWrapper(entity.World, entity.World->CreateEntity(parent.ID));
entity.World->SetName(clone.ID, entity.Name());
// Clone components
for (auto& kv : entity.World->GetComponentPools()) {
if (kv.second->KnowsEntity(entity.ID)) {
ComponentWrapper c1 = kv.second->GetByEntity(entity.ID);
ComponentWrapper c2 = entity.World->AttachComponent(clone.ID, kv.first);
c1.Copy(c2);
}
}
// Clone children
auto children = entity.World->GetDirectChildren(entity.ID);
for (auto it = children.first; it != children.second; ++it) {
EntityWrapper child(entity.World, it->second);
cloneRecursive(child, clone);
}
return clone;
}
void EntityWrapper::childrenWithComponentRecursive(const std::string& componentType, EntityWrapper& entity, std::vector<EntityWrapper>& childrenWithComponent)
{
auto itPair = this->World->GetDirectChildren(entity.ID);
if (itPair.first == itPair.second) {
return;
}
for (auto it = itPair.first; it != itPair.second; ++it) {
EntityWrapper child = EntityWrapper(entity.World, it->second);
if (child.HasComponent(componentType)) {
childrenWithComponent.push_back(child);
}
childrenWithComponentRecursive(componentType, child, childrenWithComponent);
}
}
+1 -1
View File
@@ -127,7 +127,7 @@ void World::SetParent(EntityID entity, EntityID parent)
m_EntityChildren.insert(std::make_pair(parent, entity));
}
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> World::GetChildren(EntityID entity)
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> World::GetDirectChildren(EntityID entity)
{
return m_EntityChildren.equal_range(entity);
}
+72 -7
View File
@@ -338,6 +338,15 @@ bool EditorGUI::drawComponentNode(EntityWrapper entity, const ComponentInfo& ci)
}
}
if (ci.Name == "Spawner") {
if (ImGui::Button("Activate")) {
Events::SpawnerSpawn e;
e.Spawner = entity;
e.Parent = entity;
m_EventBroker->Publish(e);
}
}
return true;
}
@@ -381,14 +390,52 @@ bool EditorGUI::drawComponentField_Vector(ComponentWrapper &c, const ComponentIn
// Limit scale values to a minimum of 0
return ImGui::DragFloat3("", glm::value_ptr(val), 0.1f, 0.f, std::numeric_limits<float>::max());
} else if (field.Name == "Orientation") {
// Make orentations have a period of 2*Pi
glm::vec3 tempVal = glm::fmod(val, glm::vec3(glm::two_pi<float>()));
if (ImGui::SliderFloat3("", glm::value_ptr(tempVal), 0.f, glm::two_pi<float>())) {
val = tempVal;
return true;
} else {
return false;
//glm::vec3 tempVal = val;
glm::vec3 originalVal = val;
ImVec2 cursorPos = ImGui::GetCursorScreenPos();
glm::tvec3<bool> isSnapping(false, false, false);
bool changed = ImGui::DragFloat3("", glm::value_ptr(val), 0.066666f);
if (changed) {
// Make orentations have a period of 2*Pi
val = glm::fmod(val, glm::vec3(glm::two_pi<float>()));
for (int i = 0; i < 3; i++) {
if (val[i] < 0) {
val[i] += glm::two_pi<float>();
}
}
}
// Snap to angle
//float snapRange = glm::pi<float>() / 15.f;
//float snapAngle = glm::quarter_pi<float>();
//glm::vec3 snap = glm::fmod(val, glm::vec3(snapAngle));
//for (int i = 0; i < 3; i++) {
// isSnapping[i] = glm::abs(snap[i] - (snapRange / 2.f)) < snapRange;
//}
//if (changed && ImGui::IsMouseDown(0)) {
// glm::vec3 change = val - originalVal;
// for (int i = 0; i < 3; i++) {
// if (isSnapping[i] && glm::abs(change[i]) < snapRange) {
// val[i] -= snap[i] - snapRange;
// }
// }
//}
// Draw snapping outline
float width = ImGui::CalcItemWidth() / 3.f;;
float spacing = GImGui->Style.ItemInnerSpacing.x;
for (int i = 0; i < 3; i++) {
if (isSnapping[i]) {
ImVec2 pos = cursorPos + ImVec2(i * (width + spacing), 0.f);
ImRect bb(pos - ImVec2(1, 1), pos + ImVec2(width, 17));
auto window = ImGui::GetCurrentWindow();
const ImU32 col = window->Color(ImGuiCol_HeaderActive);
window->DrawList->AddRect(bb.Min, bb.Max, col, 3.f);
}
}
return changed;
} else {
return ImGui::DragFloat3("", glm::value_ptr(val), 0.1f, std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
}
@@ -580,6 +627,11 @@ void EditorGUI::createWidgetToolButton(WidgetMode mode)
bool EditorGUI::OnKeyDown(const Events::KeyDown& e)
{
ImGuiIO& io = ImGui::GetIO();
if (io.WantCaptureKeyboard) {
return false;
}
if (e.ModCtrl && e.KeyCode == GLFW_KEY_S) {
if (m_CurrentSelection.Valid()) {
EntityWrapper baseParent = m_CurrentSelection;
@@ -598,6 +650,19 @@ bool EditorGUI::OnKeyDown(const Events::KeyDown& e)
entityImport(m_World);
}
if (e.ModCtrl && e.KeyCode == GLFW_KEY_C) {
m_CopyTarget = m_CurrentSelection;
}
if (e.ModCtrl && e.KeyCode == GLFW_KEY_V) {
if (m_OnEntityPaste != nullptr) {
EntityWrapper copy = m_OnEntityPaste(m_CopyTarget, m_CurrentSelection);
if (copy != EntityWrapper::Invalid) {
SelectEntity(copy);
}
}
}
if (e.KeyCode == GLFW_KEY_DELETE) {
if (m_CurrentSelection.Valid()) {
entityDelete(m_CurrentSelection);
+6
View File
@@ -28,6 +28,7 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
m_EditorGUI->SetEntityDeleteCallback(std::bind(&EditorSystem::OnEntityDelete, this, std::placeholders::_1));
m_EditorGUI->SetEntityChangeParentCallback(std::bind(&EditorSystem::OnEntityChangeParent, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetEntityChangeNameCallback(std::bind(&EditorSystem::OnEntityChangeName, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetEntityPasteCallback(std::bind(&EditorSystem::OnEntityPaste, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetComponentAttachCallback(std::bind(&EditorSystem::OnComponentAttach, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetComponentDeleteCallback(std::bind(&EditorSystem::OnComponentDelete, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetWidgetModeCallback(std::bind(&EditorSystem::setWidgetMode, this, std::placeholders::_1));
@@ -160,6 +161,11 @@ void EditorSystem::OnEntityChangeName(EntityWrapper entity, const std::string& n
}
}
EntityWrapper EditorSystem::OnEntityPaste(EntityWrapper entityToCopy, EntityWrapper parent)
{
return entityToCopy.Clone(parent);
}
void EditorSystem::OnComponentAttach(EntityWrapper entity, const std::string& componentType)
{
if (entity.Valid()) {
+121 -13
View File
@@ -1,7 +1,7 @@
#include "Network/Client.h"
using namespace boost::asio::ip;
Client::Client(World* world, EventBroker* eventBroker)
Client::Client(World* world, EventBroker* eventBroker)
: Network(world, eventBroker)
{
// Asumes root node is EntityID_Invalid
@@ -13,6 +13,8 @@ Client::Client(World* world, EventBroker* eventBroker)
m_PlayerName = config->Get<std::string>("Networking.Name", "Raptorcopter");
m_SendInputIntervalMs = config->Get<int>("Networking.SendInputIntervalMs", 33);
LOG_INFO("Client initialized");
m_ServerlistRequest.Connect(m_PlayerName, "192.168.1.255", 32554);
}
Client::Client(World* world, EventBroker* eventBroker, std::unique_ptr<SnapshotFilter> snapshotFilter)
@@ -30,6 +32,8 @@ void Client::Connect(std::string address, int port)
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Client::OnInputCommand);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &Client::OnDoubleJump);
EVENT_SUBSCRIBE_MEMBER(m_ESearchForServers, &Client::OnSearchForServers);
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
m_Address = address;
if (address.empty()) {
@@ -66,6 +70,21 @@ void Client::Update()
}
while (m_ServerlistRequest.IsSocketAvailable()) {
Packet packet(MessageType::Invalid);
m_ServerlistRequest.Receive(packet);
if (packet.GetMessageType() == MessageType::ServerlistRequest) {
parseServerlist(packet);
}
}
if (m_SearchingForServers) {
if (m_SearchingTime < (1000* (std::clock() - m_StartSearchTime) / (double)CLOCKS_PER_SEC)) {
m_SearchingForServers = false;
displayServerlist();
}
}
if (m_IsConnected) {
// Don't send 1 input in 1 packet, bunch em up.
if (m_SendInputIntervalMs < (1000 * (std::clock() - m_TimeSinceSentInputs) / (double)CLOCKS_PER_SEC)) {
@@ -122,6 +141,9 @@ void Client::parseMessageType(Packet& packet)
case MessageType::OnPlayerDamage:
parsePlayerDamage(packet);
break;
case MessageType::OnDoubleJump:
parseDoubleJump(packet);
break;
default:
break;
}
@@ -173,6 +195,22 @@ void Client::parsePing()
m_Reliable.Send(packet);
}
void Client::parseServerlist(Packet& packet)
{
// Pop size, message type, and ID
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
std::string address = packet.ReadString();
int port = packet.ReadPrimitive<int>();
std::string serverName = packet.ReadString();
int playersConnected = packet.ReadPrimitive<int>();
//TODO: This should not happen when a client is connected to a server
m_Serverlist.push_back({ address, port, serverName, playersConnected });
}
void Client::parseKick()
{
LOG_WARNING("You have been kicked from the server.");
@@ -190,12 +228,12 @@ void Client::parseSpawnEvents()
}
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(m_PlayerSpawnEvents.at(i).Player.ID));
//e.Spawner = EntityWrapper(m_World, m_ServerIDToClientID.at(m_PlayerSpawnEvents.at(i).Spawner.ID));
e.PlayerID = -1;
e.PlayerID = -1;
e.PlayerName = m_PlayerSpawnEvents.at(i).PlayerName;
m_EventBroker->Publish(e);
}
m_PlayerSpawnEvents = tempSpawn;
// m_PlayerSpawnEvents.clear();
// m_PlayerSpawnEvents.clear();
}
void Client::parsePlayersSpawned(Packet& packet)
@@ -223,8 +261,14 @@ void Client::parseEntityDeletion(Packet & packet)
if (m_ServerIDToClientID.find(entityToDelete) != m_ServerIDToClientID.end()) {
EntityID localEntity = m_ServerIDToClientID.at(entityToDelete);
if (m_World->ValidEntity(localEntity)) {
m_World->DeleteEntity(localEntity);
deleteFromServerClientMaps(entityToDelete, localEntity);
if (m_World->HasComponent(localEntity,"Player")) {
Events::PlayerDeath e;
e.Player = EntityWrapper(m_World, localEntity);
m_EventBroker->Publish(e);
} else {
m_World->DeleteEntity(localEntity);
deleteFromServerClientMaps(entityToDelete, localEntity);
}
}
}
}
@@ -238,6 +282,20 @@ void Client::parseComponentDeletion(Packet & packet)
}
}
void Client::parseDoubleJump(Packet & packet)
{
EntityID serverID = packet.ReadPrimitive<EntityID>();
if (!serverClientMapsHasEntity(serverID)) {
return;
}
Events::DoubleJump e;
e.entityID = m_ServerIDToClientID.at(serverID);
// If player is local player do not publish to prevent infinite feedback loop
if (e.entityID != m_LocalPlayer.ID) {
m_EventBroker->Publish(e);
}
}
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
{
for (auto field : componentInfo.FieldsInOrder) {
@@ -312,19 +370,20 @@ void Client::parseSnapshot(Packet& packet)
if (serverClientMapsHasEntity(serverEntityID)) {
EntityID localEntityID = m_ServerIDToClientID.at(serverEntityID);
EntityWrapper localEntity(m_World, localEntityID);
// Update entity
if (m_World->HasComponent(localEntityID, componentType)) {
// TODO Fix memory leak here
SharedComponentWrapper newComponent = createSharedComponent(packet, localEntityID, componentInfo);
bool shouldApply = true;
// Apply potential filter function
if (m_SnapshotFilter != nullptr) {
shouldApply = m_SnapshotFilter->FilterComponent(localEntity, newComponent);
}
if (shouldApply) {
if (shouldApply) {
ComponentWrapper currentComponent = m_World->GetComponent(localEntityID, componentType);
memcpy(currentComponent.Data, newComponent.Data, componentInfo.Stride);
}
//if (localEntity != m_LocalPlayer && !localEntity.IsChildOf(m_LocalPlayer)) {
// updateFields(packet, componentInfo, localEntityID);
//} else {
@@ -341,7 +400,11 @@ void Client::parseSnapshot(Packet& packet)
if (serverParentID == EntityID_Invalid) {
newLocalEntityID = m_World->CreateEntity(EntityID_Invalid);
} else {
newLocalEntityID = m_World->CreateEntity(m_ServerIDToClientID.at(serverParentID));
if (serverClientMapsHasEntity(serverParentID)) {
newLocalEntityID = m_World->CreateEntity(m_ServerIDToClientID.at(serverParentID));
} else {
newLocalEntityID = m_World->CreateEntity(EntityID_Invalid);
}
}
m_World->SetName(newLocalEntityID, serverEntityName);
insertIntoServerClientMaps(serverEntityID, newLocalEntityID);
@@ -351,9 +414,11 @@ void Client::parseSnapshot(Packet& packet)
}
// Parent logic
// This should be enough beacause we know that the entities arives in pre-order (there will always be a parent)
if (serverParentID != EntityID_Invalid) {
if (serverParentID != EntityID_Invalid && serverClientMapsHasEntity(serverParentID)) {
EntityID localEntityID = m_ServerIDToClientID.at(serverEntityID);
m_World->SetParent(localEntityID, m_ServerIDToClientID.at(serverParentID));
if (m_World->GetParent(localEntityID) != m_ServerIDToClientID.at(serverParentID)) {
m_World->SetParent(localEntityID, m_ServerIDToClientID.at(serverParentID));
}
}
}
parseSpawnEvents();
@@ -371,6 +436,12 @@ void Client::disconnect()
bool Client::OnInputCommand(const Events::InputCommand & e)
{
// TEMP
if (e.Command == "SearchForServers" && e.Value > 0) {
Events::SearchForServers e;
m_EventBroker->Publish(e);
}
if (e.PlayerID != -1) {
return false;
}
@@ -415,6 +486,11 @@ bool Client::OnPlayerDamage(const Events::PlayerDamage & e)
if (e.Inflictor != m_LocalPlayer) {
return false;
}
// Could this happen?
//if (!clientServerMapsHasEntity(e.Inflictor.ID)
// || !clientServerMapsHasEntity(e.Victim.ID)) {
// return;
//}
Packet packet(MessageType::OnPlayerDamage, m_SendPacketID);
packet.WritePrimitive(m_ClientIDToServerID.at(e.Inflictor.ID));
@@ -433,12 +509,23 @@ bool Client::OnPlayerSpawned(const Events::PlayerSpawned& e)
return true;
}
bool Client::OnSearchForServers(const Events::SearchForServers& e)
{
m_SearchingForServers = true;
m_StartSearchTime = std::clock();
m_Serverlist.clear();
LOG_INFO("Searching for LAN servers...\n");
Packet packet(MessageType::ServerlistRequest);
m_ServerlistRequest.Broadcast(packet, 13); // TODO: Config
return true;
}
void Client::parsePlayerDamage(Packet& packet)
{
Events::PlayerDamage e;
PlayerID victimID = packet.ReadPrimitive<EntityID>();
PlayerID inflictorID = packet.ReadPrimitive<EntityID>();
if(!serverClientMapsHasEntity(victimID) || !serverClientMapsHasEntity(inflictorID)){
if (!serverClientMapsHasEntity(victimID) || !serverClientMapsHasEntity(inflictorID)) {
return;
}
e.Inflictor = EntityWrapper(m_World, m_ServerIDToClientID.at(victimID));
@@ -450,6 +537,17 @@ void Client::parsePlayerDamage(Packet& packet)
}
}
bool Client::OnDoubleJump(Events::DoubleJump & e)
{
if (!clientServerMapsHasEntity(e.entityID) || e.entityID != m_LocalPlayer.ID) {
return false;
}
Packet packet(MessageType::OnDoubleJump);
packet.WritePrimitive(m_ClientIDToServerID.at(e.entityID));
m_Reliable.Send(packet);
return true;
}
void Client::sendLocalPlayerTransform()
{
if (!m_LocalPlayer.Valid()) {
@@ -467,7 +565,7 @@ void Client::sendLocalPlayerTransform()
packet.WritePrimitive(orientation.x);
packet.WritePrimitive(orientation.y);
packet.WritePrimitive(orientation.z);
bool hasAssaultWeapon = m_LocalPlayer.HasComponent("AssaultWeapon");
packet.WritePrimitive(hasAssaultWeapon);
if (hasAssaultWeapon) {
@@ -475,7 +573,7 @@ void Client::sendLocalPlayerTransform()
packet.WritePrimitive((int)cAssaultWeapon["MagazineAmmo"]);
packet.WritePrimitive((int)cAssaultWeapon["Ammo"]);
}
m_Unreliable.Send(packet);
}
@@ -528,6 +626,16 @@ void Client::becomePlayer()
m_Reliable.Send(packet);
}
void Client::displayServerlist()
{
LOG_INFO("This is a serverlist:\n");
for (int i = 0; i < m_Serverlist.size(); i++) {
ServerInfo si = m_Serverlist[i];
LOG_INFO("%s:%i\t%s\t%i\n", si.Address.c_str(), si.Port, si.Name.c_str(), si.PlayersConnected);
}
}
bool Client::clientServerMapsHasEntity(EntityID clientEntityID)
{
if (m_ClientIDToServerID.find(clientEntityID) != m_ClientIDToServerID.end()) {
-10
View File
@@ -1,10 +0,0 @@
#include "Network/HybridClient.h"
HybridClient::HybridClient()
{
}
HybridClient::~HybridClient()
{
}
-9
View File
@@ -1,9 +0,0 @@
#include "Network/HybridServer.h"
HybridServer::HybridServer()
{
}
HybridServer::~HybridServer()
{
}
+11
View File
@@ -0,0 +1,11 @@
#include "Network/NetworkClient.h"
NetworkClient::NetworkClient()
{
m_ReadBuffer = new char[m_BufferSize];
}
NetworkClient::~NetworkClient()
{
delete[] m_ReadBuffer;
}
+11
View File
@@ -0,0 +1,11 @@
#include "Network/NetworkServer.h"
NetworkServer::NetworkServer()
{
m_ReadBuffer = new char[m_BufferSize];
}
NetworkServer::~NetworkServer()
{
delete[] m_ReadBuffer;
}
+112 -15
View File
@@ -1,7 +1,8 @@
#include "Network/Server.h"
Server::Server(World* world, EventBroker* eventBroker, int port)
Server::Server(World* world, EventBroker* eventBroker, int port)
: Network(world, eventBroker)
, m_ServerlistRequest(13)
{
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
snapshotInterval = 1000 * config->Get<float>("Networking.SnapshotInterval", 0.05f);
@@ -13,7 +14,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
// Bind
// BindWW
if (port == 0) {
port = config->Get<float>("Networking.Port", 27666);
}
@@ -28,9 +29,8 @@ Server::~Server()
void Server::Update()
{
PlayerDefinition pd;
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
for (auto& kv : m_ConnectedPlayers) {
while (kv.second.TCPSocket->available()) {
// Packet will get real data in receive
@@ -46,6 +46,7 @@ void Server::Update()
}
}
PlayerDefinition pd;
while (m_Unreliable.IsSocketAvailable()) {
// Packet will get real data in receive
Packet packet(MessageType::Invalid);
@@ -58,6 +59,22 @@ void Server::Update()
parseMessageType(packet);
}
}
while (m_ServerlistRequest.IsSocketAvailable()) {
Packet packet(MessageType::Invalid);
PlayerDefinition localArea;
localArea.Endpoint = boost::asio::ip::udp::endpoint();
m_ServerlistRequest.Receive(packet, localArea);
if (packet.GetMessageType() == MessageType::ServerlistRequest) {
packet.ReadPrimitive<int>(); // Pop size
packet.ReadPrimitive<int>(); // Pop MsgType
packet.ReadPrimitive<int>(); // Pop packet ID
int port = packet.ReadPrimitive<int>();
std::string address = localArea.Endpoint.address().to_string();
parseServerlistRequest(boost::asio::ip::udp::endpoint(boost::asio::ip::address().from_string(address), port));
}
}
// Check if players have disconnected
for (int i = 0; i < m_PlayersToDisconnect.size(); i++) {
disconnect(m_PlayersToDisconnect.at(i));
@@ -75,6 +92,7 @@ void Server::Update()
sendPing();
previousePingMessage = currentTime;
}
// Time out logic
if (checkTimeOutInterval < (1000 * (currentTime - timOutTimer) / (double)CLOCKS_PER_SEC)) {
checkForTimeOuts();
@@ -120,6 +138,9 @@ void Server::parseMessageType(Packet& packet)
case MessageType::PlayerTransform:
parsePlayerTransform(packet);
break;
case MessageType::OnDoubleJump:
parseDoubleJump(packet);
break;
default:
break;
}
@@ -146,7 +167,7 @@ void Server::sendSnapshot()
{
Packet packet(MessageType::Snapshot);
addInputCommandsToPacket(packet);
addChildrenToPacket(packet, EntityID_Invalid);
addPlayersToPacket(packet, EntityID_Invalid);
unreliableBroadcast(packet);
}
@@ -163,19 +184,61 @@ void Server::addInputCommandsToPacket(Packet& packet)
m_InputCommandsToBroadcast.clear();
}
void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
void Server::addPlayersToPacket(Packet & packet, EntityID entityID)
{
auto itPair = m_World->GetChildren(entityID);
auto itPair = m_World->GetDirectChildren(entityID);
std::unordered_map<std::string, ComponentPool*> worldComponentPools = m_World->GetComponentPools();
// Loop through every child
for (auto it = itPair.first; it != itPair.second; it++) {
EntityID childEntityID = it->second;
// HACK: Only sync players for now, since the map turned out to be TOO LARGE to send in one snapshot and Simon's computer shits itself
// HACK: Also checked CapturePointHUD for now. (this would get out of sync);
EntityWrapper childEntity(m_World, childEntityID);
if (!shouldSendToClient(childEntity)) {
continue;
if (shouldSendToClient(childEntity)) {
// Write EntityID and parentsID and Entity name
packet.WritePrimitive(childEntityID);
packet.WritePrimitive(entityID);
packet.WriteString(m_World->GetName(childEntityID));
// Write components to child
int numberOfComponents = 0;
for (auto& i : worldComponentPools) {
if (i.second->KnowsEntity(childEntityID)) {
numberOfComponents++;
}
}
// Write how many components should be read
packet.WritePrimitive(numberOfComponents);
for (auto& i : worldComponentPools) {
// If the entity exist in the pool
if (i.second->KnowsEntity(childEntityID)) {
ComponentWrapper componentWrapper = i.second->GetByEntity(childEntityID);
// ComponentType
packet.WriteString(componentWrapper.Info.Name);
// Loop through fields
for (auto& componentField : componentWrapper.Info.FieldsInOrder) {
ComponentInfo::Field_t fieldInfo = componentWrapper.Info.Fields.at(componentField);
if (fieldInfo.Type == "string") {
std::string& value = componentWrapper[componentField];
packet.WriteString(value);
} else {
packet.WriteData(componentWrapper.Data + fieldInfo.Offset, fieldInfo.Stride);
}
}
}
}
}
// Go to to your children
addPlayersToPacket(packet, childEntityID);
}
}
void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
{
auto itPair = m_World->GetDirectChildren(entityID);
std::unordered_map<std::string, ComponentPool*> worldComponentPools = m_World->GetComponentPools();
// Loop through every child
for (auto it = itPair.first; it != itPair.second; it++) {
EntityID childEntityID = it->second;
// Write EntityID and parentsID and Entity name
packet.WritePrimitive(childEntityID);
packet.WritePrimitive(entityID);
@@ -230,6 +293,8 @@ void Server::sendPing()
reliableBroadcast(packet);
}
void Server::checkForTimeOuts()
{
double startPing = 1000 * m_StartPingTime
@@ -279,7 +344,7 @@ void Server::parseTCPConnect(Packet & packet)
// Read packet ID
m_PreviousPacketID = m_PacketID; // Set previous packet id
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
LOG_INFO("Parsing connections");
// Check if player is already connected
// Ska vara till lagd i TCPServer receive
@@ -304,6 +369,11 @@ void Server::parseTCPConnect(Packet & packet)
connnectPacket.WritePrimitive(playerID);
m_Reliable.Send(connnectPacket);
Packet firstSnapshot(MessageType::Snapshot);
addInputCommandsToPacket(firstSnapshot);
addChildrenToPacket(firstSnapshot, EntityID_Invalid);
m_Reliable.Send(firstSnapshot);
// Send notification that a player has connected
//Packet notificationPacket(MessageType::PlayerConnected);
//broadcast(notificationPacket);
@@ -322,6 +392,17 @@ void Server::parseDisconnect()
}
}
void Server::parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint)
{
Packet packet(MessageType::ServerlistRequest);
packet.WriteString(m_Reliable.Address());
packet.WritePrimitive<int>(m_Reliable.Port());
packet.WriteString("SERVERNAME");
packet.WritePrimitive<int>(m_ConnectedPlayers.size());
m_ServerlistRequest.Send(packet);
}
void Server::disconnect(PlayerID playerID)
{
//broadcast("A player disconnected");
@@ -346,6 +427,7 @@ void Server::parseOnPlayerDamage(Packet & packet)
e.Victim = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
e.Damage = packet.ReadPrimitive<double>();
m_EventBroker->Publish(e);
//LOG_DEBUG("Server::parseOnPlayerDamage: Command is %s. Value is %f. PlayerID is %i.", e.DamageAmount, e.PlayerDamagedID, e.TypeOfDamage.c_str());
}
@@ -374,8 +456,7 @@ bool Server::OnInputCommand(const Events::InputCommand & e)
}
isReadingData = !isReadingData;
m_SaveDataTimer = std::clock();
}
if (e.Command == "KickPlayer" && e.Value > 0) {
} else if (e.Command == "KickPlayer" && e.Value > 0) {
kick(0);
}
@@ -426,7 +507,7 @@ bool Server::OnPlayerDamage(const Events::PlayerDamage& e)
packet.WritePrimitive(e.Damage);
reliableBroadcast(packet);
return false;
return true;
}
void Server::parseClientPing()
@@ -446,13 +527,21 @@ void Server::parsePing()
{
for (auto& kv : m_ConnectedPlayers) {
if (kv.second.TCPAddress == m_Address &&
kv.second.TCPPort == m_Port) {
kv.second.TCPPort == m_Port
|| (kv.second.Endpoint.address() == m_Address
&& kv.second.Endpoint.port() == m_Port)) {
kv.second.StopTime = std::clock();
break;
}
}
}
bool Server::parseDoubleJump(Packet & packet)
{
reliableBroadcast(packet);
return true;
}
void Server::parseOnInputCommand(Packet& packet)
{
PlayerID player = -1;
@@ -512,7 +601,15 @@ void Server::parsePlayerTransform(Packet& packet)
bool Server::shouldSendToClient(EntityWrapper childEntity)
{
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid();
auto children = m_World->GetDirectChildren(childEntity.ID);
for (auto it = children.first; it != children.second; it++) {
EntityWrapper child(m_World, it->second);
if(child.HasComponent("CapturePoint")) {
return true;
}
}
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid()
|| childEntity.HasComponent("CapturePoint");
}
PlayerID Server::GetPlayerIDFromEndpoint()
+19 -9
View File
@@ -56,32 +56,42 @@ void TCPClient::Disconnect()
void TCPClient::Receive(Packet& packet)
{
size_t bytesRead = readBuffer(m_ReadBuffer);
size_t bytesRead = readBuffer();
if (bytesRead > 0) {
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
}
}
size_t TCPClient::readBuffer(char* data)
size_t TCPClient::readBuffer()
{
if (!m_Socket) {
return 0;
}
boost::system::error_code error;
// Read size of packet
size_t bytesReceived = m_Socket->read_some(boost
::asio::buffer((void*)data, sizeof(int)),
error);
int sizeOfPacket = 0;
memcpy(&sizeOfPacket, data, sizeof(int));
m_Socket->receive(boost
::asio::buffer((void*)m_ReadBuffer, sizeof(int)),
boost::asio::ip::tcp::socket::message_peek, error);
unsigned int sizeOfPacket = 0;
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
// if the buffer is to small increase the size of it
// TODO if message is huge 1 time the buffer will not decrease.
if (sizeOfPacket > m_BufferSize) {
delete[] m_ReadBuffer;
m_ReadBuffer = new char[sizeOfPacket];
m_BufferSize = sizeOfPacket;
}
// Read the rest of the message
bytesReceived += m_Socket->read_some(boost
::asio::buffer((void*)(data + bytesReceived), sizeOfPacket - bytesReceived),
size_t bytesReceived = m_Socket->read_some(boost
::asio::buffer((void*)(m_ReadBuffer), sizeOfPacket),
error);
if (error) {
//LOG_ERROR("receive: %s", error.message().c_str());
}
if (sizeOfPacket > 1000000)
LOG_WARNING("The packets received are bigger than 1MB");
return bytesReceived;
}

Some files were not shown because too many files have changed in this diff Show More