Compare commits

...

11 Commits

Author SHA1 Message Date
Kayne Ruse c1ace69e19 Merge branch 'bug-hunting' 2015-04-28 06:04:06 +10:00
Kayne Ruse 5c404c572e Patched bug #45 without resolving it 2015-04-28 06:01:58 +10:00
Kayne Ruse 878d502b8b Looking for the bug 2015-04-27 01:35:14 +10:00
Kayne Ruse 2a1ee4acbf tmp 2015-04-26 03:29:33 +10:00
Kayne Ruse 0e149acc62 Pointless tweak 2015-04-26 03:24:25 +10:00
Kayne Ruse 63e4394583 I can't seem to pinpoint the cause 2015-04-26 03:11:00 +10:00
Kayne Ruse 7aeabf0d14 Hunting a strange networking bug 2015-04-26 02:14:26 +10:00
Kayne Ruse 9d5a668045 Merge branch 'develop', read more
The trigger system has been fully implemented, as well as a few other
tweaks as the occasional thought came to mind.

Multiple rooms are now fully functional, mostly as a way to test the
triggers. Although there are still no real generation algorithms, a
utility for creating door pairs between given rooms is included in the
scripts directory.

Other changes in this merge include:

* Network updates via lua
* Entity types can be determined in lua
* Database columns are now order independant

It should be noted that only two types of userdata will work as far as
entity names are concerned: Characters and Monsters. I tried getting it to
work for all objects passed to lua, but it proved to be too obtuse.

In theory, I could create a teleport puzzle using what I've written here.
That might be a side project, or a way to test saving & loading systems. I
don't see any reason to delay monsters any longer; hopefully, I can get
them going soon too.
2015-03-13 21:28:05 +11:00
Kayne Ruse 894b53e760 Merge branch 'develop' 2015-02-27 02:45:19 +11:00
Kayne Ruse eff23352aa Merge branch 'develop'
Changes:

* "ticking" rooms
* character API
* bare-bones character manager API
* bounds checking in serial_utility.cpp

I have an idea for swapping the existing utility/singleton classes for
namesapces, as I think this would reduce the verbosity that I have to deal
with.
2015-02-23 01:54:46 +11:00
Kayne Ruse fa4ccb6596 Merge branch 'develop' 2015-02-14 23:54:35 +11:00
8 changed files with 67 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
## Outline ## Outline
Tortuga is a 2D multiplayer JRPG featuring permadeath, with an emphasis on multiplayer cooperation, exploration and customization. The game runs on customizable public and private servers. Tortuga is a 2D MMORPG featuring permadeath, with an emphasis on multiplayer cooperation, exploration and customization. The game runs on customizable public and private servers.
This game is inspired by classic 2D RPGs (Final Fantasy, The Legend of Zelda), as well as more modern sandboxes amd MMOs (Minecraft, EVE Online). This project is currently independently created and funded, with the goal of creating a game that will engage the players and inspire a large community. This game is inspired by classic 2D RPGs (Final Fantasy, The Legend of Zelda), as well as more modern sandboxes amd MMOs (Minecraft, EVE Online). This project is currently independently created and funded, with the goal of creating a game that will engage the players and inspire a large community.
+15 -2
View File
@@ -125,8 +125,16 @@ void World::Update() {
it.second.Update(); it.second.Update();
} }
//update the map try {
UpdateMap(); //update the map
UpdateMap();
}
catch(terminal_error& e) {
throw(e);
}
catch(std::exception& e) {
std::cerr << "UpdateMap Error: " << e.what() << std::endl;
}
//skip the rest without a local character //skip the rest without a local character
if (!localCharacter) { if (!localCharacter) {
@@ -162,6 +170,11 @@ void World::Render(SDL_Surface* const screen) {
//draw the map //draw the map
for (std::list<Region>::iterator it = regionPager.GetContainer()->begin(); it != regionPager.GetContainer()->end(); it++) { for (std::list<Region>::iterator it = regionPager.GetContainer()->begin(); it != regionPager.GetContainer()->end(); it++) {
tileSheet.DrawRegionTo(screen, &(*it), camera.x, camera.y); tileSheet.DrawRegionTo(screen, &(*it), camera.x, camera.y);
//debugging
// std::ostringstream msg;
// msg << it->GetX() << ", " << it->GetY();
// font.DrawStringTo(msg.str(), screen, it->GetX() * tileSheet.GetImage()->GetClipW() - camera.x, it->GetY() * tileSheet.GetImage()->GetClipH() - camera.y);
} }
//draw the entities //draw the entities
+40 -1
View File
@@ -23,6 +23,24 @@
#include "channels.hpp" #include "channels.hpp"
#include <sstream>
//-------------------------
//static functions
//-------------------------
static int regionChecksum(Region* const region) {
int sum = 0;
for(int i = 0; i < REGION_WIDTH; i++) {
for (int j = 0; j < REGION_HEIGHT; j++) {
for (int k = 0; k < REGION_DEPTH; k++) {
sum += region->GetTile(i, j, k);
}
}
}
return sum;
}
//------------------------- //-------------------------
//map management //map management
//------------------------- //-------------------------
@@ -40,6 +58,13 @@ void World::SendRegionRequest(int roomIndex, int x, int y) {
} }
void World::hRegionContent(RegionPacket* const argPacket) { void World::hRegionContent(RegionPacket* const argPacket) {
//checksum
if (regionChecksum(argPacket->region) == 0) {
std::ostringstream msg;
msg << "Received region checksum failed: " << argPacket->x << ", " << argPacket->y;
throw(std::runtime_error(msg.str()));
}
//replace existing regions //replace existing regions
regionPager.UnloadIf([&](Region const& region) -> bool { regionPager.UnloadIf([&](Region const& region) -> bool {
return region.GetX() == argPacket->x && region.GetY() == argPacket->y; return region.GetX() == argPacket->x && region.GetY() == argPacket->y;
@@ -71,9 +96,23 @@ void World::UpdateMap() {
//request empty regions within this zone //request empty regions within this zone
for (int i = xStart; i <= xEnd; i += REGION_WIDTH) { for (int i = xStart; i <= xEnd; i += REGION_WIDTH) {
for (int j = yStart; j <= yEnd; j += REGION_HEIGHT) { for (int j = yStart; j <= yEnd; j += REGION_HEIGHT) {
if (!regionPager.FindRegion(i, j)) { Region* region = regionPager.FindRegion(i, j);
if (!region) {
//request absent region
SendRegionRequest(roomIndex, i, j); SendRegionRequest(roomIndex, i, j);
} }
else if (regionChecksum(region) == 0) {
//checksum failed
//NOTE: this patches bug #45, but does not resolve it
regionPager.UnloadIf([region](Region const& ref) -> bool {
//remove the erroneous region
return region == &ref;
});
SendRegionRequest(roomIndex, i, j);
std::ostringstream msg;
msg << "Existing region checksum failed: " << roomIndex << ", " << i << ", " << j;
throw(std::runtime_error(msg.str()));
}
} }
} }
} }
+1
View File
@@ -70,6 +70,7 @@ Region* RegionPagerBase::FindRegion(int x, int y) {
} }
Region* RegionPagerBase::PushRegion(Region* const ptr) { Region* RegionPagerBase::PushRegion(Region* const ptr) {
//BUG: #45 Some regions are occasionally losing their tile data
regionList.push_front(*ptr); regionList.push_front(*ptr);
return &regionList.front(); return &regionList.front();
} }
+6
View File
@@ -65,6 +65,9 @@ end
--custom generation systems here --custom generation systems here
function mapMaker.DebugIsland(r) function mapMaker.DebugIsland(r)
--debug
io.write("map_maker:DebugIsland(", regionAPI.GetX(r), ", ", regionAPI.GetY(r), ")\n")
--basic distance check for each tile, placing an island around the world origin --basic distance check for each tile, placing an island around the world origin
for i = 1, regionAPI.GetWidth(r) do for i = 1, regionAPI.GetWidth(r) do
for j = 1, regionAPI.GetHeight(r) do for j = 1, regionAPI.GetHeight(r) do
@@ -95,6 +98,9 @@ function mapMaker.DebugIsland(r)
end end
function mapMaker.DebugGrassland(r) function mapMaker.DebugGrassland(r)
--debug
io.write("map_maker:DebugGrassland(", regionAPI.GetX(r), ", ", regionAPI.GetY(r), ")\n")
--all dirt --all dirt
for i = 1, regionAPI.GetWidth(r) do for i = 1, regionAPI.GetWidth(r) do
for j = 1, regionAPI.GetHeight(r) do for j = 1, regionAPI.GetHeight(r) do
+2 -2
View File
@@ -4,11 +4,11 @@ local mapSaver = {}
function mapSaver.Load(r) function mapSaver.Load(r)
--empty --empty
io.write("map_saver:Load(", region.GetX(r), ", ", region.GetY(r), ")\n") -- io.write("map_saver:Load(", region.GetX(r), ", ", region.GetY(r), ")\n")
end end
function mapSaver.Save(r) function mapSaver.Save(r)
--empty --empty
io.write("map_saver:Save(", region.GetX(r), ", ", region.GetY(r), ")\n") -- io.write("map_saver:Save(", region.GetX(r), ", ", region.GetY(r), ")\n")
end end
--TODO: (3) create a flexible saving & loading system --TODO: (3) create a flexible saving & loading system
+1 -1
View File
@@ -31,6 +31,6 @@ local underworld, uidTwo = roomManagerAPI.CreateRoom("underworld", "overworld.bm
roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrassland, mapSaver.Save) roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrassland, mapSaver.Save)
--call the monstrosity --call the monstrosity
doorUtility.createDoorPair("pair 1", overworld, 0, -64, underworld, 0, 0) doorUtility.createDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64)
print("Finished the lua script") print("Finished the lua script")
+1
View File
@@ -26,6 +26,7 @@
#include <stack> #include <stack>
#include <stdexcept> #include <stdexcept>
//TODO: (9) character collisions should be preformed client-side
void RoomData::RunFrame() { void RoomData::RunFrame() {
//get the hook //get the hook
lua_rawgeti(lua, LUA_REGISTRYINDEX, tickRef); lua_rawgeti(lua, LUA_REGISTRYINDEX, tickRef);