GithubHelp home page GithubHelp logo

goblinhack / zorbash Goto Github PK

View Code? Open in Web Editor NEW
43.0 6.0 6.0 4.29 GB

An ascii and/or pixelart roguelike.

License: GNU General Public License v3.0

Shell 0.54% Python 33.40% Makefile 0.01% C++ 66.01% Dockerfile 0.05%
c-plus-plus roguelike roguelike-game python3 pixel-art rogue-like turn-based ubuntu opengl pixelart

zorbash's Issues

build improvements

Suggestions for improving your current Makefiles (1 small, 1 big):

  1. Make sure to use '.PHONY' for all Makefile targets that aren't actual files
  2. Object file dependencies are only being created once by build/build.sh with makedepend - no reason you can't change your Makefile to automatically regenerate file dependency info (and also remove need for makedepend).

Here's a sample makefile I created to replace the one generated in src/ (forgive the weird formatting):
COMPILER_FLAGS = -I/usr/include/SDL2 -I/usr/include/python3.9 -DMYVER=\"0.0.4\" -DPYVER=\"3.9\" -O3
CLANG_COMPILER_WARNINGS = -Wall -std=c++2a
GCC_COMPILER_WARNINGS = -x c++ -Wall -std=c++2a

LDFLAGS = -rdynamic
COMPILER_WARNINGS = $(CLANG_COMPILER_WARNINGS)
CC = clang++

EXE =
DSYM =
LDLIBS = -pthread -lSDL2 -lSDL2_mixer -lSDL2_ttf -L/usr/lib64 -lpython3.9 -lcrypt -lpthread -ldl -lutil -lm -lm -lGL
CFLAGS = $(COMPILER_FLAGS) $(COMPILER_WARNINGS)

NAME = zorbash-game
OBJDIR = .build

TARGET_GAME = $(NAME)$(EXE)
.PHONY: all
all: $(TARGET_GAME)

GAME_SOURCE := $(wildcard *.cpp) $(wildcard *.S)
GAME_OBJECTS :=\
$(addprefix $(OBJDIR)/,$(addsuffix .o,$(basename $(GAME_SOURCE))))

DEP_FILES := $(patsubst %.o,%.d,$(GAME_OBJECTS))
DEP_FLAGS = -MMD -MP

$(OBJDIR): ; mkdir -p $(OBJDIR)
$(GAME_OBJECTS): | $(OBJDIR)

$(OBJDIR)/%.o: %.cpp
<tab>$(CC) $(EXTRA_CFLAGS) $(CFLAGS) $(DEP_FLAGS) -c -o $@ $<

$(OBJDIR)/%.o: %.S
<tab>$(CC) $(DEP_FLAGS) -c -o $@ $<

# link
$(TARGET_GAME): $(GAME_OBJECTS)
<tab>$(CC) $(LDFLAGS) $(GAME_OBJECTS) $(LDLIBS) -o $@

# format/clean/clobber
.PHONY: format clean clobber

format:
<tab>clang-format -i *cpp *hpp

clean:
<tab>rm -f ../$(TARGET_GAME) ../stdout.txt ../stderr.txt
<tab>rm -f $(TARGET_GAME) stdout.txt stderr.txt
<tab>rm -rf $(OBJDIR)

clobber: clean
<tab>rm -rf $(OBJDIR)
<tab>mkdir -p $(OBJDIR)

# delete corresponding object file if dependency file needs regeneration
$(OBJDIR)/%.d: ; @rm -f "$(@:.d=.o)"

# include all dependency files
-include $(DEP_FILES)

Change summary:

  1. 'GAME_SOURCE' is defined to contain all your source files (set by wildcard, but it could be a list of files if you don't want to build everything in src/). object files are never listed directly.
  2. GAME_OBJECTS created from GAME_SOURCE
  3. DEP_FILES defined to hold a list of all generated dependency files (.d)
  4. DEP_FLAGS has compiler flags needed to make g++/clang++ generate a dependency file for each source file while compiling
  5. set up makefile targets/dependency to create OBJDIR directory when needed - it doesn't need to be created by clean/clobber any more
  6. %.cpp/%.S source file compile rules changed to include DEP_FLAGS
  7. when makefile starts up, it tires to include dependency files for all source files. If any are missing or out-of-date, corresponding objects files are deleted to trigger the creation of new dependency files

build issues

Hello - I found your project while doing a search for C++ roguelikes. Seems very interesting!
Anyways, I managed to build it on my Fedora 34 system but I did run into a few small issues:

  1. The root Makefile couldn't find 'RUNME' (the current directory isn't normally in the search path for most systems). A quick edit of the Makefile to change it to './RUNME' fixed this problem.
  2. You seem to be running clang-format on the source as part of the build process. This caused a lot of files to be changed and made pulling new changes impossible without doing a 'git restore' first. Seems like it would be better to do clang-format as part of your check-in process (maybe with a new makefile target that could be run manually.)

minor build issue

I upgraded my system to Fedora 35 and its newer python version uncovered some minor issues.

  1. build/build.sh creates these files so they should be removed from source control:
    • build/windows/python.version.sh
    • build/windows/windows.xml
  2. .gitignore has the wrong path for these files as well. These .gitignore changes are needed:
    • windows/python.version.sh -> build/windows/python.version.sh
    • windows/windows.xml -> build/windows/windows.xml

Problems compile under GNU/Linux x64

Good day ...

The program doesn't finish the compilation, because I can't find the SDL2 [Maybe] library (which I have in its version 2.0.9), the problem is probably due in part to me, since I have compiled both SDL and SDL2, so the program [probably] won't be able to determine exactly which library to use.

Thanks ....

build.log

doesn't compile for python 3.11

I recently upgraded to Fedora 37 (which includes python 3.11) and now get the following compile warnings & errors:

clang++   -I/usr/include/SDL2 -I/usr/include/python3.11 -include config.h -O3  -Wall  -std=c++2a    -MMD -MP -c -o .build/py_ttf.o py_ttf.cpp
python.cpp:118:3: warning: 'PySys_SetPath' is deprecated [-Wdeprecated-declarations]
  PySys_SetPath(wc_new_path);
  ^
/usr/include/python3.11/sysmodule.h:15:1: note: 'PySys_SetPath' has been explicitly marked deprecated here
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
^
/usr/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))


clang++   -I/usr/include/SDL2 -I/usr/include/python3.11 -include config.h -O3  -Wall  -std=c++2a    -MMD -MP -c -o .build/random_name.o random_name.cpp
python_log.cpp:173:25: error: no member named 'frame' in '_ts'; did you mean 'cframe'?
  if (tstate && tstate->frame) {
                        ^~~~~
                        cframe
/usr/include/python3.11/cpython/pystate.h:110:16: note: 'cframe' declared here
    _PyCFrame *cframe;
               ^
python_log.cpp:174:36: error: no member named 'frame' in '_ts'
    PyFrameObject *frame = tstate->frame;
                           ~~~~~~  ^
python_log.cpp:179:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      int   line     = frame->f_lineno;
                            ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^
python_log.cpp:180:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      char *filename = py_obj_to_string(frame->f_code->co_filename);
                                             ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^
python_log.cpp:181:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      char *funcname = py_obj_to_string(frame->f_code->co_name);
                                             ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^
python_log.cpp:183:20: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      frame = frame->f_back;
                   ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^
python_log.cpp:200:25: error: no member named 'frame' in '_ts'; did you mean 'cframe'?
  if (tstate && tstate->frame) {
                        ^~~~~
                        cframe
/usr/include/python3.11/cpython/pystate.h:110:16: note: 'cframe' declared here
    _PyCFrame *cframe;
               ^
python_log.cpp:201:36: error: no member named 'frame' in '_ts'
    PyFrameObject *frame = tstate->frame;
                           ~~~~~~  ^
python_log.cpp:208:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      int   line     = frame->f_lineno;
                            ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^
python_log.cpp:209:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      char *filename = py_obj_to_string(frame->f_code->co_filename);
                                             ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^
python_log.cpp:210:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      char *funcname = py_obj_to_string(frame->f_code->co_name);
                                             ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^
python_log.cpp:212:20: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
      frame = frame->f_back;
                   ^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
               ^

fixes needed for libstdc++ v12

Are you accepting pull requests? I have some fixes for compile errors & warnings I found when I upgraded to gcc 12 (which includes libstdc++)

Here's my 'git diff' output in case you would rather handle the fixes yourself:
diff --git a/src/my_range.hpp b/src/my_range.hpp
index 51a9f711b..b2dba9abd 100644
--- a/src/my_range.hpp
+++ b/src/my_range.hpp
@@ -5,6 +5,8 @@

#pragma once
#include
+#include
+#include

//
// Create a vector of numbers
@@ -27,8 +29,6 @@ template < class T > std::vector< T > make_range(T start, T stop)
//
// Create a vector of numbers and then shuffle them
//
-#include
-#include
extern std::default_random_engine rng;
template < class T > std::vector< T > make_shuffled_range(const size_t how_many)
{

diff --git a/src/my_wid.hpp b/src/my_wid.hpp
index d412cfc72..96ddd3eaa 100644
--- a/src/my_wid.hpp
+++ b/src/my_wid.hpp
@@ -308,7 +308,7 @@ public:
uint64_t key {};
};

-struct tree_wid_key_cmp : public std::binary_function< class tree_wid_key, class tree_wid_key, bool > {
+struct tree_wid_key_cmp {
bool operator()(const tree_wid_key &lhs, const tree_wid_key &rhs) const
{
if (lhs.priority < rhs.priority) {

diff --git a/src/string.cpp b/src/string.cpp
index 260115c3a..00d372f0c 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -7,6 +7,7 @@
#include <libgen.h>
#include
#include
+#include

#include "my_ptrcheck.hpp"
#include "my_sdl.hpp"

compile errors for libstdc++v13

Hi - I opened a pull request to fix compile errors with the latest gcc/libstdc++ v13.
Just opening an issue as well in case you didn't see it.
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.