Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gavanw committed Aug 4, 2016
0 parents commit dac3c38
Show file tree
Hide file tree
Showing 131 changed files with 101,425 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Compiled source #
###################
*.com
*.class
*.exe
*.o
*.so
*.obj
*.lastbuildstate

# Logs and databases #
######################
*.tlog
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Directories
######################
data/
debugdlls/
dlls/
freeglut/
glew/
SFML-2.1/
util/
lzz.exe
temp/
compiled/
VoxelQuest/x64/
*.suo
*.sdf
GLSLFragmentLighting.opensdf
111 changes: 111 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
cmake_minimum_required(VERSION 3.0)
project(VoxelQuest)

if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-std=c++11")
endif(CMAKE_COMPILER_IS_GNUCXX)

file(GLOB H_FILES "${CMAKE_SOURCE_DIR}/src/cpp/*.h")
file(GLOB HPP_FILES "${CMAKE_SOURCE_DIR}/src/cpp/*.hpp")

set(TEMP_OUTPUT_DIR "${CMAKE_BINARY_DIR}/temp")
set(COMPILED_OUTPUT_DIR "${CMAKE_BINARY_DIR}/compiled")

set(HEADERS_OUTPUT_FILE "${TEMP_OUTPUT_DIR}/f00270_headers.h")
set(MAIN_OUTPUT_FILE "${COMPILED_OUTPUT_DIR}/main.cpp")

add_custom_command(
OUTPUT "${TEMP_OUTPUT_DIR}"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${TEMP_OUTPUT_DIR}"
)

add_custom_command(
OUTPUT "${COMPILED_OUTPUT_DIR}"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${COMPILED_OUTPUT_DIR}"
)

foreach(H_FILE ${H_FILES})
get_filename_component(H_FILENAME "${H_FILE}" NAME)
set(H_FILE_OUTPUT "${TEMP_OUTPUT_DIR}/${H_FILENAME}")
list(APPEND TEMP_H_FILES "${H_FILE_OUTPUT}")
add_custom_command(
OUTPUT "${H_FILE_OUTPUT}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${H_FILE}" "${H_FILE_OUTPUT}"
DEPENDS "${TEMP_OUTPUT_DIR}"
MAIN_DEPENDENCY "${H_FILE}"
)
endforeach(H_FILE)

foreach(HPP_FILE ${HPP_FILES})
get_filename_component(HPP_FILENAME "${HPP_FILE}" NAME)
string(REGEX REPLACE "\\.hpp$" ".h" H_FILENAME "${HPP_FILENAME}")
string(REGEX REPLACE "\\.hpp$" ".e" E_FILENAME "${HPP_FILENAME}")
list(APPEND TEMP_H_FILES "${TEMP_OUTPUT_DIR}/${H_FILENAME}")
list(APPEND TEMP_E_FILES "${TEMP_OUTPUT_DIR}/${E_FILENAME}")
add_custom_command(
OUTPUT "${TEMP_OUTPUT_DIR}/${E_FILENAME}"
"${COMPILED_OUTPUT_DIR}/${E_FILENAME}"
"${TEMP_OUTPUT_DIR}/${H_FILENAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${HPP_FILE}" "${TEMP_OUTPUT_DIR}/${HPP_FILENAME}"
COMMAND "${CMAKE_SOURCE_DIR}/lzz" -hx e -sx h "${TEMP_OUTPUT_DIR}/${HPP_FILENAME}"
COMMAND "${CMAKE_COMMAND}" -E touch "${COMPILED_OUTPUT_DIR}/${E_FILENAME}"
WORKING_DIRECTORY "${TEMP_OUTPUT_DIR}"
DEPENDS "${TEMP_OUTPUT_DIR}" "${COMPILED_OUTPUT_DIR}"
MAIN_DEPENDENCY "${HPP_FILE}"
)
endforeach(HPP_FILE)

list(SORT TEMP_H_FILES)
list(SORT TEMP_E_FILES)

add_custom_command(
OUTPUT "${HEADERS_OUTPUT_FILE}"
COMMAND "${CMAKE_COMMAND}"
-D "INPUT_FILES=\"${TEMP_E_FILES}\""
-D "OUTPUT_FILE=\"${HEADERS_OUTPUT_FILE}\""
-P "${CMAKE_SOURCE_DIR}/cmake/cat.cmake"
DEPENDS "${TEMP_E_FILES}"
)

list(APPEND TEMP_H_FILES "${HEADERS_OUTPUT_FILE}")
list(SORT TEMP_H_FILES)

add_custom_command(
OUTPUT "${MAIN_OUTPUT_FILE}"

COMMAND "${CMAKE_COMMAND}"
-D "INPUT_FILES=\"${TEMP_H_FILES}\""
-D "OUTPUT_FILE=\"${MAIN_OUTPUT_FILE}\""
-P "${CMAKE_SOURCE_DIR}/cmake/cat.cmake"
DEPENDS "${TEMP_H_FILES}" "${COMPILED_OUTPUT_DIR}"
)

add_executable("${PROJECT_NAME}" "${MAIN_OUTPUT_FILE}")

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})


if (WIN32)
include_directories(
"${CMAKE_SOURCE_DIR}/freeglut/include"
"${CMAKE_SOURCE_DIR}/glew/include"
"${CMAKE_SOURCE_DIR}/SFML-2.1/include"
)
target_link_libraries("${PROJECT_NAME}" opengl32 glu32
"${CMAKE_SOURCE_DIR}/freeglut/lib/x64/freeglut.lib"
"${CMAKE_SOURCE_DIR}/glew/lib/Release/x64/glew32.lib"
"${CMAKE_SOURCE_DIR}/SFML-2.1/lib/sfml-system.lib"
"${CMAKE_SOURCE_DIR}/SFML-2.1/lib/sfml-audio.lib"
)
else()
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)
find_package(SFML 2 REQUIRED audio)

include_directories("${SFML_INCLUDE_DIR}")

target_link_libraries("${PROJECT_NAME}"
${OPENGL_LIBRARIES} ${GLUT_glut_LIBRARY} ${GLEW_LIBRARIES}
${SFML_LIBRARIES})
endif()
60 changes: 60 additions & 0 deletions GLSLFragmentLighting.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glew_shared", "glew\build\vc10\glew_shared.vcxproj", "{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VoxelQuest", "VoxelQuest\VoxelQuest.vcxproj", "{AEAC4286-2203-4B42-A016-BCE0503806CF}"
ProjectSection(ProjectDependencies) = postProject
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D} = {55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug MX|Win32 = Debug MX|Win32
Debug MX|x64 = Debug MX|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release MX|Win32 = Release MX|Win32
Release MX|x64 = Release MX|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug MX|Win32.ActiveCfg = Debug MX|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug MX|Win32.Build.0 = Debug MX|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug MX|x64.ActiveCfg = Debug MX|x64
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug MX|x64.Build.0 = Debug MX|x64
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug|Win32.ActiveCfg = Debug|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug|Win32.Build.0 = Debug|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug|x64.ActiveCfg = Debug|x64
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Debug|x64.Build.0 = Debug|x64
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release MX|Win32.ActiveCfg = Release MX|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release MX|Win32.Build.0 = Release MX|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release MX|x64.ActiveCfg = Release MX|x64
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release MX|x64.Build.0 = Release MX|x64
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release|Win32.ActiveCfg = Release|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release|Win32.Build.0 = Release|Win32
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release|x64.ActiveCfg = Release|x64
{55AE3D72-7DE6-F19F-AEF2-9AE8CA26CF3D}.Release|x64.Build.0 = Release|x64
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Debug MX|Win32.ActiveCfg = Debug|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Debug MX|Win32.Build.0 = Debug|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Debug MX|x64.ActiveCfg = Debug|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Debug|Win32.ActiveCfg = Debug|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Debug|Win32.Build.0 = Debug|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Debug|x64.ActiveCfg = Debug|x64
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Debug|x64.Build.0 = Debug|x64
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Release MX|Win32.ActiveCfg = Release|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Release MX|Win32.Build.0 = Release|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Release MX|x64.ActiveCfg = Release|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Release|Win32.ActiveCfg = Release|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Release|Win32.Build.0 = Release|Win32
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Release|x64.ActiveCfg = Release|x64
{AEAC4286-2203-4B42-A016-BCE0503806CF}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
VisualSVNWorkingCopyRoot =
EndGlobalSection
EndGlobal
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Gavan Woolery

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
150 changes: 150 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
IMPORTANT: FOLLOW INSTALL INSTRUCTIONS!

## ADDITIONAL REQUIRED FILES:

Download this and extract as instructed in "installing" below
https://github.com/gavanw/voxelquestiso/releases/download/0.11/resources.zip


## Voxel Quest Isometric

Voxel Quest is a project with several engine iterations. This is the very first engine iteration, and features isometric voxel rendering. See http://www.voxelquest.com for more info.

Note that this is the earliest engine iteration and many fixes have been made since then, but there is also high demand for the isometric version of the engine so I am releasing that first in spite of the fact that it is the least polished iteration.

This is a very, very, VERY rough release. There are many things wrong with the way this project is organized currently, and I am well aware of most of them but feel free to comment. A few things that are wrong: use of absolute paths (edit: now fixed by another user, please credit yourself I lost the commit info during the wipe), including all dependencies within the same project folder, unnecessary files in the repository, an all-around messy project structure, etc. In short, this thing is more fun than a jar full of angry bees!

The code is also not that well organized, but I will try to explain it as best I can.

Anyhow, I just want to get something out - I can't spend all of my time perfecting releases, and I think everyone would be better served to get the releases sooner. I will leave cleanup as an exercise to contributors and help to the best of my ability :)

## Installation

Recommended: Windows 7+, 16+ gigabytes of RAM, GTX 780+, but it should run on less.

If you wish to separate out the requirements, it uses SFML 2.1. If you wish to utilize Poco (for networking), it uses an older version of poco and you must define USE_POCO in the code.

Steps:

1) install git as needed (duh!)

2) create the parent folder where you want to store this repository (note that there will likely be more versions in the future, so you may want one folder to store all of them)

3) open cmd and navigate this folder

4) type "git clone https://github.com/gavanw/voxelquestiso.git"

5) type "cd voxelquestiso"

6) type "explorer ."

7) extract "resources.zip" to this folder (this link to this file is at the top of this readme)

8) open "GLSLFragmentLighting.sln"


## Building

VQ uses automatic header generation (via lzz) and also concatenates files and performs other operations with batch scripts. The output file is located in compiled/main.cpp (useful for debugging). However, you cannot edit this file, you must edit the files that it is based off of (i.e. if you double click on an error in Visual Studio, it will bring up the generated file). If you do not like working with generated code, you can always generate it once then disable the scripts and edit the output file(s) by hand.

The rationale for lzz and file concatenation can be found in the links below. In addition, header generation reduces the amount of code you need to maintain (bonus, you only need to have one tab open per class in your editor). Generation with concatenation simplifies the entire use of headers and relieves users of the responsibility of managing include directives.

http://stackoverflow.com/a/318440

http://stackoverflow.com/a/373179


Open "GLSLFragmentLighting.sln" in Visual Studio Express 2012 (https://www.microsoft.com/en-us/download/details.aspx?id=34673)

Simply run "Build Solution" - this will automatically invoke the required scripts during the appropriate build steps.

Prepare for errors! I have only tested this build on two machines!

## Notes on the code

Most things you will want to adjust (constants and such) are either located in the Singleton class (f00300_singleton.hpp) or includes.h (f00025_includes.h). And yes, I am aware that the use of global constants is not necessarily best practice but it was never intended to be permanent. :) Note that the numbers before the files ensure the order in which they get concatenated. Concatenation makes include directives a no-brainer and also speeds up compilation. If you need to use the include directive, it should only need to be done within includes.h. Otherwise, the automatic header generation should handle your needs (all files ending in .hpp automatically have headers generated for them, otherwise the file is concatenated as-is).

My vector class is really crappy (FIVector4) - it was intended to be a hybrid int/float 1-4 dimensional vector (basically, an uber vector) so that I could use one class for all vector types. It lacks operator overloading and is purely functional (ugh). Later engine iterations make heavier use of Bullet Physics' vector class, and Song Ho's vector/matrix classes (http://www.songho.ca/opengl/gl_matrix.html)

## Running

Executable is located in the bin folder, if not compiling.

Default controls:

Mouse + Left Button (LB): pan along the XY (ground) plane

Mouse + Right Button (RB): pan along the Z axis (HIGHLY recommended you figure out how to do this - it will load chunks around your the center of your camera location, and for all you know your camera may be way above or below where you want to load chunks - hard to tell in isometric mode but the fog does provide minor depth cues)

Mouse Wheel: zoom out (zoom out really far to get to the map, where you can pan to a new location using same controls above - HIGHLY recommended you do this on bootup, as it will likely spawn you somewhere random like the middle of an ocean)

Ctrl: show control boxes. This will bring up boxes you can manipulate using the above, while holding down ctrl. The green box controls the cutaway, the white box controls the light, the blue box controls the fog.

g: toggle edit modes: 0: no editing, 1: edit voxels (click several times with LB to add voxels, RB to remove voxels), 2: edit buildings

s: toggle macro edit mode (for edit mode 1), makes bigger chunks of terrain

d: toggle day/night

p: toggle fullscreen

tab: toggle menu

c: clear/refresh scene

r: refresh shaders

f: fog on/off

A (capital A): increase chunk load radius

Z (capital Z): decrease chunk load radius

v (while in edit mode 2): toggle building visibility

l: turn on multiple colored lights for testing (hold down ctrl to see them and move them)

e: set camera to nearest elevation

[ and ]: decrease/increase detail (shadow steps, AO steps, radiosity steps)

esc (press several times): exit

## Contributing

TBD, but for now feel free to fork it and do whatever. :)

## Credits

Lots of stuff: Gavan Woolery
Special Thanks: the 1500+ Kickstarter backers and patrons who made this possible, and my investors for allowing me to open source this.

## FAQ

q) I cannot find a way to change thing XYZ while playing the game
a) It is probably hard-coded (cringe) - jump into the code!

## License

The license for Voxel Quest is MIT (if for some reason this does not work for you, I can grant permission to use another).

The license for FreeGlut, Glew, SFML, and Poco (not actively used but deprecated references exist) all fall under the licenses of the repsective holders.

Inventory/NPC/Monster icons were purchased/licensed from 7Soul on gamedevmarket.net:
(If you use any of these icons you must purchase your own copy)

http://www.gamedevmarket.net/asset/16x16-icons-for-rpg-pack-1-915/

Logo fonts are based on work from Daniel Guldkran's Free Fonts Online site:

http://www.algonet.se/~guld1/freefont.htm

Nature sounds are under the CC BY 3.0 License from:

http://archive.org/details/Sounds_of_Nature_Collection

All other sounds and instruments were from:

http://tracker.modarchive.org/

Almost all of the code and other resources were created by me, a few things were scraped from public resources (Stack Overflow, tutorials, etc). If you see something that should be under a license but is not, please let me know.

0 comments on commit dac3c38

Please sign in to comment.