initial commit

master
Martin Gerhardy 2015-10-15 21:54:01 +02:00
commit 2b2e239488
438 changed files with 24489 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
CMakeFiles/
cmake_install.cmake
CMakeCache.txt
/fips_targets.yml
Makefile
/.project
/.cproject
/.fips-gen.py
/.fips-imports.cmake
*.a
/.settings
/fips-*_*
/valgrind-*.log

29
CMakeLists.txt Normal file
View File

@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 2.8)
get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
get_filename_component(ENGINE_ROOT_DIR "." ABSOLUTE)
include("${FIPS_ROOT_DIR}/cmake/fips.cmake")
include("${ENGINE_ROOT_DIR}/cmake/common.cmake")
set(CMAKE_MODULE_PATH "${ENGINE_ROOT_DIR}/cmake")
include(CheckFunctionExists)
include(CheckLibraryExists)
set(FIPS_EXCEPTIONS ON)
set(FIPS_UNITTESTS ON)
set(FIPS_RTTI ON)
set(TB_ENABLE_RTTI ON CACHE BOOL "Do not disable RTTI" FORCE)
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
# TODO: this is for the header only sauce lib
add_definitions(-Wall -Wextra -Wno-deprecated-declarations -Wno-unused-local-typedefs)
endif()
include_directories(src/modules)
include_directories(src/modules/ui)
fips_setup(PROJECT engine)
fips_add_subdirectory(src)
fips_finish()
copy_data_files(shared)

174
README.md Normal file
View File

@ -0,0 +1,174 @@
# About
Voxel engine that depends on [PolyVox](http://www.volumesoffun.com/polyvox-about/) and [AccidentalNoise](http://accidentalnoise.sourceforge.net/)
The build system is a cmake based system that automatically downloads all the needed dependencies. See
[fips homepage](http://floooh.github.io/fips).
Network message generation depends on [flatbuffers](https://github.com/mgerhardy/fips-flatbuffers)
Concept: [Link](https://drive.google.com/open?id=0BxzNji4VZ2FaWXplX0I1ZWxOamc&authuser=0)
# Var
There are vars inside the engine that you can override via commandline. Var instances are runtime changeable
configuration variables that you can influence from within the game.
e.g. run the server with ```./server -set sv_port 1025``` to change the *sv_port* var to 1025 and bind that port.
* cl_cammaxpitch the max pitch should not be bigger than 89.9 - because at 90 we have a visual switch
* cl_camspeed
* cl_cammousespeed
* sv_seed the server side seed
* cl_name the name of the client
* cl_port the port to connect to
* cl_host e.g. 127.0.0.1
* cl_fullscreen true|false
* cl_chunksize 16 The size of the chunk that is extracted with each step
* core_loglevel 0 = Error => 4 = Trace
* cl_vsync false|true To disable|enable vsync
# Dependencies
* You need to have **SDL2** installed
* Windows: env var *SDL2DIR* point to the directory where you extracted it into ([Download link](http://libsdl.org/release/SDL2-devel-2.0.3-VC.zip))
* Linux: pkg-config support is enough here (e.g. ```apt-get install libsdl2-dev```)
* You need to have **git** installed and in your path
* You need to have **cmake** installed and in your path
* You need to have **python27** installed and in your path
* You need to have **postgre** installed (ubuntu package postgresql, libpq-dev and postgresql-server-dev-9.3 (or another version))
# Compilation
* After fulfilling all the above mentioned dependencies, you just have to run ```fips```
# Profiling
* There is built-in [Remotery](https://github.com/Celtoys/Remotery) support - just run the application with e.g.
```./fips run server -- -set core_trace true```
or without fips:
```./server -set core_trace true```
The *core_trace* var will activate all those core_trace_* macros.
# Check this out:
* [PolyVox and Bullet](http://www.reddit.com/r/VoxelGameDev/comments/2dmfr1/fun_with_polyvox_and_bullet/)
* [PolyVox 3D world generation](http://accidentalnoise.sourceforge.net/minecraftworlds.html)
* [AccidentalNoise islands](http://www.gamedev.net/blog/33/entry-2249282-hooking-into-the-tree-to-build-a-map/)
* [libnoise tutorials](http://libnoise.sourceforge.net/tutorials/)
* [VoxelEditor](https://voxel.codeplex.com/)
* [Voxel Engines](http://www.reddit.com/r/gamedev/wiki/block_engines)
* [Minecraft Protocol](http://wiki.vg/Protocol)
* [CouchDB](http://code.google.com/p/couchdbpp/)
* [Quest Generating AI](http://voxelquest.vanillaforums.com/discussion/comment/11/#Comment_11) (VoxelQuest)
* [VoxelShip Editor](https://blackflux.com/node/11)
* [MagicaVoxel Editor](http://ephtracy.github.io/)
## PostgreSQL
first sudo as postgres default superuser 'postgres' on bash
`sudo -i -u postgres`
adding an new new user by typing
`createuser -s dbmaster`
create a new database
`createdb engine_db`
now start postgres and add password for these user
`psql`
write this statement
`ALTER USER dbmaster WITH PASSWORD 'ben711cCefIUit887';`
now we have done the first initialization.
### quick postreSQL guide:
to leave PSQL type: `\q`
to list all Database type: `\l`
to connect to an specific database type: `\c dbname` (for example `\c engine_db`)
after you are connected to an database, you can use SQL
to list al tables type: `\dt` (`\d+` for all tables. also sequences)
more stuff: http://wiki.ubuntuusers.de/PostgreSQL
### console postgres tools
temporary tools (till rcon is not final) are usable via console.
after db is initialized start the server and type `store init`
this will create the user table
to add an user type `store useradd <name> <password>`
# AI
* Request
* Produce
* Consume
## Production chain
Define a need, to be able to produce something
In order to fulfill this need, the ai should request the needed objects (or walk to a location to get it)
Even food can be handled via "request -> produce" (the production is the health)
We need a system that is able to define the needs and define how to fulfill them.
* Points of Interest (where is something produced)
* Reference other production chains (The product of something else might be the 'request' to 'produce' my own product
* Price one has to pay (exchange with some other good [e.g. of of the 'requests' of the producer] or money)
So every npc should have several requests:
* money (used to get the production chain start good)
* food (used to produce health)
* production chain start good (use to produce something to get money/food/production chain start good)
Each of these requests will get a priority. This way we have unique characters where one is just trying to survive, while another one
is just trying to get rich and yet another one that is already satisfied if he can fulfill the need of others. (The food should always be relative high)
## Requests
requests[] = {
health
money
}
## Health
Possibe production chains:
Money -> Food -> Health
InputGood -> OutputGood -> $ReferenceToFoodCreatorRequests
So we need to save the needed outputs - and then recursively search for stuff that leads to fulfilling the need. If we can
fulfill the need on the first level, skip everything else - otherwise go a level deeper.
fulfills[health] = { food 100% }
fulfills[food] = { buyfood 80%, createfood 15%, stealfood 5% }
fulfills[createfood] = { huntanimals 50%, producefood 50% }
fulfills[buyfood] = { money 100% }
fulfills[money] = { sellproduction 95%, stealmoney 5% }
fulfills[sellproduction] = { produce 100% }
fulfills[produce] = { work 99%, findprofession 1% }
fulfills[work] = { getmaterial 1%, convertmaterial 99% }
[...]
I think this can all be modeled into behaviour trees. We need to implement the slot mechanism into SimpleAI to replace
profession slot. So the behaviour tree would e.g. look like this:
CreateFood[IfFoodCreator]
BuyFood[IfEoughMoney]
GetFood[IsHungry] StealFood
StayHealthy
Work
## Requests can't be fulfilled
* Walk to the town hall and cry about not being able to fulfill your need. Do that for x time units - after that change your
profession, get new requests and try to fulfill those.
* A player can now walk into the town hall to resolve unfulfilled requests
* After x time units the unfulfilled request is again visible in the town hall for other players.
# Spawn of npcs
* We need points of interest and a fillrate at those POIs.
* We need to be able to pick a profession (visual appearance will be tight to the profession)
* Do we need a sheriff in each town? One that already investigates unfulfilled requests?
* We need one town master chief rocker in the town hall that gives away the collected quests to the users.

18
cmake/FindSDL2.cmake Normal file
View File

@ -0,0 +1,18 @@
if (DEFINED ENV{SDL2DIR})
set(SDL2_INCLUDE_DIRS ENV{SDL2DIR}/include)
if (FIPS_WINDOWS)
set(SDL2_LIBRARIES ENV{SDL2DIR}/libs/SDL_main.lib ENV{SDL2DIR}/libs/SDL.lib)
endif()
else()
if (FIPS_WINDOWS)
find_package(SDL REQUIRED)
set(SDL2_INCLUDE_DIRS ${SDL_INCLUDE_DIRS})
set(SDL2_LIBRARIES ${SDL_LIBRARIES})
else()
#include(FindPkgConfig)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_search_module(SDL2 REQUIRED sdl2)
endif()
endif()
endif()

24
cmake/common.cmake Normal file
View File

@ -0,0 +1,24 @@
SET(DEFAULT_LUA_EXECUTABLE lua)
macro(copy_data_files TARGET)
add_custom_target(copy-data-${TARGET} ALL
COMMAND cmake -E copy_directory "${FIPS_PROJECT_DIR}/data/${TARGET}/" ${FIPS_DEPLOY_DIR}/${CMAKE_PROJECT_NAME}/${FIPS_CONFIG}
COMMENT "Copy ${TARGET} data files...")
endmacro()
macro(check_lua_files TARGET files)
find_program(LUA_EXECUTABLE NAMES ${DEFAULT_LUA_EXECUTABLE})
if (LUA_EXECUTABLE)
message("${LUA_EXECUTABLE} found")
foreach(_file ${files})
add_custom_target(
${_file}
COMMAND ${LUA_EXECUTABLE} ${_file}
WORKING_DIRECTORY ${FIPS_PROJECT_DIR}/data/${TARGET}
)
add_dependencies(${TARGET} ${_file})
endforeach()
else()
message(WARNING "No ${DEFAULT_LUA_EXECUTABLE} found")
endif()
endmacro()

0
contrib/.gitignore vendored Normal file
View File

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,57 @@
in vec3 v_pos;
in vec3 v_norm;
in vec2 v_texcoords;
in vec3 v_diffusecolor;
in vec3 v_specularcolor;
in vec3 v_lightpos;
out vec4 o_color;
uniform sampler2D u_texture;
vec3 getMaterialColor() {
return texture(u_texture, v_texcoords).rgb;
}
vec3 getAmbientColor(vec3 materialcolor) {
const float ambientstrength = 1.0;
return ambientstrength * materialcolor;
}
vec3 getDiffuseColor(vec3 lightdir, vec3 normal) {
float diffuse = max(dot(lightdir, normal), 0.0);
return diffuse * v_diffusecolor;
}
vec3 getSpecularColor(vec3 lightdir, vec3 normal) {
const float specularstrength = 0.5;
vec3 viewdir = normalize(-v_pos);
vec3 reflectdir = reflect(-lightdir, normal);
float specangle = max(dot(reflectdir, viewdir), 0.0);
float spec = pow(specangle, 32);
return specularstrength * spec * v_specularcolor;
}
vec3 getFogColor() {
return vec3(0.04, 0.29, 0.94);
}
float getFog() {
const float density = 0.05;
const float endfog = 1500.0;
const float startfog = 500.0;
float fogdistance = gl_FragCoord.z / gl_FragCoord.w;
float d = density * fogdistance;
float fogval = (endfog - fogdistance) / (endfog - startfog);
return 1.0 - clamp(fogval, 0.0, 1.0);
}
void main(void) {
vec3 lightdir = normalize(v_lightpos - v_pos);
vec3 materialcolor = getMaterialColor();
vec3 ambientcolor = getAmbientColor(materialcolor);
vec3 diffusecolor = getDiffuseColor(lightdir, v_norm);
vec3 specularcolor = getSpecularColor(lightdir, v_norm);
vec3 fogcolor = getFogColor();
vec3 finalcolor = (ambientcolor + diffusecolor + specularcolor) * materialcolor;
o_color = vec4(mix(finalcolor, fogcolor, getFog()), 1.0);
}

View File

@ -0,0 +1,30 @@
// attributes from the VAOs
in vec3 a_pos;
in vec3 a_norm;
in vec2 a_texcoords;
uniform mat4 u_projection;
uniform mat4 u_model;
uniform mat4 u_view;
uniform vec3 u_diffusecolor;
uniform vec3 u_specularcolor;
uniform vec3 u_lightpos;
out vec3 v_pos;
out vec3 v_norm;
out vec2 v_texcoords;
out vec3 v_diffusecolor;
out vec3 v_specularcolor;
out vec3 v_lightpos;
void main(void) {
mat4 modelview = u_view * u_model;
vec4 pos4 = modelview * vec4(a_pos, 1.0);
v_pos = vec3(pos4) / pos4.w;
v_norm = a_norm;
v_texcoords = a_texcoords;
v_diffusecolor = u_diffusecolor;
v_specularcolor = u_specularcolor;
v_lightpos = u_lightpos;
gl_Position = u_projection * modelview * vec4(a_pos, 1.0);
}

View File

@ -0,0 +1,10 @@
uniform sampler2D u_texture;
in vec2 v_texcoord;
in vec4 v_color;
out vec4 o_color;
void main(void) {
vec4 color = texture2D(u_texture, v_texcoord);
vec4 fcolor = v_color / 255.0;
o_color = color * fcolor * 255.0;
}

View File

@ -0,0 +1,15 @@
// attributes from the VAOs
in vec2 a_pos;
in vec2 a_texcoord;
in vec4 a_color;
uniform mat4 u_projection;
out vec2 v_texcoord;
out vec4 v_color;
void main(void) {
v_color = a_color;
v_texcoord = a_texcoord;
gl_Position = u_projection * vec4(a_pos.x, a_pos.y, 0.0, 1.0);
}

View File

@ -0,0 +1,57 @@
in vec3 v_pos;
in vec3 v_norm;
in vec2 v_texcoords;
in vec3 v_diffusecolor;
in vec3 v_specularcolor;
in vec3 v_lightpos;
out vec4 o_color;
uniform sampler2D u_texture;
vec3 getMaterialColor() {
return texture(u_texture, v_texcoords).rgb;
}
vec3 getAmbientColor(vec3 materialcolor) {
const float ambientstrength = 1.0;
return ambientstrength * materialcolor;
}
vec3 getDiffuseColor(vec3 lightdir, vec3 normal) {
float diffuse = max(dot(lightdir, normal), 0.0);
return diffuse * v_diffusecolor;
}
vec3 getSpecularColor(vec3 lightdir, vec3 normal) {
const float specularstrength = 0.5;
vec3 viewdir = normalize(-v_pos);
vec3 reflectdir = reflect(-lightdir, normal);
float specangle = max(dot(reflectdir, viewdir), 0.0);
float spec = pow(specangle, 32);
return specularstrength * spec * v_specularcolor;
}
vec3 getFogColor() {
return vec3(0.04, 0.29, 0.94);
}
float getFog() {
const float density = 0.05;
const float endfog = 1500.0;
const float startfog = 500.0;
float fogdistance = gl_FragCoord.z / gl_FragCoord.w;
float d = density * fogdistance;
float fogval = (endfog - fogdistance) / (endfog - startfog);
return 1.0 - clamp(fogval, 0.0, 1.0);
}
void main(void) {
vec3 lightdir = normalize(v_lightpos - v_pos);
vec3 materialcolor = getMaterialColor();
vec3 ambientcolor = getAmbientColor(materialcolor);
vec3 diffusecolor = getDiffuseColor(lightdir, v_norm);
vec3 specularcolor = getSpecularColor(lightdir, v_norm);
vec3 fogcolor = getFogColor();
vec3 finalcolor = (ambientcolor + diffusecolor + specularcolor) * materialcolor;
o_color = vec4(mix(finalcolor, fogcolor, getFog()), 1.0);
}

View File

@ -0,0 +1,34 @@
// attributes from the VAOs
in vec3 a_pos;
in vec3 a_norm;
in vec2 a_texcoords;
uniform float u_wavetime;
uniform float u_wavewidth;
uniform float u_waveheight;
uniform mat4 u_projection;
uniform mat4 u_model;
uniform mat4 u_view;
uniform vec3 u_diffusecolor;
uniform vec3 u_specularcolor;
uniform vec3 u_lightpos;
out vec3 v_pos;
out vec3 v_norm;
out vec2 v_texcoords;
out vec3 v_diffusecolor;
out vec3 v_specularcolor;
out vec3 v_lightpos;
void main(void) {
mat4 modelview = u_view * u_model;
vec4 pos4 = modelview * vec4(a_pos, 1.0);
v_pos = vec3(pos4) / pos4.w;
v_norm = a_norm;
v_texcoords = a_texcoords;
v_diffusecolor = u_diffusecolor;
v_specularcolor = u_specularcolor;
v_lightpos = u_lightpos;
float posw = sin(u_wavewidth * a_pos.x + u_wavetime) * cos(u_wavewidth * a_pos.y + u_wavetime) * u_waveheight;
gl_Position = u_projection * modelview * vec4(a_pos, posw);
}

View File

@ -0,0 +1,90 @@
flat in int v_material;
flat in int v_density;
in vec3 v_pos;
in vec3 v_diffusecolor;
in vec3 v_specularcolor;
in vec3 v_lightpos;
out vec4 o_color;
// the different material types
const int AIR = 0;
const int DIRT = 1;
const int GRASS = 2;
const int CLOUD = 3;
const int WATER = 4;
const int LEAVES = 5;
const int TRUNK = 6;
const int CLOUDS = 7;
const float MAX_MATERIAL = 16.0;
vec3 getMaterialColor() {
if (v_material == DIRT) {
return vec3(0.97, 0.67, 0.39);
}
if (v_material == GRASS) {
return vec3(0.24, 0.67, 0.24);
}
if (v_material == CLOUD) {
return vec3(0.75, 0.75, 0.9);
}
if (v_material == TRUNK) {
return vec3(0.4, 0.2, 0.0);
}
if (v_material == LEAVES) {
return vec3(0.4, 0.6, 0.4);
}
if (v_material == CLOUDS) {
return vec3(0.4, 0.6, 0.9);
}
// error
return vec3(1.0, float(v_material) / (MAX_MATERIAL * 255.0), float(v_density) / (MAX_MATERIAL * 255.0));
}
vec3 getAmbientColor(vec3 materialcolor) {
const float ambientstrength = 1.0;
return ambientstrength * materialcolor;
}
vec3 getDiffuseColor(vec3 lightdir, vec3 normal) {
float diffuse = max(dot(lightdir, normal), 0.0);
return diffuse * v_diffusecolor;
}
vec3 getSpecularColor(vec3 lightdir, vec3 normal) {
const float specularstrength = 0.5;
vec3 viewdir = normalize(-v_pos);
vec3 reflectdir = reflect(-lightdir, normal);
float specangle = max(dot(reflectdir, viewdir), 0.0);
float spec = pow(specangle, 32);
return specularstrength * spec * v_specularcolor;
}
vec3 getFogColor() {
return vec3(0.04, 0.29, 0.94);
}
float getFog() {
const float density = 0.05;
const float endfog = 1500.0;
const float startfog = 500.0;
float fogdistance = gl_FragCoord.z / gl_FragCoord.w;
float d = density * fogdistance;
float fogval = (endfog - fogdistance) / (endfog - startfog);
return 1.0 - clamp(fogval, 0.0, 1.0);
}
void main(void) {
vec3 fdx = vec3(dFdx(v_pos.x), dFdx(v_pos.y), dFdx(v_pos.z));
vec3 fdy = vec3(dFdy(v_pos.x), dFdy(v_pos.y), dFdy(v_pos.z));
vec3 normal = normalize(cross(fdx, fdy));
vec3 lightdir = normalize(v_lightpos - v_pos);
vec3 materialcolor = getMaterialColor();
vec3 ambientcolor = getAmbientColor(materialcolor);
vec3 diffusecolor = getDiffuseColor(lightdir, normal);
vec3 specularcolor = getSpecularColor(lightdir, normal);
vec3 fogcolor = getFogColor();
vec3 finalcolor = (ambientcolor + diffusecolor + specularcolor) * materialcolor;
o_color = vec4(mix(finalcolor, fogcolor, getFog()), 1.0);
}

View File

@ -0,0 +1,29 @@
// attributes from the VAOs
in vec3 a_pos;
in ivec2 a_materialdensity;
uniform mat4 u_projection;
uniform mat4 u_model;
uniform mat4 u_view;
uniform vec3 u_diffusecolor;
uniform vec3 u_specularcolor;
uniform vec3 u_lightpos;
flat out int v_material;
flat out int v_density;
out vec3 v_pos;
out vec3 v_diffusecolor;
out vec3 v_specularcolor;
out vec3 v_lightpos;
void main(void) {
mat4 modelview = u_view * u_model;
vec4 pos4 = modelview * vec4(a_pos, 1.0);
v_pos = vec3(pos4) / pos4.w;
v_material = a_materialdensity.x;
v_density = a_materialdensity.y;
v_diffusecolor = u_diffusecolor;
v_specularcolor = u_specularcolor;
v_lightpos = u_lightpos;
gl_Position = u_projection * modelview * vec4(a_pos, 1.0);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -0,0 +1,15 @@
info
glyph_str !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
name Segoe
size 14
bitmap font_14.png
ascent 15
descent 5
advance_delta -3
space_advance 5
size 28
bitmap font_28.png
ascent 31
descent 10
advance_delta -7
space_advance 10

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -0,0 +1,5 @@
w +move_forward
a +move_left
s +move_backward
d +move_right
ctrl+w quit

View File

@ -0,0 +1,14 @@
TBMessageWindow.ok Ok
TBMessageWindow.cancel Cancel
TBMessageWindow.yes Yes
TBMessageWindow.no No
TBList.header Showing %d of %d
connect Connect
password Password
login Login
email Email
ok Ok
disconnect Disconnect
disconnecttext You either got disconnected or the connect attempt failed
authfailed Authentication failed
authfailedtext Authentication failed

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,464 @@
# This is the default skin of Turbo Badger
# The license of the skin is Public Domain.
#
# For more information about Turbo Badger and its license,
# see tb_core.h.
description
name Turbo Badger Default skin
# Dimensions in dp (the default unit for padding and such) and bitmaps are specified for this DPI.
base-dpi 96
# The skin also has graphics available in these DPI modes
supported-dpi 96
defaults
spacing 5
text-color #fefefe
placeholder
opacity 0.2
disabled
opacity 0.3
elements
TBButton
text-color #fefefe
bitmap button.png
cut 17
expand 7
padding 6 8
overrides
element TBButtonInGroup
condition: target: parent, property: skin, value: button_group
condition: target: parent, property: axis, value: x
element TBButton.pressed
state pressed
TBButton.pressed
text-color #fefefe
bitmap button_pressed.png
cut 17
expand 7
content-ofs-x 1
content-ofs-y 1
TBButton.flat
text-color #fefefe
padding 6 8
children
element TBButton.flat.hovered
state hovered
element TBButton.flat.pressed
state pressed
TBButton.flat.hovered
bitmap button_flat_outline.png
cut 15
expand 6
TBButton.flat.pressed
bitmap button_flat_pressed.png
cut 8
# == TBButtonInGroup is not a widget. It's only used as override for TBButton under a "button_group" ====
TBButtonInGroup
bitmap button_grouped_x_middle_up.png
cut 17
expand 7
padding 6 8
overrides
element TBButtonInGroup.first
condition: target: prev sibling, property: skin, value: TBButton, test: !=
element TBButtonInGroup.last
condition: target: next sibling, property: skin, value: TBButton, test: !=
element TBButtonInGroup.pressed
state pressed
TBButtonInGroup.pressed
clone TBButtonInGroup
bitmap button_grouped_x_middle_down.png
content-ofs-x 1
content-ofs-y 1
overrides
TBButtonInGroup.first
clone TBButtonInGroup
bitmap button_grouped_x_first_up.png
overrides
element TBButtonInGroup.first.pressed
state pressed
TBButtonInGroup.first.pressed
clone TBButtonInGroup.pressed
bitmap button_grouped_x_first_down.png
overrides
TBButtonInGroup.last
clone TBButtonInGroup
bitmap button_grouped_x_last_up.png
overrides
element TBButtonInGroup.last.pressed
state pressed
TBButtonInGroup.last.pressed
clone TBButtonInGroup.pressed
bitmap button_grouped_x_last_down.png
overrides
# == button_group is not a widget. It's specified on widgets that should group TBButton =======
button_group
spacing -1px
# == TBSection skins ==========================================================================
TBSection.layout
spacing -1px
TBSection.container
bitmap section_container.png
type StretchBorder
cut 11
expand 6
padding 10
TBSectionHeader
bitmap window_mover_bg_tile.png
type Tile
expand -1
padding 3 16
children
element TBSectionHeader.icon_0
condition: target: this, property: value, value: 0
condition: target: this, property: capture, test: !=
element TBSectionHeader.icon_1
condition: target: this, property: value, value: 1
condition: target: this, property: capture, test: !=
element TBSectionHeader.icon_pressed
condition: target: this, property: capture
overlays
element TBSectionHeader.overlay
state all
TBSectionHeader.overlay
bitmap window_mover_overlay.png
type StretchBorder
cut 16
expand 3
TBSectionHeader.icon_0
bitmap toggle_section_icon_up.png
type Image
img-position-x 0
img-ofs-x 4
TBSectionHeader.icon_1
bitmap toggle_section_icon_down.png
type Image
img-position-x 0
img-ofs-x 4
TBSectionHeader.icon_pressed
bitmap toggle_section_icon_middle.png
type Image
img-position-x 0
img-ofs-x 4
# == TBTabContainer skins - Create strong overrides for the tab buttons four alignments ============
TBTabContainer.rootlayout
spacing -1px
TBTabContainer.tablayout_x
padding 0 10
TBTabContainer.tablayout_y
padding 10 0
TBTabContainer.container
clone TBContainer
TBTabContainer.tab
strong-overrides
element TBTabContainer.tab_top
condition: target: ancestors, property: align, value: top
element TBTabContainer.tab_bottom
condition: target: ancestors, property: align, value: bottom
element TBTabContainer.tab_left
condition: target: ancestors, property: align, value: left
element TBTabContainer.tab_right
condition: target: ancestors, property: align, value: right
# == Top tab button =============================
TBTabContainer.tab_top
bitmap tab_button_top_inactive.png
cut 12
expand 6
padding 6 6 3 6
min-width 50
overrides
element TBTabContainer.tab_top.pressed
state pressed
children
element tab_top_focus
state focused
tab_top_focus
type StretchBorder
bitmap focus_tabbutton_top.png
cut 12
expand 6
TBTabContainer.tab_top.pressed
bitmap tab_button_top_active.png
cut 13
expand 6
# == Bottom tab button =============================
TBTabContainer.tab_bottom
bitmap tab_button_bottom_inactive.png
cut 12
expand 6
padding 3 6 6 6
min-width 50
overrides
element TBTabContainer.tab_bottom.pressed
state pressed
children
element tab_bottom_focus
state focused
tab_bottom_focus
clone tab_top_focus
flip-y 1
TBTabContainer.tab_bottom.pressed
bitmap tab_button_bottom_active.png
cut 13
expand 6
# == Left tab button =============================
TBTabContainer.tab_left
bitmap tab_button_left_inactive.png
cut 12
expand 6
padding 6 3 6 6
min-width 50
overrides
element TBTabContainer.tab_left.pressed
state pressed
children
element tab_left_focus
state focused
tab_left_focus
type StretchBorder
bitmap focus_tabbutton_left.png
cut 12
expand 6
TBTabContainer.tab_left.pressed
bitmap tab_button_left_active.png
cut 13
expand 6
# == Right tab button =============================
TBTabContainer.tab_right
bitmap tab_button_right_inactive.png
cut 12
expand 6
padding 6 6 6 3
min-width 50
overrides
element TBTabContainer.tab_right.pressed
state pressed
children
element tab_right_focus
state focused
tab_right_focus
clone tab_left_focus
flip-x 1
TBTabContainer.tab_right.pressed
bitmap tab_button_right_active.png
cut 13
expand 6
# == TBEditField skin. Create strong overrides for the search type to add magnifier glass icon =====
TBEditField.selection
cut 2
bitmap selection.png
TBEditField
bitmap editfield.png
cut 12
expand 4
padding 4
strong-overrides
element TBEditField.search
condition: target: this, property: edit-type, value: "search"
TBEditField.search
clone TBEditField
padding 4 4 4 24
min-width 50
children
element TBEditField.search.icon
TBEditField.search.icon
bitmap search.png
type Image
img-position-x 0
img-ofs-x 5
# == TBWindow skin =================================================================================
TBWindow
bitmap window.png
cut 16
expand 12
padding 10
overrides
element TBWindow.selected
state selected
TBWindow.selected
bitmap window_active.png
cut 16
expand 12
TBWindow.close
bitmap window_close.png
type Image
children
element TBWindow.close.pressed
state pressed
TBWindow.close.pressed
bitmap window_close_pressed.png
type Image
TBWindow.mover
text-color #b8b8b8
bitmap window_mover_bg_tile.png
type Tile
expand -1
padding 4
overrides
element TBWindow.mover.active
state selected
children
element TBWindow.mover.overlay
state all
TBWindow.mover.overlay
bitmap window_mover_overlay.png
cut 12
expand 3
TBWindow.mover.active
clone TBWindow.mover
text-color #fefefe
overrides
overlays
children
# == Misc skins ====================================================================================
TBContainer
bitmap container.png
type StretchBorder
cut 12
expand 6
padding 10
TBCheckBox
bitmap checkbox.png
cut 19
expand 7
children
element TBCheckBox.selected
state selected
element TBCheckBox.pressed
state pressed
TBCheckBox.selected
bitmap checkbox_mark.png
type Image
expand 7
TBCheckBox.pressed
bitmap checkbox_pressed.png
type Image
TBRadioButton
bitmap radio.png
cut 19
expand 7
children
element TBRadioButton.selected
state selected
element TBRadioButton.pressed
state pressed
TBRadioButton.selected
bitmap radio_mark.png
type Image
expand 7
TBRadioButton.pressed
bitmap radio_pressed.png
type Image
expand 7
TBLayout.fadeout_x
bitmap fadeout_x.png
TBLayout.fadeout_y
bitmap fadeout_y.png
TBSelectList
clone TBEditField
padding 2
TBSelectDropdown
clone TBButton
TBSelectDropdown.arrow
clone arrow.down
TBSelectDropdown.window
clone TBPopupWindow
TBPopupWindow
clone TBWindow
padding 2
TBMenuWindow
clone TBPopupWindow
TBSelectItem
padding 4 10
children
element TBSelectItem.hovered
state hovered
element TBSelectItem.selected
state selected
TBSelectItem.selected
cut 7
bitmap item_selected.png
TBSelectItem.hovered
cut 7
bitmap item_hover.png
TBSelectItem.separator
clone TBSeparator
TBSeparator
bitmap item_separator_x.png
type Stretch Image
overrides
element TBSeparator.y
condition: target: parent, property: axis, value: x
TBSeparator.y
bitmap item_separator_y.png
type Stretch Image
TBScrollBarBgX
bitmap scroll_bg_x.png
cut 11
expand 5
TBScrollBarFgX
bitmap scroll_fg_x.png
cut 11
expand 5
TBScrollBarBgY
bitmap scroll_bg_y.png
cut 11
expand 5
TBScrollBarFgY
bitmap scroll_fg_y.png
cut 11
expand 5
TBSliderBgX
bitmap slider_bg_x.png
cut 9
min-height 19
max-height 19
min-width 50
TBSliderFgX
bitmap slider_handle.png
expand 5
TBSliderBgY
bitmap slider_bg_y.png
cut 9
min-width 19
max-width 19
min-height 50
TBSliderFgY
clone TBSliderFgX
TBResizer
bitmap resizer.png
TBInlineSelect
max-width 110
TBDimmer
background-color #00000088
TBProgressSpinner
min-width 28
min-height 28
TBProgressSpinner.fg
bitmap progress_spinner_strip.png
# The TBList header is always disabled, thus gets slightly less opacity default.
TBList.header
arrow.left: type: Image, bitmap: arrow_left.png, min-width: 5, min-height: 10
arrow.right: type: Image, bitmap: arrow_right.png, min-width: 5, min-height: 10
arrow.up: type: Image, bitmap: arrow_up.png, min-width: 10, min-height: 5
arrow.down: type: Image, bitmap: arrow_down.png, min-width: 10, min-height: 5
generic_focus
bitmap focus_r4.png
cut 11
expand 4

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,10 @@
WindowInfo
title @authfailed
TBLayout
axis y
distribution gravity
TBTextField
text @authfailedtext
TBButton
text @ok
id ok

View File

@ -0,0 +1,10 @@
WindowInfo
title @disconnect
TBLayout
axis y
distribution gravity
TBTextField
text @disconnecttext
TBButton
text @ok
id ok

View File

@ -0,0 +1,10 @@
WindowInfo
position: 0 0
TBLayout
axis y
distribution gravity
TBTextField
text @disconnecttext
TBButton
text @disconnect
id disconnect

View File

@ -0,0 +1,36 @@
WindowInfo
title @connect
TBLayout
axis y
distribution gravity
TBLayout
axis x
gravity left right
distribution-position right
TBTextField
text @email
TBEditField
placeholder @email
id email
type email
lp
width 400
TBLayout
axis x
gravity left right
distribution-position right
TBTextField
text @password
TBEditField
placeholder @password
id password
type password
lp
width 400
TBLayout
axis x
gravity right
distribution-position right bottom
TBButton
text @login
id login

View File

@ -0,0 +1,2 @@
INCREASE_COOLDOWNID = 1
HUNT_COOLDOWNID = 2

14
data/server/ai/rabbit.lua Normal file
View File

@ -0,0 +1,14 @@
require "ai.shared"
function rabbitStayAlive (parentnode)
parentnode:addNode("Steer(SelectionFlee)", "fleefromhunter"):setCondition("And(Filter(SelectNpcsOfTypes{ANIMAL_WOLF}),IsCloseToSelection{10})")
end
function rabbit ()
local name = "ANIMAL_RABBIT"
local rootNode = AI.createTree(name):createRoot("PrioritySelector", name)
rabbitStayAlive(rootNode)
increasePopulation(rootNode)
idle(rootNode)
die(rootNode)
end

37
data/server/ai/shared.lua Normal file
View File

@ -0,0 +1,37 @@
require "ai.constants"
function increasePopulation (parentnode)
local parallel = parentnode:addNode("Parallel", "increasepopulation")
parallel:setCondition("And(Not(IsOnCooldown{".. INCREASE_COOLDOWNID .."}),Filter(SelectIncreasePartner{".. INCREASE_COOLDOWNID .."}))")
parallel:addNode("Steer(SelectionSeek)", "followincreasepartner")
local spawn = parallel:addNode("Parallel", "spawn")
spawn:setCondition("IsCloseToSelection{1}")
spawn:addNode("Spawn", "spawn")
spawn:addNode("TriggerCooldown{".. INCREASE_COOLDOWNID .."}", "increasecooldown")
spawn:addNode("TriggerCooldownOnSelection{".. INCREASE_COOLDOWNID .."}", "increasecooldownonpartner")
end
function hunt (parentnode)
local parallel = parentnode:addNode("Parallel", "hunt")
parallel:setCondition("Not(IsOnCooldown{".. HUNT_COOLDOWNID .."})")
parallel:addNode("Steer(SelectionSeek)", "follow"):setCondition("Filter(SelectPrey{ANIMAL_RABBIT})")
parallel:addNode("AttackOnSelection", "attack"):setCondition("IsCloseToSelection{1}")
parallel:addNode("SetPointOfInterest", "setpoi"):setCondition("IsCloseToSelection{1}")
parallel:addNode("TriggerCooldown{".. HUNT_COOLDOWNID .."}", "increasecooldown"):setCondition("Not(IsSelectionAlive)")
end
function idle (parentnode)
local prio = parentnode:addNode("PrioritySelector", "walkuncrowded")
-- if there are too many objects (see parameter) visible of either the same npc type or the max count, leave the area
-- otherwise walk randomly around in the area around your home position
--prio:addNode("Steer(WanderAroundHome{100})", "wanderathome"):addCondition("Not(IsCrowded{10, 100})")
-- if we can't walk in our home base area, we are wandering freely around to find another not crowded area
prio:addNode("Steer(Wander)", "wanderfreely")
end
function die (parentnode)
end

14
data/server/ai/wolf.lua Normal file
View File

@ -0,0 +1,14 @@
require "ai.shared"
function wolfStayAlive (parentnode)
end
function wolf ()
local name = "ANIMAL_WOLF"
local rootNode = AI.createTree(name):createRoot("PrioritySelector", name)
wolfStayAlive(rootNode)
hunt(rootNode)
increasePopulation(rootNode)
idle(rootNode)
die(rootNode)
end

View File

@ -0,0 +1,18 @@
function animalDefault(container)
container:absolute("SPEED", 10.0)
container:absolute("HEALTH", 100.0)
container:absolute("ATTACKRANGE", 0.0)
container:absolute("STRENGTH", 5.0)
end
function init()
local wolf = attrib.createContainer("ANIMAL_WOLF")
animalDefault(wolf)
wolf:absolute("ATTACKRANGE", 2.0)
wolf:register()
local rabbit = attrib.createContainer("ANIMAL_RABBIT")
animalDefault(rabbit)
rabbit:absolute("SPEED", 9.0)
rabbit:register()
end

View File

@ -0,0 +1,7 @@
require "ai.wolf"
require "ai.rabbit"
function init ()
wolf()
rabbit()
end

BIN
data/shared/world-1.wld Normal file

Binary file not shown.

47
docs/MILESTONES.md Normal file
View File

@ -0,0 +1,47 @@
Project Voxel
-------------------
# Milestone #1
* VoxelVolume on Server [done]
* Network message to connect and send the server seed to create the client side world [done]
* VoxelVolume on Client [done]
* Render VoxelVolume on the client side [done]
* Camera movement without clipping [done]
# Milestone #2
* Network handlers for user/irrlicht movement [done]
* Irrlich movement (clipping on the Voxels) and send movement messages to the server and back to the client [done]
** lerping between the messages
* Server needs some user representation [done]
# Milestone #3
* NPCs [done]
* Network messages for spawning npcs [done]
* Network messages for npc movement [done]
* Network handlers for spawning npcs [done]
* Network handlers for npc movement [done]
* Take over NPCs
# Milestone #4
* Behaviour trees for a simple NPC chain (Shephard => Trader)
* Visibility (QuadTree in the EntityStorage::update method) [done]
# Milestone #5
* Login (Authentification and Authorization - see EntityStorage::login)
* Logout -> NPC falls asleep for some time, NPC will follow BehaviourTree again after some time
# Milestone #6
* Bigger worlds
* Some sort of AMS [done]
* Persist user data
* Persist world data on server shutdown
Voxel AMS
-------------------
* Buffs/Debuffs
* AreaEffects
* Spells/Dispells
* Skills
* Cooldowns [done]

17
fips Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
"""fips main entry"""
import os
import sys
import subprocess
proj_path = os.path.dirname(os.path.abspath(__file__))
fips_path = os.path.dirname(proj_path) + '/fips'
if not os.path.isdir(fips_path) :
print("\033[93m=== cloning fips build system to '{}':\033[0m".format(fips_path))
subprocess.call(['git', 'clone', 'https://github.com/floooh/fips.git', fips_path])
sys.path.insert(0,fips_path)
try :
from mod import fips
except ImportError :
print("\033[91m[ERROR]\033[0m failed to initialize fips build system in '{}'".format(proj_path))
sys.exit(10)
fips.run(fips_path, proj_path, sys.argv)

3
fips.cmd Normal file
View File

@ -0,0 +1,3 @@
@python fips %*

54
fips.yml Normal file
View File

@ -0,0 +1,54 @@
imports:
fips-glm:
git: https://github.com/floooh/fips-glm.git
fips-accidentalnoise:
git: https://github.com/mgerhardy/fips-accidentalnoise.git
fips-enet:
git: https://github.com/mgerhardy/fips-enet.git
fips-polyvox:
git: https://github.com/mgerhardy/fips-polyvox.git
fips-simpleai:
git: https://github.com/mgerhardy/fips-simpleai.git
fips-flatbuffers:
git: https://github.com/mgerhardy/fips-flatbuffers.git
fips-sauce:
git: https://github.com/mgerhardy/fips-sauce.git
fips-googletest:
git: https://github.com/mgerhardy/fips-googletest.git
fips-turbobadger:
git: https://github.com/fungos/fips-turbobadger.git
fips-stb:
git: https://github.com/fungos/fips-stb.git
fips-assimp:
git: https://github.com/fungos/fips-assimp.git
fips-lua:
git: https://github.com/mgerhardy/fips-lua.git
fips-zlib:
git: https://github.com/floooh/fips-zlib.git
fips-noisepp:
git: https://github.com/mgerhardy/fips-noisepp.git
exports:
header-dirs:
- src/client
- src/server
- src/worldgenerator
- src/modules
- src/modules/ui
modules:
core: src/modules/core
io: src/modules/io
video: src/modules/video
ui: src/modules/ui
util: src/modules/util
network: src/modules/network
voxel: src/modules/voxel
attrib: src/modules/attrib
noise: src/modules/noise
backend: src/modules/backend
frontend: src/modules/frontend
client: src/client
server: src/server
rcon: src/rcon
worldgenerator: src/worldgenerator
commonlua: src/modules/commonlua

Some files were not shown because too many files have changed in this diff Show More