diff options
-rw-r--r-- | doc/TODO | 23 | ||||
-rw-r--r-- | doc/manual.html | 94 | ||||
-rw-r--r-- | src/audio/audio.cc | 14 | ||||
-rw-r--r-- | src/client/client.cc | 20 | ||||
-rw-r--r-- | src/client/view.cc | 47 | ||||
-rw-r--r-- | src/game/ship.cc | 2 |
6 files changed, 149 insertions, 51 deletions
@@ -1,20 +1,21 @@ TODO -milestone 1: +version 0.1: fix turning (needs more testing) fix cl_prediction (or not) fix autolevel + zone/entity network interaction - add impulse drive -milestone 2: - zones +version 0.2: + + docking targetting system server-client event system, hit-once lightweight entities explosion events weapons fire events -milestone 3: +version 0.3: gui filesystem: @@ -60,10 +61,14 @@ network: rcon authentication, rcon command, servers must be able to disable rcon zone changes - send clients only updates from the current zone + send clients only updates from the current zone/server-side distance check fix lag/client interpolation rename cl_prediction to cl_interpolation detect and disconnect clients behaving badly + EXT messages, update extended property "ext id prop value prop value etc", type checking/serperator etc.. + EXT zone/color/shield/armor/health + round thrust/speed on 1/100, location on 1/1000 before send + stable ent/die client: console chars (ok) @@ -79,6 +84,8 @@ client: view_next, view_prev (ok) mouse select on release event while + tracking camera absolute speed + visual feedback on impulse drive render: render pipeline (ok) @@ -102,13 +109,13 @@ sound: enitity/event positional sounds game: + add impulse drive (ok) + implement player credits entity health/shield/armor gui concept artwork docking jumpgates (required docking) - fix autolevel - impulse drive win32 port: network not functional (ok) diff --git a/doc/manual.html b/doc/manual.html index 494b29f..3284797 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -15,10 +15,13 @@ Client </h2> <p> - Starting the client will show the loader screen. - To start the game, open the client console with the ~ key and type <i>connect</i>. - You will join the game as spectator, type <i>join</i> in the console - to join the game. Type <i>spectate</i> to spectate again. + Starting the client will show the loader screen and open + the client console. The console will stay open until you are connected + to a game. After that, you can close it and open it again with the ESC key. +<p> + Type <i>connect</i> and press Enter. You will join the game as + spectator, type <i>join</i> in the console to join the game. + Type <i>spectate</i> to spectate again. Type <i>disconnect</i> to return to the loader screen. <p> The client is capable of acting as a networked server. You can enable @@ -53,19 +56,23 @@ bind p screenshot <p> The default configuration: <table> - <tr><td>~ + <tr><td>ESC or ` </td><td>toggle console </td></tr> - <tr><td>V - </td><td>switch between track, cockpit and free view + <tr><td>v + </td><td>next camera view + </td></tr> + + <tr><td>shift+v + </td><td>previous camera view </td></tr> <tr><td>space bar </td><td>toggle mouse control on or off </td></tr> - <tr><td>left right up down arrow + <tr><td>arrow left right up down </td><td>rotate camera in free view </td></tr> @@ -81,8 +88,20 @@ bind p screenshot </td><td>increase/decrease forward thruster </td></tr> - <tr><td>T - </td><td>open the chat window + <tr><td>tab + </td><td>kinetic impulse drive control + </td></tr> + + <tr><td>n + </td><td>Select next target + </td></tr> + + <tr><td>shift+n + </td><td>Select previous target + </td></tr> + + <tr><td>t + </td><td>Open the chat window </td></tr> <tr><td>print screen @@ -93,11 +112,10 @@ bind p screenshot Mouse </h2> <p> - If mouse control is on, you can use it to steer your vessel - in track or cockpit view, or to rotate the camera in free view. -<p> - If mouse control is disabled, you can temporarily enable it again - by pressing the left mouse button. + If you have choosen Track or cockpit view and mouse control is actived, + you can use it to steer your vessel. In Free view mode, the mouse will rotate + the camera. If mouse control it is deactived, you can temporarily activate + it by pressing the left mouse button. <p> Use the scroll wheel to increase/decrease thruster. <p> @@ -115,7 +133,7 @@ Console functions <tr><td class="wide">list_model</td><td>list registered models</td></tr> <tr><td class="wide">list_var</td><td>list registered variables</td></tr> <tr><td class="wide">quit</td><td>exit the application</td></tr> - <tr><td class="wide">r_restart </td><td>restart the video subsystem</td></tr> + <tr><td class="wide">r_restart</td><td>restart the video subsystem</td></tr> </table> <p> The following commands are available when you are connected to a game: @@ -123,18 +141,40 @@ Console functions <tr><td class="wide">join</td><td>join the game</td></tr> <tr><td class="wide">spectate</td><td>spectate</td></tr> <tr><td class="wide">buy</td><td>purchase a new ship</td></tr> + <tr><td class="wide">jump</td><td>active the hyperspace jump drive</td> + <tr><td class="wide">impulse</td><td>active the kinetic impulse drive</td> <tr><td class="wide">who</td><td>list connected players</td></tr> </table> <p> - To change the video resolution, set the r_width and - r_height variables and execute r_restart. + This list is far from complete. The <i>list_func</i> function will print + all available functions with a short description. +<h2> + Configuration variables +</h2> +<p> + A lot of settings can be changed through configuration variables. + The <i>list_var</i> function will print all available variables with + a short discription. To change the value of a variable, type its name + followed by the new value. +<p> + e.g.: to disable rendering of the sky: +<pre> + r_sky 0 +</pre> +<p> + to enable it again: +<pre> + r_sky 1 +</pre> +<p> + To change the video resolution, set the r_width and r_height variables and execute r_restart. e.g.: to set the video mode to 1024x768 type: <pre> r_width 1024 r_height 768 r_restart </pre> -<p></p> +<p> To switch to fullscreen mode, set the r_fullscreen variable to 1: <pre> @@ -162,16 +202,16 @@ draw_stats 1 <p> This will draw the following statistics on the right side of the screen: - - fps frames per second - tris number of triangles drawn - quads number of quads drawn - tx network upstream traffic, in kilobytes - rx network downstream traffic, in kilobyte +<pre> +fps average framerate, frames per second +tris number of triangles +quads number of quads +net average network traffic, bytes per second +</pre> <p> - The fps counter will not show values above 9999. + The framerate is capped at around 1000 frames per second. <h2> - Configuration + Configuration files </h2> <p> Variables marked with the 'A' flag will be archived, their value diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 94f4d23..50d15c8 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -30,6 +30,14 @@ void init() // create the audio context audio_context = alcCreateContext(audio_device ,0); + + if (!audio_context) { + alcCloseDevice(audio_device); + audio_device = 0; + con_warn << "Could not create audio context!"; + return; + } + alcMakeContextCurrent(audio_context); // clear errors @@ -100,6 +108,9 @@ void play(const char *name) void update_source(size_t source_index, math::Vector3f const & location, math::Vector3f const & velocity, float pitch, float gain) { + if (!audio_context) + return; + ALuint source = Sources::source(source_index); alSourcefv(source, AL_POSITION, location.ptr()); //alSourcefv(source, AL_VELOCITY, velocity.ptr()); @@ -127,6 +138,9 @@ void loop( size_t source_index, const char *name, float pitch, float gain) void update_listener(math::Vector3f const &location, math::Axis const &axis, math::Vector3f const & velocity) { + if (!audio_context) + return; + alListenerfv(AL_POSITION, location.ptr()); ALfloat orientation[6]; diff --git a/src/client/client.cc b/src/client/client.cc index f5da1f0..93d254e 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -30,6 +30,20 @@ Client app; //--- engine functions -------------------------------------------- +void func_snd_restart(std::string const &args) +{ + // unload entity sounds + for (core::Entity::Registry::iterator it = core::Entity::registry().begin(); it != core::Entity::registry().end(); it++) { + core::Entity *entity = (*it).second; + if (entity->state()) + entity->state()->clearsound(); + } + + audio::shutdown(); + + audio::init(); +} + void func_r_restart(std::string const &args) { video::shutdown(); @@ -111,8 +125,12 @@ void Client::init(int count, char **arguments) // add engine functions core::Func *func = 0; + func = core::Func::add("r_restart", (core::FuncPtr) func_r_restart); func->set_info("restart render subsystem"); + + func = core::Func::add("snd_restart", (core::FuncPtr) func_snd_restart); + func->set_info("restart audio subsystem"); } void Client::run() @@ -171,6 +189,8 @@ void Client::shutdown() core::Func::remove("r_restart"); + core::Func::remove("snd_restart"); + chat::shutdown(); audio::shutdown(); diff --git a/src/client/view.cc b/src/client/view.cc index f72a149..391da35 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -38,10 +38,15 @@ core::Cvar *ui_pointerhovercolor =0; namespace view { -const size_t fps_counter_size = 25; // fps is the average of 20 frames +const size_t fps_counter_size = 32; // fps is the average of 32 frames float fps_counter_time[fps_counter_size]; size_t fps_counter_index = 0; +const size_t net_counter_size = 128; +float net_counter_time[net_counter_size]; +size_t net_counter_traffic[net_counter_size]; +size_t net_counter_index; + void init() { draw_stats = core::Cvar::get("draw_stats", "0", core::Cvar::Archive); @@ -63,6 +68,9 @@ void init() for (size_t i =0; i < fps_counter_size; i++) fps_counter_time[i] = 0.0f; + + for (size_t i = 0; i < net_counter_size; i++) + net_counter_traffic[i] = 0; } void shutdown() @@ -99,18 +107,12 @@ void draw_status() std::stringstream status; - int minutes = (int) floorf(core::application()->time() / 60.0f); - int seconds = (int) floorf(core::application()->time() - (float) minutes* 60.0f); - - status << "^Ntime ^B" << std::setfill(' ') << std::setw(3) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds; - Text::draw(video::width-Text::fontwidth()*11-4, 4, status); - if (core::game()) { int minutes = (int) floorf(core::game()->clientframetime() / 60.0f); int seconds = (int) floorf( core::game()->clientframetime() - (float) minutes* 60.0f); - status << "^Ngame ^B" << std::setfill(' ') << std::setw(3) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds; - Text::draw(video::width-Text::fontwidth()*11-4, Text::fontheight()+ 4, status); + status << "^Ntime ^B" << std::setfill(' ') << std::setw(3) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds; + Text::draw(video::width-Text::fontwidth()*12-4, Text::fontheight()+ 4, status); } // print stats if desired @@ -129,15 +131,30 @@ void draw_status() } std::stringstream stats; - stats << "^Nfps ^B" << std::setw(6) << fps << "\n"; + stats << "^Nfps ^B" << std::setw(6) << fps << "\n"; + if (core::application()->connected()) { - stats << "^Ntris ^B" << std::setw(5) << render::Stats::tris << "\n"; - stats << "^Nquads ^B" << std::setw(5) << render::Stats::quads << "\n"; + stats << "^Ntris ^B" << std::setw(5) << render::Stats::tris << "\n"; + stats << "^Nquads ^B" << std::setw(5) << render::Stats::quads << "\n"; + + if (core::Stats::network_bytes_sent + core::Stats::network_bytes_received) { + net_counter_traffic[net_counter_index] = core::Stats::network_bytes_sent + core::Stats::network_bytes_received; + net_counter_time[net_counter_index] = core::application()->time(); + size_t index_max = net_counter_index; + + net_counter_index = (net_counter_index + 1) % net_counter_size; + size_t index_min = net_counter_index; + + float d = net_counter_time[index_max] - net_counter_time[index_min]; + if (d > 0) { + float traffic = net_counter_traffic[index_max] - net_counter_traffic[index_min]; + + stats << "^Nnet ^B" << std::setw(6) << roundf( (float) traffic / d ) << "\n"; + } + } } - stats << "^Ntx ^B"<< std::setw(5) << (core::Stats::network_bytes_sent >> 10) << "\n"; - stats << "^Nrx ^B"<< std::setw(5) << (core::Stats::network_bytes_received >> 10) << "\n"; - Text::draw(video::width-Text::fontwidth()*11-4, 4 + Text::fontheight()*2, stats); + Text::draw(video::width-Text::fontwidth()*12-4, 4 + Text::fontheight()*2, stats); } // draw a basic HUD diff --git a/src/game/ship.cc b/src/game/ship.cc index 920bf43..89ff343 100644 --- a/src/game/ship.cc +++ b/src/game/ship.cc @@ -197,7 +197,7 @@ void Ship::frame(float seconds) if (entity_thrust < target_thrust) entity_thrust = target_thrust; } - math::clamp(entity_thrust, 0.0f, 1.0f); + //math::clamp(entity_thrust, 0.0f, 1.0f); // update roll if (current_target_roll < target_roll) { |