Omicron > prerelease 0.2 🎊

Changelog 👍
- caves improved
- ores added
- noises improved
- cave entrances added
- core's shell added
- wip water
- new block properties
- buildable_to type
- textures details improved
master
azekillDIABLO 2018-07-26 14:28:18 +02:00
parent 872aea995d
commit fc87988742
31 changed files with 244 additions and 101 deletions

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
.DS_Store
Makefile
CMakeCache.txt
CMakeFiles
cmake_install.cmake
config.py
craft
world
env
log.txt
*.o
*.db
*.exe
*.dll
*.pyc

View File

@ -208,6 +208,9 @@ Omicron_BINARY_DIR:STATIC=/home/tux/Dev ++/Omicron
//Value Computed by CMake
Omicron_SOURCE_DIR:STATIC=/home/tux/Dev ++/Omicron
//pkg-config executable
PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config
//Path to a library.
RT_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/librt.so
@ -547,10 +550,36 @@ DOXYGEN_EXECUTABLE-ADVANCED:INTERNAL=1
FIND_PACKAGE_MESSAGE_DETAILS_CURL:INTERNAL=[/usr/lib/x86_64-linux-gnu/libcurl.so][/usr/include/x86_64-linux-gnu][v7.52.1()]
//Details about finding OpenGL
FIND_PACKAGE_MESSAGE_DETAILS_OpenGL:INTERNAL=[/usr/lib/x86_64-linux-gnu/libGL.so][/usr/include][v()]
//Details about finding PkgConfig
FIND_PACKAGE_MESSAGE_DETAILS_PkgConfig:INTERNAL=[/usr/bin/pkg-config][v0.29()]
//Details about finding Threads
FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()]
//Details about finding X11
FIND_PACKAGE_MESSAGE_DETAILS_X11:INTERNAL=[/usr/lib/x86_64-linux-gnu/libX11.so][/usr/include]
GTK3_CFLAGS:INTERNAL=
GTK3_CFLAGS_I:INTERNAL=
GTK3_CFLAGS_OTHER:INTERNAL=
GTK3_FOUND:INTERNAL=
GTK3_INCLUDEDIR:INTERNAL=
GTK3_LIBDIR:INTERNAL=
GTK3_LIBS:INTERNAL=
GTK3_LIBS_L:INTERNAL=
GTK3_LIBS_OTHER:INTERNAL=
GTK3_LIBS_PATHS:INTERNAL=
GTK3_PREFIX:INTERNAL=
GTK3_STATIC_CFLAGS:INTERNAL=
GTK3_STATIC_CFLAGS_I:INTERNAL=
GTK3_STATIC_CFLAGS_OTHER:INTERNAL=
GTK3_STATIC_LIBDIR:INTERNAL=
GTK3_STATIC_LIBS:INTERNAL=
GTK3_STATIC_LIBS_L:INTERNAL=
GTK3_STATIC_LIBS_OTHER:INTERNAL=
GTK3_STATIC_LIBS_PATHS:INTERNAL=
GTK3_VERSION:INTERNAL=
GTK3_gtk+-3.0_INCLUDEDIR:INTERNAL=
GTK3_gtk+-3.0_LIBDIR:INTERNAL=
GTK3_gtk+-3.0_PREFIX:INTERNAL=
GTK3_gtk+-3.0_VERSION:INTERNAL=
//ADVANCED property for variable: MATH_LIBRARY
MATH_LIBRARY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: OPENGL_INCLUDE_DIR
@ -561,6 +590,8 @@ OPENGL_gl_LIBRARY-ADVANCED:INTERNAL=1
OPENGL_glu_LIBRARY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: OPENGL_xmesa_INCLUDE_DIR
OPENGL_xmesa_INCLUDE_DIR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE
PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: RT_LIBRARY
RT_LIBRARY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: X11_ICE_INCLUDE_PATH

View File

@ -451,6 +451,10 @@ config.h
/home/tux/Dev ++/Omicron/src/config.h
/home/tux/Dev ++/Omicron/src/worldgen/base_terrain.c
stdio.h
-
stdlib.h
-
base_terrain.h
/home/tux/Dev ++/Omicron/src/worldgen/base_terrain.h
noise.h

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,6 @@
## Omicron by azekill_DIABLO
## Omicron by azekill_DIABLO > pre-release 0.2
This game is a voxelly sandbox-game with procedurally generated world!
Fork of CraftNG by Twetzel59 which is also a Fork of Michael Fogleman's Minecraft clone for Windows, Mac OS X and Linux.
@ -29,7 +31,7 @@ Linux release : *<link here>*
### Running the game
Mac and Windows: Click on the executable file, the game should run.
Linux: Open terminal in the directory of the game and type ./omicron`
Linux: Open terminal in the directory of the game and type `./omicron`
See below to run from source.
@ -42,15 +44,15 @@ Download and install [CMake](http://www.cmake.org/cmake/resources/software.html)
if you don't already have it. You may use [Homebrew](http://brew.sh) to simplify
the installation:
brew install cmake
`brew install cmake`
#### Linux (Ubuntu)
sudo apt-get install cmake libglew-dev xorg-dev libcurl4-openssl-dev
sudo apt-get build-dep glfw
`sudo apt-get install cmake libglew-dev xorg-dev libcurl4-openssl-dev
sudo apt-get build-dep glfw`
*Under debian (tested under AntiX) it seems you need to run each install
of the first line separately in order to install without errors.*
*Under debian (tested under AntiX) it seems you need to run each install
of the first line separately in order to install without errors.*
#### Windows
@ -62,17 +64,17 @@ CURL/lib and CURL/include are in your Program Files directory.
Use the following commands in place of the ones described in the next section.
cmake -G "MinGW Makefiles"
mingw32-make
`cmake -G "MinGW Makefiles"
mingw32-make`
### Compile and Run
Once you have the dependencies (see above), install the sources and open the
terminal in the dowloaded source directory. Run the following commands :
cmake .
`cmake .
make
./omicron
./craft`
### Multiplayer

BIN
auth.db

Binary file not shown.

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
omicron

Binary file not shown.

View File

@ -116,10 +116,12 @@ void make_cube(
int wbottom = blocks[w][3];
int wfront = blocks[w][4];
int wback = blocks[w][5];
make_cube_faces(
data, ao, light,
left, right, top, bottom, front, back,
wleft, wright, wtop, wbottom, wfront, wback,
//left, right, top, bottom, front, back,
x, y, z, n, noncube_type(w));
}

View File

@ -13,7 +13,7 @@ void make_cube(
float *data, float ao[6][4], float light[6][4],
int left, int right, int top, int bottom, int front, int back,
float x, float y, float z, float n, int w);
void make_plant(
float *data, float ao, float light,
float px, float py, float pz, float n, int w, float rotation);

View File

@ -6,6 +6,7 @@ const int items[] = {
Item_GRASS,
Item_SAND,
Item_STONEBRICK,
Item_SLAB_LOWER_STONEBRICK,
Item_BRICK,
Item_WOOD,
Item_STONE,
@ -23,7 +24,10 @@ const int items[] = {
Item_WATER,
Item_CACTUS,
Item_PLAYER,
Item_SLAB_LOWER_STONEBRICK,
Item_COAL_ORE,
Item_IRON_ORE,
Item_GOLD_ORE,
Item_RUBIS_ORE,
//Flowers
Item_TALL_GRASS,
@ -151,8 +155,12 @@ const int blocks[256][6] = {
{0, 0, 0, 0, 0, 0}, // 66
{0, 0, 0, 0, 0, 0}, // 67
{2, 2, 2, 2, 2, 2}, // 68 - stonebrick slab
{255, 255, 211, 255, 255, 255}, // 69 - water
{211, 211, 211, 211, 211, 211}, // 69 - water
{212, 212, 212, 212, 212, 212}, // 70 - core shell
{64, 64, 64, 64, 64, 64}, // 71 - coal ore
{65, 65, 65, 65, 65, 65}, // 72 - iron ore
{66, 66, 66, 66, 66, 66}, // 73 - gold ore
{67, 67, 67, 67, 67, 67}, // 74 - rubis ore
{0, 0, 0, 0, 0, 0} // 71 - empty
};
@ -227,7 +235,7 @@ int is_transparent(int w) {
case Item_EMPTY:
case Item_GLASS:
//case Item_LEAVES: for better performance (8 fps -> 60fps OPTIMIZATION NEEDED!)
case Item_WATER: //Just to stop Xray-ing :D
case Item_WATER: //Just to stop Xray-ing
return 1;
default:
return 0;
@ -239,7 +247,7 @@ int is_destructable(int w) {
case Item_EMPTY:
case Item_CLOUD:
case Item_CORESHELL:
//case Item_WATER
case Item_WATER:
return 0;
default:
return 1;
@ -249,6 +257,16 @@ int is_destructable(int w) {
int buildable_to(int w) {
switch (w) {
case Item_WATER:
case Item_CLOUD:
case Item_TALL_GRASS:
case Item_YELLOW_FLOWER:
case Item_RED_FLOWER:
case Item_PURPLE_FLOWER:
case Item_SUN_FLOWER:
case Item_WHITE_FLOWER:
case Item_BLUE_FLOWER:
case Item_VINE:
case Item_CACTI:
return 0;
default:
return 1;
@ -258,7 +276,6 @@ int buildable_to(int w) {
int is_climbable(int w) {
switch(w) {
case Item_VINE:
//case Item_WATER:
return 1;
default:
return 0;

View File

@ -65,6 +65,10 @@ typedef enum {
Item_SLAB_LOWER_STONEBRICK,
Item_WATER,
Item_CORESHELL,
Item_COAL_ORE,
Item_IRON_ORE,
Item_GOLD_ORE,
Item_RUBIS_ORE,
Item_max
} Item;

View File

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
//#include <gtk.h>
#include "attrib.h"
#include "auth.h"
#include "chunk.h"
@ -835,6 +836,7 @@ void compute_chunk(WorkerItem *item) {
int y = ey - oy;
int z = ez - oz;
int w = ew;
// TODO: this should be unnecessary
if (x < 0 || y < 0 || z < 0) {
continue;
@ -847,6 +849,35 @@ void compute_chunk(WorkerItem *item) {
if (opaque[XYZ(x, y, z)]) {
highest[XZ(x, z)] = MAX(highest[XZ(x, z)], y);
}
/*
if (!is_transparent(w)) {
if (!opaque[XYZ(x, y + 1, z)]) {
opaque[XYZ(x, y + 1, z)];
}
if (!opaque[XYZ(x, y - 1, z)] && (ey > 0)) {
opaque[XYZ(x, y - 1, z)];
}
if (!opaque[XYZ(x + 1, y, z)]){
opaque[XYZ(x + 1, y, z)];
}
if (!opaque[XYZ(x - 1, y, z)]){
opaque[XYZ(x - 1, y, z)];
}
if (!opaque[XYZ(x, y, z + 1)]){
opaque[XYZ(x, y, z + 1)];
}
if (!opaque[XYZ(x, y, z - 1)]){
opaque[XYZ(x, y, z - 1)];
}
}
*/
} END_MAP_FOR_EACH;
}
}
@ -2011,31 +2042,36 @@ void on_left_click() {
State *s = &g->players->state;
int hx, hy, hz;
int hw = hit_test(0, s->x, s->y, s->z, s->rx, s->ry, &hx, &hy, &hz);
if (hy > 0 && hy < BUILD_HEIGHT_LIMIT && is_destructable(hw) && Inventory_collect(&g->inventory, hw)) {
set_block(hx, hy, hz, 0);
record_block(hx, hy, hz, 0);
if (is_plant(get_block(hx, hy + 1, hz))) {
set_block(hx, hy + 1, hz, 0);
}
}
int mining = 1;
//while (mining = 1) {
if (hy > 0 && hy < BUILD_HEIGHT_LIMIT && is_destructable(hw) && Inventory_collect(&g->inventory, hw)) {
set_block(hx, hy, hz, 0);
record_block(hx, hy, hz, 0);
if (is_plant(get_block(hx, hy + 1, hz))) {
set_block(hx, hy + 1, hz, 0);
}
}
//}
}
void on_right_click() {
State *s = &g->players->state;
int hx, hy, hz;
int hw = hit_test(1, s->x, s->y, s->z, s->rx, s->ry, &hx, &hy, &hz);
int nx, ny, nz;
int hwb = hit_test(0, s->x, s->y, s->z, s->rx, s->ry, &nx, &ny, &nz);
if (hy > 0 && hy < BUILD_HEIGHT_LIMIT && is_obstacle(hw) && Inventory_use(&g->inventory, items[g->item_index])) {
if (!player_intersects_block(2, s->x, s->y, s->z, hx, hy, hz)) {
set_block(hx, hy, hz, items[g->item_index]);
record_block(hx, hy, hz, items[g->item_index]);
}
}
if (hy > 0 && hy < BUILD_HEIGHT_LIMIT && !buildable_to(hw) && Inventory_use(&g->inventory, items[g->item_index])) {
if (!player_intersects_block(2, s->x, s->y, s->z, hx, hy, hz)) {
set_block(hx, hy-1, hz, items[g->item_index]);
record_block(hx, hy-1, hz, items[g->item_index]);
}
} else if (ny > 0 && ny < BUILD_HEIGHT_LIMIT && !buildable_to(hwb) && Inventory_use(&g->inventory, items[g->item_index])) {
if (!player_intersects_block(2, s->x, s->y, s->z, hx, hy, hz)) {
set_block(nx, ny, nz, items[g->item_index]);
record_block(hx, hy, hz, items[g->item_index]);
}
}
}
@ -2731,7 +2767,6 @@ int main(int argc, char **argv) {
s->y = highest_block(s->x, s->z) + 2;
}
// BEGIN MAIN LOOP //
double previous = glfwGetTime();
while (1) {
@ -2763,12 +2798,6 @@ int main(int argc, char **argv) {
handle_mouse_input();
// ######## //
// Add gui? //
// ######## //
//render_text(&text_attrib, ALIGN_RIGHT, tx, ty, ts, "Omicron", g->width, g->height);
// HANDLE MOVEMENT //
handle_movement(dt);
@ -2922,7 +2951,7 @@ int main(int argc, char **argv) {
}
// SHUTDOWN //
printf("Omicron: Game closing ...");
printf("\nOmicron: Game closing ... \n");
db_save_state(s->x, s->y, s->z, s->rx, s->ry);
db_close();
db_disable();

View File

@ -7,6 +7,7 @@
typedef struct {
int id;
int hp;
char name[MAX_NAME_LENGTH];
State state;
State state1;

View File

@ -146,7 +146,7 @@ void draw_player(Attrib *attrib, Player *player) {
GLuint gen_crosshair_buffer(int width, int height, int scale) {
int x = width / 2;
int y = height / 2;
int p = 10 * scale;
int p = 11 * scale;
float data[] = {
x, y - p, x, y + p,
x - p, y, x + p, y

View File

@ -1,61 +1,42 @@
#include <stdio.h>
#include <stdlib.h>
#include "base_terrain.h"
#include "noise.h"
#include "../config.h"
#include "../item.h"
#include "../util.h"
const int caveitems[] = {
// items that caves can "dig" trough (Unused)
Item_GRASS,
Item_SAND,
Item_WOOD,
Item_STONE,
Item_DIRT,
Item_SNOW,
Item_LEAVES,
Item_CACTUS,
Item_TALL_GRASS,
Item_YELLOW_FLOWER,
Item_RED_FLOWER,
Item_PURPLE_FLOWER,
Item_SUN_FLOWER,
Item_WHITE_FLOWER,
Item_BLUE_FLOWER,
Item_VINE,
Item_CACTI
};
void generateBaseTerrain(int dx, int dz, int x, int z, int start_h, int h, int flag, world_func func, void *arg) {
for(int y = start_h; y < h; y++) {
//-- ugly caves
//float cave1 = simplex3(x, y, z, 8, 1.8, 1.5);
//float cave2 = simplex3(x, y, z, 12, 2.8, 0.5);
//float cave1 = simplex2(x, y + 1, 3, 0.8, 0.5);
//float cave2 = simplex2(x + 1, y, 3, 0.8, 0.5);
//if(ABS(cave1 - cave2) < 0.1) {
// func(x, y, z, Item_STONE, arg);
//}
//-- ugly caves
// small caves
if ((y < 2 || y > 36) || (simplex3(x * 0.05, y * 0.05, z * 0.05, 16, 0.05, 5)
+ simplex3(x * 0.05, y * 0.05, z * 0.05, 16, 0.05, 5) < 1.25)) {
func(x, y, z, Item_STONE, arg);
for (int y = 1; y < 34; y++) {
func(x, y, z, Item_STONE, arg);
}
// big caves
// if ((y < 2 || y > h - 5) || (simplex3(x * 0.005, y * 0.05, z * 0.005, 15, 0.1, 5)
// + simplex3(x * 0.005, y * 0.05, z * 0.005, 20, 0.05, 1) < 1.25)) {
// func(x, y, z, Item_STONE, arg);
//}
// Ores generation system
for (int y = 2; y < 30; y++) {
if (simplex3(x * 0.12, y * 0.12, z * 0.12, 6, 0.5, 2) > 0.74) {
int rand_num = (rand() % 100);
if (y < 10 && rand_num < 15) {
func(x, y-1, z, Item_RUBIS_ORE * flag, arg);
} else if (y < 20 && rand_num < 30) {
func(x, y, z, Item_GOLD_ORE * flag, arg);
} else if (y < 20 && rand_num < 65) {
func(x, y, z, Item_IRON_ORE * flag, arg);
} else if (y < 30 && rand_num < 85) {
func(x, y, z, Item_COAL_ORE * flag, arg);
}
}
}
// Caves
for (int y = 1; y < 38; y++) {
if (simplex3(
x * 0.06, y * 0.08, z * 0.06, 8, 0.3, 2) > 0.64) {
func(x, y, z, 0 * flag, arg);
}
}
}
}

View File

@ -10,29 +10,34 @@ void generateMesa(int dx, int dz, int x, int z, int start_h, int h, int flag, wo
//func(x, 37, z, Item_WATER * flag, arg);
//func(x, 36, z, Item_WATER * flag, arg);
//}
// filler to avoid renderer glitch
//func(x, y, z, 0 * flag, arg);
if (y < 66) {
func(x, y, z, Item_DIRT * flag, arg);
func(x, y+1, z, Item_DIRT * flag, arg);
}
if (y < 65) {
func(x, y, z, 51 * flag, arg);
func(x, y+1, z, 51 * flag, arg);
}
if (y < 60) {
func(x, y, z, 52 * flag, arg);
func(x, y+1, z, 52 * flag, arg);
}
if (y < 55) {
func(x, y, z, 53 * flag, arg);
func(x, y+1, z, 53 * flag, arg);
}
if (y < 50) {
func(x, y, z, 54 * flag, arg);
func(x, y+1, z, 54 * flag, arg);
}
if (y < 45) {
func(x, y+1, z, Item_SAND * flag, arg);
func(x, y, z, Item_SAND * flag, arg);
}
// I don't even know why it does this but it looks sick
if (simplex2(x * 0.005, -z * 0.005, 4, 0.8, 2) > 0.7) {
if (h = 67) {
func(x, h-1, z, Item_DIRT * flag, arg);
func(x, h, z, Item_DIRT * flag, arg);
}
}
}

View File

@ -10,7 +10,7 @@ void generateRainforest(int dx, int dz, int x, int z, int start_h, int h, int fl
func(x, h - 1, z, Item_GRASS * flag, arg);
// grass
if (simplex2(-x * 0.1, z * 0.1, 4, 0.8, 2) > 0.4) {
if (simplex2(-x * 0.1, z * 0.1, 4, 0.8, 2) > 0.5) {
func(x, h, z, 17 * flag, arg);
}
// flowers

View File

@ -27,6 +27,14 @@ void generateTemperate(int dx, int dz, int x, int z, int start_h, int h, int fla
func(x, h, z, w * flag, arg);
}
}
// rocks
if (simplex2(x * 0.02, -z * 0.02, 4, 0.8, 2) > 0.75) {
if (h > 72) {
func(x, h-1, z, Item_STONE * flag, arg);
func(x, h, z, Item_STONE * flag, arg);
}
}
// trees
if (h > 38) {
@ -54,4 +62,31 @@ void generateTemperate(int dx, int dz, int x, int z, int start_h, int h, int fla
}
}
}
// elder trees
if (h > 38) {
int ok = 1;
if (dx - 4 < 0 || dz - 4 < 0 ||
dx + 4 >= CHUNK_SIZE || dz + 4 >= CHUNK_SIZE)
{
ok = 0;
}
if (ok && simplex2(x, z, 7, 0.6, 2) > 0.85) {
for (int y = h + 4; y < h + 18; y++) {
for (int ox = -4; ox <= 4; ox++) {
for (int oz = -4; oz <= 4; oz++) {
int d = (ox * ox) + (oz * oz) +
(y - (h + 6)) * (y - (h + 6));
if (d < 18) {
func(x + ox, y, z + oz, 15, arg);
}
}
}
}
for (int y = h; y < h + 10; y++) {
func(x, y, z, 5, arg);
}
}
}
}

View File

@ -49,6 +49,7 @@ void create_world(int p, int q, world_func func, void *arg) {
generateBaseTerrain(dx, dz, x, z, 0, 32, flag, func, arg);
//generateBaseTerrain(dx, dz, x, z, 32, 32 + h, flag, func, arg);
// clouds
for (int y = 120; y < 200; y++) {
if (simplex3(
@ -57,18 +58,33 @@ void create_world(int p, int q, world_func func, void *arg) {
func(x, y, z, 16 * flag, arg);
}
}
// Flying dirt patches
/* Flying dirt patches = bad idea
for (int yb = 170; yb < 255; yb++) {
if (simplex3(
x * 0.002, yb * 0.004, z * 0.002, 7, 0.5, 2) > 0.72)
x * 0.002, yb * 0.004, z * 0.002, 7, 0.5, 2) > 0.80)
{
func(x, yb, z, Item_DIRT * flag, arg);
//if (x > 100 && x < -100 && z > 100 && z < -100) {
func(x, yb, z, Item_DIRT * flag, arg);
//}
}
}
}*/
// Core shell
func(x, 1, z, Item_CORESHELL * flag, arg);
// Unbreakable Core shell
func(x, 0, z, Item_CORESHELL * flag, arg);
if (simplex2(
x * 0.5, z * 0.5, 7, 3, 5) > 0.6)
{
func(x, 1, z, Item_CORESHELL * flag, arg);
}
// Buildings
// Brick Pyramid
//for (int b = 50; b < 100; b++) {
// func(b, b, b, Item_BRICK * flag, arg);
//}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 35 KiB