Temple of The Roguelike Forums
Development => Programming => Topic started by: Krice on May 15, 2011, 09:52:30 AM
-
I'm bored with my current projects. It could be nice to do something else to keep the interest. Any ideas? I've thought of re-programming some old school C roguelike to C++, but Nethack is out of question, the source code is too messy and big.
-
You could roam around the Roguelike graveyard and practice some necromancy.
http://www.graveyard.roguelikedevelopment.org/
There might be a C Roguelike around there that you could re-program into C++ easily, as much of what is there is not particularly large.
-
Roguebasin's defunct games seems to hold more recent list. Maybe I'll find something. If there is a basic "engine" ready then it could be cool to add some content.
-
If you have played and liked someones game in the past, and it has not been developed lately, chances are it is now defunct. Ask them for the code. I know, all my games are in a semi-defunct stage, and would happily give the code over to someone for a small chance it would be developed more, there are probably lots of developers like this.
-
I know, all my games are in a semi-defunct stage, and would happily give the code over to someone
Are they C/C++?
-
While I was not really volunteering my games, you are quite welcome to attempt to take them over. As is anyone!
C++, SDL, openGL, freetype2 lib, and currently build with MSVC++8 or express. I have noticed that I dont actually have the code for these games up yet, I must do that. I can email the code to anyone who wants it.
List of semi-defunct games ->Warlocks Mountain, Warlock of Firetop Mountain, Troll Slayer and StarCraft: Rogue Mercenaries.
http://users.adam.com.au/savre/
I started to develop Warlocks Mountain but never really got back into it.
SewerJacks is always looking for a new developer but I would expect them to a BloodBowl and Warhammer fan. (and from what I remember is you dont actually like the game :) )
-
I could try my luck with Troll Slayer, if it's ok to you that the game will be changed to entirely something different.
-
I could try my luck with Troll Slayer, if it's ok to you that the game will be changed to entirely something different.
What will the subject matter be? I give one vote for something other than fantasy. I'd love to see a roguelike in the Wild West or some other neglected setting.
-
I'd love to see a roguelike in the Wild West or some other neglected setting.
Well I wasn't planning that kind of change. Just some changes to graphics, maybe slightly better UI. Few monsters more and that's it!
-
Sounds good to me, I will upload the code or email it.
What IDE do you have, I assume you are using Visual Studio/Express. I have version 8 project files, I can create version 9 aswell.
-
VS Express v10. I guess it can load older project files also.
-
Here is the source
http://users.adam.com.au/savre/bin/TrollSlayer04-source.zip
Ok, so i dont need to say how much of a mess it is in.
You have to set the debug version to run in the source directory not the project one.
And usually there are problems going from visual studio versions, usually some piece of code suddenly crashes.
-
Ok, so i dont need to say how much of a mess it is in.
I need to say something. It's really worse than I thought.. but if I can get it to compile and run there might be chances to repair it as much as possible. It sure has things that I hate: overusing templates, Microsoft specific stuff (for no reason), precompiled headers, quite lot of commented out code (that's really bad actually, because no one can tell if it's needed later or not). Maybe the worst part is total lack of data-driven design.
On the other hand, it's the gameplay that matters most. If I can understand the source code in the first place it's possible to improve the gameplay.
-
It is a 7drl and I dont like data driven design. The source code base is probably too complicated, it really comes from another project and then hacked in 7 days to get a working game (5 times). This is why I generally dont release my code, but I have gone beyond caring, its a mess but it works, fixing it just takes time I dont have.
All commented out code can be deleted, precompiled headers can be turned off, MS stuff sucks - I am in the process of removing most of that stuff. I hardly use templates IIRC, I have made some really bad design decisions with monster and item classes, they will most likely confuse you.
-
if you're bored with your current project you could make a small release, other people's perspective could help renew your interest.
-
I dont like data driven design.
Too bad. It's really cool and nice thing about it is that you don't have to be strictly data-driven in C++, because there is freedom to the amount of data vs. code. My type style classes are always almost a mixture of code and data arrays. It's reasonable to use code when only few of the items have a special feature, that way you don't have to write long lists of data for that particular feature.
-
if you're bored with your current project you could make a small release, other people's perspective could help renew your interest.
Nice try:) I'm going to release Kaduria as soon as possible.
-
It looks like I don't have OpenGL include files. Although it's only complaining about missing glaux.h. Now.. I tried to go OpenGL site and look for include files and library files to download. I failed in that task. Where the heck can you get OpenGL?
Edit: There is OpenGL installed already, but that glaux.h is missing. From some forum messages it's some kind of "older than heaven" part of experimental OpenGL that was once in time of dinosaurs.
And you can't download it anymore.
Edit2: Found it from some random site. But now I can't understand why project files are in such wacky location and I don't know how to set the output directory to compile the .exe in /source directory. I'm starting to think that I FUCKING QUIT! Fuck.
-
Ok glaux.h was in my code base 10 years ago, I only removed it a couple of months ago, but not in TrollSlayer as that is 1 year old. :(
I better remove if from all future sources.
The output file should compile in the Debug directory, and the "working directory" is set to the source directory.
Alternatively you can copy the "data" directory to the Debug directory.
As for GLAUX - even though it is too late do the following steps to remove its dependency.
- Remove references to glaux.h and remove library glaux.lib from libraries.
- Replace all function declarations in OpenGlTexture.h with the following line.
bool LoadGLTextures(unsigned number, const char * texture_filename);
- Replace all code in OpenGlTexture.cpp with the following
#include "OpenGLTexture.h"
#include <stdio.h>
#include <fstream>
OpenGLTexture::OpenGLTexture(void)
{
}
OpenGLTexture::~OpenGLTexture(void)
{
}
/************************************************************************
REPLACEMENT FOR GLAUX
************************************************************************
This is not a full blown bitmap loader. It is a quick and easy
way to replace the glAux dependant code in my older tutorials
with code that does not depend on the glAux library!
This code only loads Truecolor Bitmap Images. It will not load
8-bit bitmaps. If you encounter a bitmap that will not load
use a program such as Irfanview to convert the bitmap to 24 bits.
************************************************************************/
bool OpenGLTexture::LoadGLTextures(unsigned number, const char * szFileName) // Load Bitmaps And Convert To Textures
{
bool Status = false;
HBITMAP hBMP; // Handle Of The Bitmap
BITMAP BMP; // Bitmap Structure
glGenTextures(1, &textures[number].texture); // Create The Texture
if(hBMP=(HBITMAP)LoadImage(GetModuleHandle(NULL), szFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE ))
{
GetObject(hBMP, sizeof(BMP), &BMP); // Get The Object
Status=true; // Set The Status To true
glGenTextures(1, &textures[number].texture); // Create The Texture
//unsigned char* texels = new unsigned char[TextureImage[0]->sizeX*TextureImage[0]->sizeY*4];
unsigned char* texels = new unsigned char[BMP.bmWidth*BMP.bmHeight*4];
unsigned char* outTexel = texels;
unsigned char* inTexel = (unsigned char*) BMP.bmBits;//TextureImage[0]->data;
//choose bottom left pixel of bitmap as colour for transparency
int trans_r = inTexel[0];
int trans_g = inTexel[1];
int trans_b = inTexel[2];
//convert RGB texture to RGBA texture
for( int y = 0; y <BMP.bmHeight; y++ )
{
for( int x = 0; x < BMP.bmWidth; x++, inTexel += 3, outTexel += 4 )
{
int r = inTexel[0];
int g = inTexel[1];
int b = inTexel[2];
int a;
//set alpha channel transparent when current pixel equals transparent colour
a = ((b == trans_b && g ==trans_g && r==trans_r) ? 0:255);
//set new alpha value
outTexel[0] = b;
outTexel[1] = g;
outTexel[2] = r;
outTexel[3] = a;
}
}
// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, textures[number].texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, BMP.bmWidth, BMP.bmHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, texels);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
textures[number].sizeX=BMP.bmWidth;
textures[number].sizeY=BMP.bmHeight;
delete[] texels;
}
DeleteObject(hBMP);
return Status; // Return The Status
}
-
I might try that. I have a short fuse:)
Well, after those changes and moving all data stuff to Debug I get this error:
First-chance exception at 0x7588b727 in TrollSlayer.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0018f238
But it's only when I run the game from VS. What is this..
ps. The current changes list:
23.5.
- Item.cpp: removed #pragma warning(disable : 4786)
- Disabled Browse Information from project settings to speed up compiling
- InfoScreen::ShowAll removed "if (current_cell)" check which is always true and also a pointer
- Graphics::~Graphics added SDL_Quit for proper SDL exit in main() instead of using exit()
- Graphics::mainLoop removed panic_quit from SDL_QUIT event, instead return to the mainLoop for proper quit
- SDLSceneGen.cpp removed bool quitting;
- Graphics::mainLoop clean up
- changed Graphics::quit to panic_quit because of exit()
- Graphics::end changed to destructor of Graphics class
- removed double SDL_Init from main.cpp (was already in Graphics instance)
- ResistanceImmunityList::RemoveImmunity replaced for-loop with while to avoid invalid iterator erase
- BaseMonster::Serialize(std::ofstream &outStream): added missing delete[] buf;
- BaseMonster::Serialize(std::ifstream &inStream): delete buf; replaced with delete[] buf;
- removed WarlockException.h+cpp, they were not part of the project
- replaced OpenGLTexture::LoadGLTextures with new version
21.5.
- DungeonLevel.h & cpp: removed #pragma warning(disable : 4786)
- moved .txt files to new folder source/text (not options.txt)
- deleted empty New Text Document.txt from the source folder
- CellularAutomata.h: #define TILE_x changed to const int
- CellularAutomata.h: #define CA_x changed to enum Cellular_Automata_Type
- clean up of headers: replaced #pragma once with standards inclusion guards and removed VS precompiled headers
- changed #define NO_SPD_MOD 0 to const int
-
Hmm good list of changes, if I knew you were going to be that thorough I would of had a quick skim over the source to tidy things up. I am sure if you run cppCheck you will get a lot of changes too.
I ignore bad code simply to produce output :)
Unsure about your error. Are you saying that it is only from when you run the app from visual studio that it crashes? Can you run the Debug exe manually from the Debug directory?
My Debug build also creates some files in a directory called "Debug Files", the game crashes I think if it cannot find this directory. You may need to copy that to the Debug Directory. Does the release work?
I would still set the working Directory to $(ProjectDir)/../../source
Set Project Properties / Debugging / Working Directory to $(ProjectDir)/../../source
Good Luck.
Well at least I have learned that I really should go over my code and clean it up, and make it much more exception safe, before I ever make a serious code release.
-
Found three of those memory problems with CPPCheck... I moved all data files and folders to Debug, but I guess it still somehow points to /source when you run in VS. It could be nice to keep only source files in source, but I can't figure out how VS is running the .exe like it still was in /source.
-
Yeah really should have a bin directory, where Trollslayer_d.exe is the debug build and TrollSlayer.exe is release.
Will look at this tomorrow.
-
Changed working directory to ($ProjectDir)/Debug (obviously..) and now it runs from VS.
Next I'm going to write a BMP import/export (with changes to output image size) for Brick Atelier to modify graphics.
-
- clean up of headers: replaced #pragma once with standards inclusion guards and removed VS precompiled headers
Why? #pragma once works in MSVC, gcc, icc, and every other major current compiler suite. 'Old style' include guards are prone to error and actually DO LESS than #pragma once does, unless you wrap the actual #include statement in them as well...and then calling it a clean up will really be a misnomer.
- changed #define NO_SPD_MOD 0 to const int
It probably doesn't matter for small projects, but changing constants that are never 'type-challenged' to be 'type-safe' can lead to code bloat. Most compilers still allocate static data space per compile unit for named variables, even if in usage they're optimized away, whereas #define'd values are guaranteed to be "inlined" (for lack of a better term...). Yes, it's only 4*CU bytes...it's nice having the luxury of it not mattering...
-
#pramas vs include guards, much of a muchness, but in the world or roguelikes lets go with the standard.
- InfoScreen::ShowAll removed "if (current_cell)" check which is always true and also a pointer
I don't get it, current_cell can be a NULL reference. Hence the check. Well it really should throw an exception or assert.
- ResistanceImmunityList::RemoveImmunity replaced for-loop with while to avoid invalid iterator erase
Was that picked up by CppCheck or by you? (this class is not used anyway, usually I have the iterator = the return from the erase() in such cases)
Probably should run the code over a code coverage program to determine unused code. Know of any free ones for windows/c++?
-
I don't get it, current_cell can be a NULL reference. Hence the check.
All right. Let's add the check, but not like that. Anyway, current_cell is used before that check..
Probably should run the code over a code coverage program to determine unused code. Know of any free ones for windows/c++?
I tried to find one of those, but they seem to be mainly commercial. New GCC is pretty good with special compiler flags. It's easy to get with Code::Blocks and you get a nice IDE with it.
-
Yes, it's only 4*CU bytes...it's nice having the luxury of it not mattering...
The best way is remove const ints from the header and possibly put them in a class or completely remove data like that. But const int is still better than #define.
-
I'd love it if someone gave the old class Omega a less suicide inducing user interface.
http://www.alcyone.com/max/projects/omega/
-
I'd love it if someone gave the old class Omega a less suicide inducing user interface.
The source code is real old school C. Kind of cryptic, but maybe not impossible to do something for the UI.