added and commented out some debug output

This commit is contained in:
Perttu Ahola 2011-06-26 03:14:52 +03:00
parent bb940a946d
commit c1ceabef71
4 changed files with 110 additions and 73 deletions

@ -135,6 +135,15 @@ void * MeshUpdateThread::Thread()
while(getRun()) while(getRun())
{ {
/*// Wait for output queue to flush.
// Allow 2 in queue, this makes less frametime jitter.
// Umm actually, there is no much difference
if(m_queue_out.size() >= 2)
{
sleep_ms(3);
continue;
}*/
QueuedMeshUpdate *q = m_queue_in.pop(); QueuedMeshUpdate *q = m_queue_in.pop();
if(q == NULL) if(q == NULL)
{ {
@ -794,22 +803,10 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
MapSector *sector; MapSector *sector;
MapBlock *block; MapBlock *block;
{ //envlock
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
v2s16 p2d(p.X, p.Z); v2s16 p2d(p.X, p.Z);
sector = m_env.getMap().emergeSector(p2d); sector = m_env.getMap().emergeSector(p2d);
v2s16 sp = sector->getPos(); assert(sector->getPos() == p2d);
if(sp != p2d)
{
dstream<<"ERROR: Got sector with getPos()="
<<"("<<sp.X<<","<<sp.Y<<"), tried to get"
<<"("<<p2d.X<<","<<p2d.Y<<")"<<std::endl;
}
assert(sp == p2d);
//assert(sector->getPos() == p2d);
//TimeTaker timer("MapBlock deSerialize"); //TimeTaker timer("MapBlock deSerialize");
// 0ms // 0ms
@ -843,7 +840,6 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
block->setTempMod(v3s16(8,7,8), mod); block->setTempMod(v3s16(8,7,8), mod);
block->setTempMod(v3s16(8,6,8), mod);*/ block->setTempMod(v3s16(8,6,8), mod);*/
} }
} //envlock
#if 0 #if 0
/* /*
@ -876,6 +872,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
/* /*
Add it to mesh update queue and set it to be acknowledged after update. Add it to mesh update queue and set it to be acknowledged after update.
*/ */
//std::cerr<<"Adding mesh update task for received block"<<std::endl;
addUpdateMeshTaskWithEdge(p, true); addUpdateMeshTaskWithEdge(p, true);
} }
else if(command == TOCLIENT_PLAYERPOS) else if(command == TOCLIENT_PLAYERPOS)
@ -2127,7 +2124,8 @@ void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server)
{ {
//TimeTaker timer("data fill"); //TimeTaker timer("data fill");
// 0ms // Release: ~0ms
// Debug: 1-6ms, avg=2ms
data->fill(getDayNightRatio(), b); data->fill(getDayNightRatio(), b);
} }
@ -2153,6 +2151,10 @@ void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server)
} }
#endif #endif
/*
Mark mesh as non-expired at this point so that it can already
be marked as expired again if the data changes
*/
b->setMeshExpired(false); b->setMeshExpired(false);
} }

@ -42,6 +42,7 @@ void set_default_settings()
g_settings.setDefault("keymap_rangeselect", "KEY_KEY_R"); g_settings.setDefault("keymap_rangeselect", "KEY_KEY_R");
g_settings.setDefault("keymap_freemove", "KEY_KEY_K"); g_settings.setDefault("keymap_freemove", "KEY_KEY_K");
g_settings.setDefault("keymap_fastmove", "KEY_KEY_J"); g_settings.setDefault("keymap_fastmove", "KEY_KEY_J");
g_settings.setDefault("keymap_frametime_graph", "KEY_F1");
// Some (temporary) keys for debugging // Some (temporary) keys for debugging
g_settings.setDefault("keymap_special1", "KEY_KEY_E"); g_settings.setDefault("keymap_special1", "KEY_KEY_E");
g_settings.setDefault("keymap_print_debug_stacks", "KEY_KEY_P"); g_settings.setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
@ -83,6 +84,7 @@ void set_default_settings()
g_settings.setDefault("objectdata_interval", "0.2"); g_settings.setDefault("objectdata_interval", "0.2");
g_settings.setDefault("active_object_range", "2"); g_settings.setDefault("active_object_range", "2");
//g_settings.setDefault("max_simultaneous_block_sends_per_client", "1"); //g_settings.setDefault("max_simultaneous_block_sends_per_client", "1");
// This causes frametime jitter on client side, or does it?
g_settings.setDefault("max_simultaneous_block_sends_per_client", "2"); g_settings.setDefault("max_simultaneous_block_sends_per_client", "2");
g_settings.setDefault("max_simultaneous_block_sends_server_total", "8"); g_settings.setDefault("max_simultaneous_block_sends_server_total", "8");
g_settings.setDefault("max_block_send_distance", "8"); g_settings.setDefault("max_block_send_distance", "8");

@ -940,6 +940,8 @@ void the_game(
while(device->run() && kill == false) while(device->run() && kill == false)
{ {
//std::cerr<<"frame"<<std::endl;
if(g_gamecallback->disconnect_requested) if(g_gamecallback->disconnect_requested)
{ {
g_gamecallback->disconnect_requested = false; g_gamecallback->disconnect_requested = false;
@ -1221,6 +1223,19 @@ void the_game(
chat_lines.push_back(ChatLine(L"fast_move enabled")); chat_lines.push_back(ChatLine(L"fast_move enabled"));
} }
} }
else if(input->wasKeyDown(getKeySetting("keymap_frametime_graph")))
{
if(g_settings.getBool("frametime_graph"))
{
g_settings.set("frametime_graph","false");
chat_lines.push_back(ChatLine(L"frametime_graph disabled"));
}
else
{
g_settings.set("frametime_graph","true");
chat_lines.push_back(ChatLine(L"frametime_graph enabled"));
}
}
// Item selection with mouse wheel // Item selection with mouse wheel
{ {

@ -1657,7 +1657,13 @@ void Server::AsyncRunStep()
*/ */
{ {
// Don't send too many at a time // Don't send too many at a time
u32 count = 0; //u32 count = 0;
// Single change sending is disabled if queue size is not small
bool disable_single_change_sending = false;
if(m_unsent_map_edit_queue.size() >= 4)
disable_single_change_sending = true;
while(m_unsent_map_edit_queue.size() != 0) while(m_unsent_map_edit_queue.size() != 0)
{ {
MapEditEvent* event = m_unsent_map_edit_queue.pop_front(); MapEditEvent* event = m_unsent_map_edit_queue.pop_front();
@ -1670,12 +1676,20 @@ void Server::AsyncRunStep()
if(event->type == MEET_ADDNODE) if(event->type == MEET_ADDNODE)
{ {
dstream<<"Server: MEET_ADDNODE"<<std::endl; dstream<<"Server: MEET_ADDNODE"<<std::endl;
if(disable_single_change_sending)
sendAddNode(event->p, event->n, event->already_known_by_peer,
&far_players, 5);
else
sendAddNode(event->p, event->n, event->already_known_by_peer, sendAddNode(event->p, event->n, event->already_known_by_peer,
&far_players, 30); &far_players, 30);
} }
else if(event->type == MEET_REMOVENODE) else if(event->type == MEET_REMOVENODE)
{ {
dstream<<"Server: MEET_REMOVENODE"<<std::endl; dstream<<"Server: MEET_REMOVENODE"<<std::endl;
if(disable_single_change_sending)
sendRemoveNode(event->p, event->already_known_by_peer,
&far_players, 5);
else
sendRemoveNode(event->p, event->already_known_by_peer, sendRemoveNode(event->p, event->already_known_by_peer,
&far_players, 30); &far_players, 30);
} }
@ -1698,13 +1712,16 @@ void Server::AsyncRunStep()
/* /*
Set blocks not sent to far players Set blocks not sent to far players
*/ */
if(far_players.size() > 0)
{
core::map<v3s16, MapBlock*> modified_blocks2; core::map<v3s16, MapBlock*> modified_blocks2;
for(core::map<v3s16, bool>::Iterator for(core::map<v3s16, bool>::Iterator
i = event->modified_blocks.getIterator(); i = event->modified_blocks.getIterator();
i.atEnd()==false; i++) i.atEnd()==false; i++)
{ {
v3s16 p = i.getNode()->getKey(); v3s16 p = i.getNode()->getKey();
modified_blocks2.insert(p, m_env.getMap().getBlockNoCreateNoEx(p)); modified_blocks2.insert(p,
m_env.getMap().getBlockNoCreateNoEx(p));
} }
for(core::list<u16>::Iterator for(core::list<u16>::Iterator
i = far_players.begin(); i = far_players.begin();
@ -1716,13 +1733,14 @@ void Server::AsyncRunStep()
continue; continue;
client->SetBlocksNotSent(modified_blocks2); client->SetBlocksNotSent(modified_blocks2);
} }
}
delete event; delete event;
// Don't send too many at a time /*// Don't send too many at a time
count++; count++;
if(count >= 1 && m_unsent_map_edit_queue.size() < 100) if(count >= 1 && m_unsent_map_edit_queue.size() < 100)
break; break;*/
} }
} }