diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-10-18 21:34:55 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-10-18 21:34:55 -0400 |
| commit | 33e6b9627e6a46d388d46f2c5b4d15ba7e9f9904 (patch) | |
| tree | 18d24b74e48d8b7e9cb656272df7a48b28d3b6c8 /src/server/main.cpp | |
| parent | 76b4fddee6106b60dbc6da6d7bcef61b42a3c310 (diff) | |
| download | brokengine-33e6b9627e6a46d388d46f2c5b4d15ba7e9f9904.tar.gz brokengine-33e6b9627e6a46d388d46f2c5b4d15ba7e9f9904.tar.bz2 brokengine-33e6b9627e6a46d388d46f2c5b4d15ba7e9f9904.zip | |
Started refactoring
* Finished a basic server
* Changed from ZMQ to nanomsg (basically the same though)
* Moved some repeated code from the client/server directories into
"shared"
* Edited makefile to reflect new dependencies
Diffstat (limited to 'src/server/main.cpp')
| -rw-r--r-- | src/server/main.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/server/main.cpp b/src/server/main.cpp new file mode 100644 index 0000000..846ec2b --- /dev/null +++ b/src/server/main.cpp @@ -0,0 +1,57 @@ + +#include <stdio.h> +#include <stdlib.h> +#include "../shared/util/hashmap.h" +extern "C" { + #include <lua.h> + #include <lauxlib.h> + #include <lualib.h> +} + +//C++ things +#include <vector> +#include <thread> +#include <list> + +#include <string.h> // for strstr() +#include <nn.h> +#include <tcp.h> +#include <pair.h> + +#include <btBulletDynamicsCommon.h> +#include <cstdlib> + +#include "../shared/lua_api/common.h" +#include "../shared/lua_api/load_net.hpp" +#include "../shared/phys/physcommon.hpp" + +using namespace std; +using namespace chrono; + +lua_State* L; +void gameloop(){ + gameloop_phys(NULL); + gameloop_net(L); +} + +int main (){ + printf("Brok[en]gine Server\n"); + L = luaL_newstate(); + + phys_genesis(); + loadLLibs(L); + loadNetLibs(L); + int iErr = luaL_dofile(L,"../data/init.lua"); + if(iErr != 0){ + lua_error(L); + printf("Failed to open lua file:../data/init.lua\n"); + } + do{ + + gameloop(); + std::this_thread::yield(); + }while(true); + phys_shutdown(NULL); + + return 0; +} |
