Thursday, 23 August 2012

Segfault, an impasse.

SDL2.0 to create a modern OpenGL context.

I've been having difficulty finding documentation for SDL2.0 so I'm going to record the invocations here as I find them... (With thanks to everyone who's helped me find them)

Once I've got a better (and full) handle on it I might try to right a well written tutorial... For now I'll just record my findings.

Requesting a given version of OpenGL


This appears to disable the compatibility profile/enable the core profile only. I need to check this though.

Creating an OpenGL context...

int width = 640; int height = 480;
SDL_Window* pWindow;
SDL_GLContext context;
int other_flags = 0;

pWindow = SDL_CreateWindow("Title", 
width, height, 

context = SDL_GL_CreateContext(pWindow);

Verifying that the Context was created successfully...

const unsigned char* version = glGetString(GL_VERSION);
if (version == NULL) {
// Failed to initialise, error logging here

Flushing pipeline...


Todo: Figure out how to compile/link a shader.

Tuesday, 14 August 2012

Crossplatform Development?

So. I'm finally going back to C++... and remembering why I learned Python to get away from certain things.

Most notably is the pain of setting up Makefiles by hand. Still. I think I've hit on something. Relative to my project's directory...

I have a folder for my build which contains a Makefile customised for that platform. On windows this is...


CFLAGS=-g -O0 -Wall -pedantic -Wno-long-long
LIBS=-lmingw32 -lSDLmain -lSDL -lopengl32 -lphysfs

DLL=SDL.dll libphysfs.dll

include ../src/Makefile.core

It explicitly specifies CC and CXX because I tend to use Cygwin as a replacement shell and it allows me to use make instead of mingw32-make.exe.




all: Coulomb.exe $(DLL)

-include $(DEPS)

Coulomb.exe: $(OBJECTS)
$(CXX) -o Coulomb.exe $(OBJECTS) $(LIBS)

define cc-command
$(CXX) -o $@ -c $< $(CFLAGS)

define depend-command
$(CXX) -MM -MF $(patsubst %.o,%.d,$@) $< $(CFLAGS)

data/%.o: ../src/data/%.cxx

%.o: ../src/%.cxx

%.dll: ../%.dll
cp $< .

.phony: all clean

rm -rf *.exe
rm -rf *.o
rm -rf data/*.o
rm -rf *.d
rm -rf data/*.d
rm -rf *.dll

Unfortunately I still don't really know what I'm going to do with this set up yet. I'd appreciate any comments on the Makefile set up though.

Saturday, 4 August 2012

DuelFieldStars v1 release

I have decided that the DuelFieldStars project no-longer interests me.

Originally I was only going to implement the features it has now and everything else, that I did not implement, were extra things I added to my ambitions. So I am quite happy calling it here.

This has also given me opportunity to play with py2exe. I think in the future I will try to organise my project with py2exe in mind.

Windows distributable:
Clone source (reqs. Python2.7 and Pygame):

I guess this means I need to look for a new project now...

Saturday, 7 July 2012

"Im Nebel einer Ungewißheit"

The game now has a... minimal implementation of 'fog of war'. At present the three reports can penetrate the fog, but it shouldn't be too hard to adjust them.

The basic idea is that you can only 'sense' out to your Sensor Technology rank in range. You can research Stealth Technology to allow your ships to effectively negate enemy Sensor Tech - meaning that the 'fog of war' shown in the above image is an optimistic estimate, rather than absolute. Fortunately you can always detect things in the same game tile as a friendly ship or world.

At the moment it is still somewhat... buggy, but hopefully this week I can get it tightened up to work more closely with how it should.

As you begin with 1 game tile of sensor range and 3 tiles of movement range the intention is, in the early game, to be very 'Star Trek'/submarine, with unexpected encounters near worlds while ships sail past each other undetected in deep space. Towards the late game there will be Special Technology paths like remote sensor platforms that can remove this uncertainty... But you always have the option of concentrating on Stealth (which, I hope, will play very nicely with the Jump Drive tech path) to allow out-manoeuvring on the offense.

Friday, 29 June 2012

Ledgers and reports, oh my!

So it's painfully obvious that, even ignoring learning curve issues/lack of documentation, my game is really hard to play.

I've gotten all three 'reports' lists working: a list of all ships, a list of all worlds and a list of events. The former two even have a choice of three filters. The addition of colour-coding to the event reporter seems to have fixed -some- of the issues... and now it's possible to use the ship report to find only idle ships.

I am still unsure.

Saturday, 23 June 2012

"Who wrote this silly code..."

It's been, well, months now since the eagerly awaited C++0x came out and I have found that I have looked into none of it. Partly out of my promise to finish my Python game. Partly because of exam stress.

Still, despite making good progress writing DuelFieldStars as a sprint I find myself, more and more, longing to really get back into C++ code and staring at my Python wondering who wrote this silly code...