diff --git a/README.md b/README.md index ab16447..a215a4e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ -The most recent stable windows build can be found [here](https://dl.dropboxusercontent.com/u/46669050/Tortuga.rar). +The most recent stable build for Windows can be found [here](https://dl.dropboxusercontent.com/u/46669050/Tortuga.rar). -Tortuga is an open source 2D multiplayer role playing game featuring permadeath (deletion of a character upon death). The emphasis of this game is on multiplayer cooperation, competition, exploration and customization. The game runs on customizable server software that can support up to 150 simultaneous players or more. +Tortuga is a 2D multiplayer JRPG featuring permadeath (deletion of a character upon death). The emphasis of this game is on multiplayer cooperation, exploration and customization. The game runs on customizable server software that can support up to 150 simultaneous players or more. This game is inspired by classic 2D RPGs, as well as more modern sandbox MMOs. This project is currently independently created and funded, with the goal of creating a game that will engage user's imagination and inspire a large modding community. +## Documentation + +Tortuga's full documentation can be found in a separate branch, see [Tortuga/docs](https://github.com/Ratstail91/Tortuga/tree/docs). +For Tortuga's primary documentation, please read the [Tortuga Game Design Document](https://github.com/Ratstail91/Tortuga/blob/docs/Tortuga%20Game%20Design%20Document.docx?raw=true). + ## External Dependencies * [SDL 1.2](http://www.libsdl.org/) - Simple DirectMedia Layer API @@ -11,13 +16,10 @@ This game is inspired by classic 2D RPGs, as well as more modern sandbox MMOs. T * [lua 5.2](http://www.lua.org/) - The lua programming language * [SQLite3](http://www.sqlite.org/) - A lightweight SQL database engine -## Documentation - -[Tortuga Game Design Document](https://github.com/Ratstail91/Tortuga/blob/docs/design%20doc.docx?raw=true) -[Tortuga Technical Document](https://github.com/Ratstail91/Tortuga/blob/docs/technical%20doc.docx?raw=true) - ## Copyright +(Future versions (to be determined) may be released under a modified version of the [Uplink Developer's License](http://www.introversion.co.uk/uplink/developer/license.html).) + The current version of Tortuga is released under the [zlib license](http://en.wikipedia.org/wiki/Zlib_License). Copyright (c) 2013, 2014 Kayne Ruse diff --git a/rsc/scripts/setup_server.lua b/rsc/scripts/setup_server.lua index 16b7627..8629320 100644 --- a/rsc/scripts/setup_server.lua +++ b/rsc/scripts/setup_server.lua @@ -1,4 +1,8 @@ -print("Lua script check OK (./rsc)") +print("Lua script check (./rsc)") + +------------------------- +--Map API overrides +------------------------- function map.create(region) for i = 1, map.getregionwidth() do @@ -16,12 +20,17 @@ function map.unload(region) -- end ---return true if file loaded, otherwise return false function map.load(region, dir) - -- + --return true if file loaded, otherwise return false return false end function map.save(region, dir) -- end + +------------------------- +--Enemy API +------------------------- + +--TODO \ No newline at end of file diff --git a/rsc/scripts/setup_server.sql b/rsc/scripts/setup_server.sql index 7a84df0..1167c3c 100644 --- a/rsc/scripts/setup_server.sql +++ b/rsc/scripts/setup_server.sql @@ -71,6 +71,7 @@ CREATE TABLE IF NOT EXISTS PlayerCharacters ( defence INTEGER DEFAULT 0, intelligence INTEGER DEFAULT 0, resistance INTEGER DEFAULT 0, + speed INTEGER DEFAULT 0, accuracy REAL DEFAULT 0.0, evasion REAL DEFAULT 0.0, luck REAL DEFAULT 0.0, diff --git a/server/character_data.hpp b/server/character_data.hpp index 0442483..2db2bb0 100644 --- a/server/character_data.hpp +++ b/server/character_data.hpp @@ -38,9 +38,8 @@ struct CharacterData { int mapIndex = 0; Vector2 position = {0.0,0.0}; Vector2 motion = {0.0,0.0}; - BBox bbox = {0,0,0,0}; - //statistics + //base statistics int level = 0; int exp = 0; int maxHP = 0; @@ -51,9 +50,22 @@ struct CharacterData { int defence = 0; int intelligence = 0; int resistance = 0; + int speed = 0; float accuracy = 0.0; float evasion = 0.0; float luck = 0.0; + + //TODO: equipment + //TODO: items + //TODO: buffs + //TODO: debuffs + + //active gameplay members + //NOTE: these are lost when unloaded + BBox bbox = {0,0,0,0}; + bool inCombat = false; + int atbGauge = 0; + //TODO: stored command }; #endif diff --git a/server/character_management.cpp b/server/character_management.cpp index 74209bf..58fb6b2 100644 --- a/server/character_management.cpp +++ b/server/character_management.cpp @@ -131,9 +131,10 @@ int ServerApplication::LoadCharacter(int owner, std::string handle, std::string newChar.defence = sqlite3_column_int(statement, 15); newChar.intelligence = sqlite3_column_int(statement, 16); newChar.resistance = sqlite3_column_int(statement, 17); - newChar.accuracy = sqlite3_column_double(statement, 18); - newChar.evasion = sqlite3_column_double(statement, 19); - newChar.luck = sqlite3_column_double(statement, 20); + newChar.speed = sqlite3_column_int(statement, 18); + newChar.accuracy = sqlite3_column_double(statement, 19); + newChar.evasion = sqlite3_column_double(statement, 20); + newChar.luck = sqlite3_column_double(statement, 21); //TODO: equipment diff --git a/server/combat_data.hpp b/server/combat_data.hpp new file mode 100644 index 0000000..df75325 --- /dev/null +++ b/server/combat_data.hpp @@ -0,0 +1,52 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef COMBATDATA_HPP_ +#define COMBATDATA_HPP_ + +#include "vector2.hpp" +#include "bbox.hpp" + +#include "character_data.hpp" +#include "enemy_data.hpp" + +#include +#include + +struct CombatData { + typedef std::chrono::steady_clock Clock; + + //combatants + std::list characterList; + std::list enemyList; + + //world interaction + int mapIndex = 0; + Vector2 position = {0.0,0.0}; + BBox bbox = {0,0,0,0}; + + //time interval + Clock::time_point lastTick = Clock::now(); + + static int uidCounter; +}; + +#endif diff --git a/server/enemy_data.hpp b/server/enemy_data.hpp new file mode 100644 index 0000000..4d562fb --- /dev/null +++ b/server/enemy_data.hpp @@ -0,0 +1,59 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef ENEMYDATA_HPP_ +#define ENEMYDATA_HPP_ + +#include + +struct EnemyData { + //metadata + std::string handle; + std::string avatar; + + //statistics + int level = 0; + int exp = 0; + int maxHP = 0; + int health = 0; + int maxMP = 0; + int mana = 0; + int attack = 0; + int defence = 0; + int intelligence = 0; + int resistance = 0; + int speed = 0; + float accuracy = 0.0; + float evasion = 0.0; + float luck = 0.0; + + //TODO: equipment + //TODO: items + //TODO: buffs + //TODO: debuffs + + //active gameplay members + //NOTE: these are lost when unloaded + int tableIndex; + int atbGauge = 0; +}; + +#endif diff --git a/server/enemy_factory_generic.cpp b/server/enemy_factory_generic.cpp new file mode 100644 index 0000000..e8dd647 --- /dev/null +++ b/server/enemy_factory_generic.cpp @@ -0,0 +1,34 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "enemy_factory_generic.hpp" + +EnemyFactoryGeneric::EnemyFactoryGeneric() : EnemyFactoryInterface() { + //EMPTY +} + +EnemyFactoryGeneric::~EnemyFactoryGeneric() noexcept { + //EMPTY +} + +void EnemyFactoryGeneric::Generate(std::list* container) { + //TODO: fill this out +} \ No newline at end of file diff --git a/server/enemy_factory_generic.hpp b/server/enemy_factory_generic.hpp new file mode 100644 index 0000000..5a63078 --- /dev/null +++ b/server/enemy_factory_generic.hpp @@ -0,0 +1,42 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef ENEMYFACTORYGENERIC_HPP_ +#define ENEMYFACTORYGENERIC_HPP_ + +#include "enemy_factory_interface.hpp" + +#include "enemy_data.hpp" + +#include + +//DOCS: Not really intended for use, but rather for copying and tweaking +class EnemyFactoryGeneric : public EnemyFactoryInterface { +public: + EnemyFactoryGeneric(); + ~EnemyFactoryGeneric() noexcept override; + + void Generate(std::list* container) override; +private: + //TODO: hold the parameters specified by the room +}; + +#endif diff --git a/server/enemy_factory_interface.hpp b/server/enemy_factory_interface.hpp new file mode 100644 index 0000000..bceedf5 --- /dev/null +++ b/server/enemy_factory_interface.hpp @@ -0,0 +1,56 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef ENEMYFACTORYINTERFACE_HPP_ +#define ENEMYFACTORYINTERFACE_HPP_ + +#include "enemy_data.hpp" + +#include + +//TODO: move this elsewhere +enum RoomType { + OVERWORLD, + RUINS, + TOWERS, + FORESTS, + CAVES, +}; + +//NOTE: Based on biome, world difficulty, etc. +class EnemyFactoryInterface { +public: + EnemyFactoryInterface() = default; + virtual ~EnemyFactoryInterface() = default; + + virtual void Generate(std::list* container) = 0; + + //control the difficulty of the room + RoomType SetType(RoomType t) { return type = t; } + int SetDifficulty(int d) { return difficulty = d; } + RoomType GetType() { return type; } + int GetDifficulty() { return difficulty; } +protected: + RoomType type; + int difficulty; +}; + +#endif diff --git a/server/server_application.hpp b/server/server_application.hpp index 0b93372..398c8b4 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -26,6 +26,8 @@ #include "client_data.hpp" #include "account_data.hpp" #include "character_data.hpp" +#include "combat_data.hpp" +#include "enemy_factory_generic.hpp" //maps #include "map_allocator.hpp" @@ -51,6 +53,7 @@ #include //The main application class +//TODO: modulate this god class class ServerApplication { public: //standard functions @@ -84,14 +87,14 @@ private: void UnloadUserAccount(int uid); void DeleteUserAccount(int uid); - //TODO: character management + //character management int CreateCharacter(int owner, std::string handle, std::string avatar); int LoadCharacter(int owner, std::string handle, std::string avatar); int SaveCharacter(int uid); void UnloadCharacter(int uid); void DeleteCharacter(int uid); - //TODO: combat systems + //TODO: combat management //APIs UDPNetworkUtility network; @@ -102,11 +105,13 @@ private: std::map clientMap; std::map accountMap; std::map characterMap; + std::map combatMap; //maps //TODO: I need to handle multiple map objects //TODO: Unload regions that are distant from any characters RegionPager regionPager; + EnemyFactoryGeneric enemyFactory; //misc bool running = true; diff --git a/server/server_internals.cpp b/server/server_internals.cpp index c2b83c1..abd16e8 100644 --- a/server/server_internals.cpp +++ b/server/server_internals.cpp @@ -32,6 +32,7 @@ //------------------------- int ClientData::uidCounter = 0; +int CombatData::uidCounter = 0; //------------------------- //Define the public members diff --git a/todo.txt b/todo.txt deleted file mode 100644 index c37d3e4..0000000 --- a/todo.txt +++ /dev/null @@ -1,39 +0,0 @@ -* I need to keep the documentation up to date. Namely, the GDD is getting out of date. -* How many lookups is the map system using? -* Add the serial packet to the network utility - ---Naming conventions-- - -I need to define the differences between several different terms i.e. naming conventions. -I may also need to rewrite some variable names. - -* User: This is the individual who is playing the game -* Player: A synonym for a user -* Character: This is the actual player character in the game -* Username: This is the name of the player; ususally kept private -* Handle: This is the name of a character -* Avatar: This is the name of the sprite used by a character - ---ServerApplication's methods-- - -These interact with the database file, making the server a persistent system. - -* CreateUserAccount -* LoadUserAccount -* SaveUserAccount -* UnloadUserAccount -* DeleteUserAccount - -* CreateCharacter -* LoadCharacter -* SaveCharacter -* UnloadCharacter -* DeleteCharacter - ---Battle System-- - -CombatPortal: - x, y - list - list - //... \ No newline at end of file