Log in

View Full Version : OT: Stupid c++ (Roguelike development)


narf poit chez BOOM
August 7th, 2006, 05:11 PM
So I'm trying to declare a vector. It declares fine in the main function. The only problem is, I need to declare it in one of the header files. Except that if I try to declare it in function I want to use it in in the header file, it tells me that ' `vector' undeclared (first use this function)'.

If I try to declare it outside the function, it tells me that 'expected constructor, destructor, or type conversion before '<' token'

So it seems like my header file can't access the vector code or something.

Cipher7071
August 7th, 2006, 06:11 PM
Assign them different names, and pass the value of one to the other.

narf poit chez BOOM
August 7th, 2006, 07:13 PM
That still doesn't fix the fact that I can't declare vectors in the header and the header is where I need to declare the vector.

PvK
August 7th, 2006, 07:19 PM
Vector isn't a built-in type, so you need to have something, typically in the header file, like:

#include <vector>

and probably you want:

using namespace std;

and then to declare it, something like:

vector <MouseCheeseWhatever> NarfsVector;

narf poit chez BOOM
August 7th, 2006, 09:34 PM
Much thanks.

narf poit chez BOOM
August 7th, 2006, 10:22 PM
Would anyone happen to know why the computer would lock into 'drag and select' mode, generally requiring me to do a complete shut-down?

That's any part of the computer capable of 'drag and select' gets locked into that mode. It sometimes happens when I'm dragging and selecting.

PvK
August 8th, 2006, 01:31 AM
Sounds like your mouse button is getting stuck in a down position, or software (mouse driver, or some program messing with mouse messages in a bad way) is messing up the mouse. Like, saying it has handled the MouseUp message and not passing it on to other software, so other programs don't see the MouseUp event so it's like your mouse button is stuck down.

narf poit chez BOOM
August 8th, 2006, 04:22 PM
I think it's my keyboard - Tapping the shift key has helped twice now, so it's probably dying.

The mouse is only about 6+ months old; can't remember when we got the keyboard, but it's outlasted at least two processors, I think.

narf poit chez BOOM
August 8th, 2006, 05:44 PM
What does 'expected primary-expression before '.' token' mean? I'm trying to make a pointer for a base class equal to one of its derived classes.

Thanks again.

Fyron
August 8th, 2006, 05:48 PM
Ah, the joys of dereferencing.

. is used to access members of an object.

-> is used to access members of an object when you have a pointer to that object.

If you have:

object* MyObjectPtr = new object();

then you have to access members via:

MyObjectPtr->member();

Whereas if you have just:

object MyObject;

you use:

MyObject.member();

narf poit chez BOOM
August 8th, 2006, 06:27 PM
Erm, the pointer is one of the variables in the base class. I'm restarting the roguelike project, only mucho simpler.
The relavent lines:
class GR {
BlankSquare MapBlank; WallSquare MapWall; FloorSquare MapFloor;
};

class MapSquare {
public:
BlankSquare * Type;
};
MapSquare Map [81][41];

Map [t][t2].Type = GR.MapWall;

narf poit chez BOOM
August 8th, 2006, 07:46 PM
*Whaps forehead*

Must remember...A class is *Not* a variable. Must declare class as variable first.

Well, at least I changed the error...Er, never mind. Putting '&' in front of what I wanted to convert fixed it. And now it all works. Or seems to. Can never tell with those programs. *Darting eyes* Sneaky programs.

narf poit chez BOOM
August 8th, 2006, 08:35 PM
I'm getting aa '[Linker error] undefined reference to `vtable for Character' '
Ok, so it doesn't like virtual functions without a '{};', even if they are void.

narf poit chez BOOM
August 8th, 2006, 10:25 PM
Got a dungeon, got doors that open and close, got an intermitent glitch in the dungeon algorithm...

Would anybody know how to turn on Dev c++'s Debug mode? I'm getting nowhere with 'F8'.

Beorne
August 9th, 2006, 06:21 AM
Ehm ...

Why don't use Phython?
Or, at least, Java?
Or, if you love M$, C#?

I programmed 10 years in C and C++ and it's an headhache.

Xrati
August 9th, 2006, 09:57 AM
This explains all the nomenclature in your posts! http://forum.shrapnelgames.com/images/smilies/laugh.gif

dogscoff
August 9th, 2006, 10:29 AM
Don't suppose it happens to be an SE4-themed roguelike does it?

The Phong wields a hand cannon --more--
The Phong fires at you --more--
You die


That would be cool...

Ed Kolis
August 9th, 2006, 11:16 AM
Yeah, I wanted to do an SE module for Dungeon Odyssey once, but it never got anywhere... DO seemed a bit tricky to mod, and I couldn't figure out where to start with the concept anyway http://forum.shrapnelgames.com/images/smilies/tongue.gif

narf poit chez BOOM
August 9th, 2006, 12:38 PM
Python is interpreted, java is interpreted, I have an aversion to M$-only projects.

No, just a simple dungeon-based one.

I would perfer this thread not go off-topic before I get an answer.

narf poit chez BOOM
August 9th, 2006, 02:03 PM
What's a good, simple way to get the console to ignore the mouse? I'm using this: http://www.adrianxw.dk/SoftwareSite/index.html for events.

PvK
August 9th, 2006, 03:00 PM
I'm not familiar with "Dev C++" - never even heard of it, sorry.

What response to mice are you getting that you don't want? One thing you can generally do is handle mouse events received by your window, and then just do nothing with them and say you handled it. But that's assuming you have a window procedure. If you're running in an MS-DOS-like Windows console window running as a console app, then I don't think you do control how that window behaves - it's a window from Windohs onto your program's i/o. You might be able to make a Windohs shortcut to your app and play with the shortcut's settings to alter the mouse behavior - I'm not sure how many options you have to do that, though.

What's the mouse doing that you don't want it to?

PvK
August 9th, 2006, 03:07 PM
Oh, I just glanced at the code you linked to, and saw this:
<font class="small">Code:</font><hr /><pre> case MOUSE_EVENT:
++MouseEvents;
SetConsoleCursorPosition(hOut,
MouseWhere);
cout &lt;&lt; MouseEvents &lt;&lt; flush;
break; </pre><hr />
Is that in your code? Is that what's doing what you don't like? Looks like it is set to move your cursor wherever the mouse goes. If so, just comment out (or delete) all the lines above, to stop it doing that.

narf poit chez BOOM
August 9th, 2006, 05:25 PM
*Whaps forehead* Yeah, it works much better when I describe the problem. Sorry.

Basically, each time I move the mouse...Er, the characters used to flicker. Something I did stopped that, though...Programs is wierd.

narf poit chez BOOM
August 14th, 2006, 08:56 PM
How would one convert an int into a std::string?

Programs for debugging...What can you tell me?

narf poit chez BOOM
August 15th, 2006, 04:19 AM
For that matter, how would one convert a std::string into an int? Or a float?

Are there any libraries out there for this?

Fyron
August 15th, 2006, 04:28 AM
http://www.cplusplus.com/ is a decent source of c++ info. Look up atoi (http://www.cplusplus.com/ref/cstdlib/atoi.html). Then recall that string objects have a .c_str() member function that will return a c-style string (null-terminated array of characters).

There is a function to go the other way, but I forget it.

Debugging is related to the compiler you are using. What is your compiler?

narf poit chez BOOM
August 15th, 2006, 04:44 AM
Thanks. If all else fails...

Dev c++ - The debug function doesn't seem to work.

Is it possible to use the '&gt;&gt;' operator with an 'ifstream'?

narf poit chez BOOM
August 15th, 2006, 05:29 AM
Can someone give me an example of how to use seekg () and get () to read from a file? I can't seem to get them to work.

(DBPro has sane file inputs and outputs. Why can't c++?)

Never mind. Figured it out.

narf poit chez BOOM
August 15th, 2006, 06:10 AM
What, exactly, is ' C:\Programming\Dev-Cpp\Projects\Simple Roguelike\Makefile.win [Build Error] [clean] Error 1 ' and why would it stop the program from compiling?

Fyron
August 15th, 2006, 12:07 PM
&gt;&gt; and &lt;&lt; are operators that are generally valid for streams (cout and cin are actually file streams). You should be able to use &gt;&gt; with ifstream, as per this page (http://www.cplusplus.com/ref/iostream/istream/operatorgtgt.html) (ifstream is derived from istream). That site is a good reference to use. http://forum.shrapnelgames.com/images/smilies/wink.gif


I have no idea what that error means.

To use a different debugger, you would have to compile with a different compiler. Microsoft's VC++ 7.1 compiler is free to get (the command line version), which you should be able to plug in to DevC++ (if it is worth it's salt).

AngleWyrm
August 15th, 2006, 01:06 PM
istream::seekg example (http://www.cplusplus.com/ref/iostream/istream/seekg.html)

narf poit chez BOOM
August 15th, 2006, 06:14 PM
Fyron: I read that page, but when I tried it, it didn't seem to work. Thanks, I'll check out that compiler.

AngleWyrm: Thanks, but as I said when I edited the message, I figured it out.

narf poit chez BOOM
August 15th, 2006, 08:45 PM
If anyone wants to see where I am, the aptly named Simple Roguelike (http://www3.telus.net/funnybnz/Simple Roguelike.exe). Just drop it in a folder and run. Right now it's *very* simple, but as far as I know, everything works.

AngleWyrm
August 15th, 2006, 10:26 PM
Nice! I especially like the light radius effect, and field of view.

Found a link for the source code for NetHack v3.42 (http://prdownloads.sourceforge.net/nethack/nethack-343-src.tgz?download); could have some interesting ways to do stuff in it.

narf poit chez BOOM
August 15th, 2006, 10:36 PM
Thanks. The currently linked version is my second upload; it has one type of trap. Previous savegames won't work, either.

PvK
August 15th, 2006, 11:36 PM
Nice job!

narf poit chez BOOM
August 16th, 2006, 01:07 AM
Thanks.

Somehow, my pointer item vector is getting messed up between its setup and the function to display it.

The thing is, those are the only two points which have anything to do with items at all.

How is this modifying a vector?!?!

void text ( std::string tstring, int x, int y, short int Colour ) {
COORD Position; Position.X = x; Position.Y = y;
SetConsoleTextAttribute( hOut, Colour );
SetConsoleCursorPosition( hOut, Position );
std::cout &lt;&lt; tstring;
};


Apparently, inputting too large of a block of characters (Between twenty and thirty) somehow affects the vector. Help, anyone?

narf poit chez BOOM
August 16th, 2006, 02:09 AM
Can anybody see a problem with this:
void setupItems () {
srand ( time(NULL) );
// NewWeapon.initialize (); NewPotion.initialize ();
// WeaponList.push_back ( NewWeapon ); PotionList.push_back ( NewPotion );
for ( t = 0; t &lt; 40; ++t ) {
t2 = rand () % 2;
if ( t2 = 0 ) {
NewWeapon.initialize (); WeaponList.push_back ( NewWeapon );
WeaponList[WeaponList.size () - 1].initialize ();
ItemList.push_back ( &amp;WeaponList [WeaponList.size () - 1] );
};
if ( t2 = 1 ) {
NewPotion.initialize (); PotionList.push_back ( NewPotion );
PotionList[PotionList.size () - 1].initialize ();
ItemList.push_back ( &amp;PotionList [PotionList.size () - 1] );
};
};
for ( t = 0; t &lt; ItemList.size (); ++t ) {
ItemList[t]-&gt;initialize ();
std::cout &lt;&lt; t &lt;&lt; " " &lt;&lt; ItemList [t]-&gt;XPos &lt;&lt; " " &lt;&lt; ItemList [t]-&gt;YPos &lt;&lt; " " &lt;&lt; ItemList[t]-&gt;Colour &lt;&lt; " ";
};
std::cin &gt;&gt; wait;
};

It doesn't seem to work right - It seems like all the slots still reference as the base Item class.

AngleWyrm
August 16th, 2006, 04:00 AM
Bug: if(t2 = 0) // assign zero to t2, return true (successful assignment)
You probably meant: if(t2==0) // test for equality

Happens so often that some compilers even have a warning for it.

narf poit chez BOOM
August 16th, 2006, 04:18 AM
Thanks. We're whacking it into shape on IRC.

narf poit chez BOOM
August 16th, 2006, 11:55 PM
Update: Simple Roguelike v0.1.2.5 (http://www3.telus.net/funnybnz/Simple Roguelike.exe)
Features one type of weapon and one type of potion (healing).

There are few glitches, but nothing game-breaking, I think.

Fixed a few game-breakers. Now, to make it generate new items with a new level.

narf poit chez BOOM
August 17th, 2006, 02:05 AM
Update: Simple Roguelike v0.1.3 (http://www3.telus.net/funnybnz/Simple Roguelike.exe)

Should all work.

narf poit chez BOOM
August 17th, 2006, 04:23 PM
How important is it that an object has a destructor? As far as I know, the 'delete' command is unstable.

PvK
August 17th, 2006, 05:49 PM
Classes should define a destructor if something needs to happen every time one gets destroyed (either by delete or by a non-static member going out of scope). It is important to prevent memory leaks if the class has any heap-allocated memory that it maintains the only pointer to and should remove when it dies.

If an object has no heap-allocated memory (i.e. it doesn't create anything with "new" or "malloc"), and if nothing needs to happen when it gets deleted, then it doesn't need a destructor.

However, I really doubt any worthwhile C++ compiler is going to have a fundamental problem with destructors or with delete. If it did, it would be seriously crippled. I expect probably you are seeing some other bug.

What are you deleting when you see problems? Objects with destructors that do things like use objects that are already destroyed?

narf poit chez BOOM
August 17th, 2006, 10:12 PM
Huh?

No, I use data types like 'int' and 'char'. Never new.

I just had a vague memory of someone saying the 'delete' command was unreliable.

Not using delete. I have, in fact, no destructors at all and a vague feeling that this might be bad.

PvK
August 17th, 2006, 11:53 PM
Destructors are simply functions that get called when an object is deleted. If you never use new or malloc, then you probably never use delete nor free either, and your objects will only be deleted automatically - i.e. if they are local to a function and that function exits, or when the program exits. In other words, it sounds like you probably don't need to worry about destructors at all.

What are you going to do about creating new things during play, though, like new monsters, items, levels, etc.? Are you using STL lists of objects (not of pointers to objects) and just adding them and removing them from those? If so, then imagining how your code probably looks, STL should be doing the cleanup for you, and you shouldn't need to define destructors...

... well, ok, as long as you don't start using pointers or references to items in those lists, and expecting them to always be there after other events have happened that might have removed them from the lists. That could lead to a nice invalid pointer or reference and crash.

Example:

Say you have a list of all monsters in the world called MonsterList. Then say you have a Quest object to slay a particular monster, which when it gets launched, adds a monster to MonsterList and then keeps a pointer or reference to that monster object, to refer to the monster to slay. Now, if something in the game can remove the monster from MonsterList, causing its object to be automatically deleted by STL, then referring to a reference or pointer to it will be an access violation and boom. So if you want to avoid that, you could give monsters also a unique ID, and when you refer to them, always go search the list.

Of course, that's a fairly slow operation, but you probably don't care too much until you have thousands of things going on at once in your gameworld. To be faster, you could have a destructor that announces when something gets deleted, and causes everything that might refer to it to drop their pointers and references to it. Sounds like you'd probably be better off keeping things simple and reliable for now, though.

narf poit chez BOOM
August 18th, 2006, 12:19 AM
Currently I'm using vectors for items and an array for the map.

I'm using pointers for characters, but that's the next thing I'm going to replace. In the meantime, the number of characters never changes; dead characters are simply re-randomized.

Thanks.

narf poit chez BOOM
August 18th, 2006, 02:05 AM
Update: Simple Roguelike v0.1.4 (http://www3.telus.net/funnybnz/Simple Roguelike.rar)

It's been extensivly tested for all of two or three minutes, but everything should work. No cosmetic changes, but a lot of code was fixed so as to result in less heart attacks on IRC. Also, it's nearly 2MB, so I stuck it in a .rar

narf poit chez BOOM
August 18th, 2006, 05:25 AM
Readme's are good. I added one, just in case people hadn't found the help key.

AngleWyrm
August 18th, 2006, 05:48 PM
// my.h header file, using a vector
#ifndef MY_H
#define MY_H
#include &lt;vector&gt;
using namespace std;

class test{
public:
test(){};
int insert(int in){ number_list.push_back(in); return number_list.size();};
private:
vector&lt;int&gt; number_list;
};

#endif
//eof


// main.cpp
#include &lt;iostream&gt;
#include "my.h"
int main(){
test t;
int result = t.insert(42);
cout &lt;&lt; result &lt;&lt; endl;

system("pause");
}
// eof

===========
Missing some white space and sequencing in the grave marker:
Strength: Dexterity: 94122 Constitution: 83 Damage: 6Defence: 94.2308 HP: -1/8 XP: 0/0
Looks like stream flushing between numbers and strings.

narf poit chez BOOM
August 18th, 2006, 06:11 PM
Apparently, the compiler tries to treat every .cpp file as a seperate program, so multiple .cpp files do not work. I presume it works with other compilers.

PvK
August 18th, 2006, 06:31 PM
C++ is trying to help you to help yourself to write nice code. Why do you want a class member function to have side effects on a global vector defined outside the class?

A nicer way to do it would be to have the constructor take a parameter which tells the object about the global vector (pass it a pointer or reference), store that pointer/reference and use that.

PvK

PvK
August 18th, 2006, 06:33 PM
No, every compiler has limited file scope, to keep globals slightly under control. You can get to objects in other files by declaring them "extern", but relying on globalness tends to get ugly.

narf poit chez BOOM
August 18th, 2006, 06:41 PM
AngleWyrm, what's that code for?
No, just a slight precedence error in 'characterToGraveyard'. I fixed it, but thanks anyway.

@Pvk: Wouldn't that take a lot of memory?

Ah, thanks. The advice makes more sense now.

Update, call it: Simple Roguelike v0.1.4.5 (http://www3.telus.net/funnybnz/Simple Roguelike.rar)

Not a single pointy in the code.

What kind of file is 'main.o'? It's rather big - Can I delete it?

PvK
August 18th, 2006, 08:07 PM
It'll use all of 4 bytes if you make it a class static data member, in which case there is only one per class, not per object:

static (STL::vector&lt;cheese&gt;)* pGlobalCheeseVector;

However I guess I'm harping object-oriented design when you are working in a good-ol' C hack design paradigm, which may actually be less confusing for you at this point. If it works and you understand why, it's good code. http://forum.shrapnelgames.com/images/smilies/wink.gif

main.o is probably an object file. That is, an intermediate file before building the exe. If you delete it, it just means it the compiler will need to recreate it before building the exe, even if you hadn't changed any code in main.cpp before you rebuilt. Generally you can ignore main.o, and you don't need to distribute it to players.

PvK

narf poit chez BOOM
August 18th, 2006, 08:20 PM
Ah, thanks.

Object-oriented design is what I'm trying to do. Any difficulties come because I'm self-taught (Aside from what random people on the internet have taught me).

Er, I've tried to make a pointer to a vector, but it didn't work.

Death to globals!

PvK
August 18th, 2006, 08:33 PM
Hmm, a pointer to vector should work - what syntax are you using?

narf poit chez BOOM
August 18th, 2006, 09:09 PM
I dunno. Whatever syntax Dev c/c++ uses. I found a syntax page, but it doesn't list the type.

I'll try it again, soon as I finish getting rid of the current global.

(Er, why did you type STL::vector? I thought it was std?)

This seems to work: 'static std::vector&lt;Character&gt; * CVector;'

So I guess I just put my &amp;Character list vector into CVector, then access that from inside the class?

PvK
August 18th, 2006, 10:05 PM
Oh, sorry STL-&gt;std (bad human memory).

By "what syntax", I just meant what does your code look like. Yes, the line you wrote is the syntax I was trying to remember and suggest to you. Good job. http://forum.shrapnelgames.com/images/smilies/wink.gif

Yes, so the syntax for that would be something like:
<font class="small">Code:</font><hr /><pre>
// In the class definition file e.g. NarfClass.h
class NarfClass
{
// Constructor:
NarfClass( std::vector&lt;Character&gt; * pCVectorToUse );

// Method that does something with CVector:
void DoStuffWithCVector();

// The static storage of the Character Vector:
static std::vector&lt;Character&gt; * pCVector;
};</pre><hr />

<font class="small">Code:</font><hr /><pre>// In the class definition file e.g. NarfClass.cpp
#include "NarfClass.h"

NarfClass::NarfClass( std::vector&lt;Character&gt; * pCVectorToUse )
{
pCVector = pCVectorToUse;
}

void NarfClass::DoStuffWithCVector()
{
int NumberOfCharactersInGame = pCVector-&gt;size();
// etc...
}</pre><hr />

<font class="small">Code:</font><hr /><pre>// In the class that stores the whole gamestate:
#include "NarfClass.h"

// The actual vector:
static std::vector&lt;Character&gt; CVector;

// The creation of a NarfClass object:
NarfClass NarfsNarf( &amp;CVector );

// Now NarfsNarf is an object that can do stuff with CVector.
NarfsNarf.DoStuffWithCVector();</pre><hr />
I may have a typo or be missing something, but that's about how I'd do it.

PvK

narf poit chez BOOM
August 18th, 2006, 10:15 PM
Thanks again.

For syntax, I tend to go with the needs of the moment.

So, you mean make a handler class for the Character class?

How do you declare something 'extern'?

PvK
August 18th, 2006, 10:24 PM
I don't really know what you're doing, so NarfClass was just an example. NarfClass would be any class that wants to be able to use some external object, without requiring the external object to actually be defined as a global with a certain name in the class definition.

Actually, the classic approach to doing what I think you probably really want to do is to make the Character Vector into a singleton class - a class designed to ensure there is only one of something, and provide access to it to other classes.

I don't really know what your class design is like - that is, how you've decided to divide up the things in your game into classes.

extern is a keyword for referring to objects or variables defined in other files, which would be how you can refer to globals created in other files. The syntax is, for example:

extern int X9B;

This lets you use X9B, but in one and only one other file you need to have the actual declaration:

int X9B;

So you can see that can make your code hard to read and use the more you do that, because it means you have to remember where that global is actually defined, etc.

PvK

narf poit chez BOOM
August 18th, 2006, 10:33 PM
If you want, I can send you the source code. Right now, the character stuff is mostly in one character class, with a vector for the list of characters and some external functions that deal with that vector class.

Yeah, I think I'll stay away from multiple cpp files if it means externs. Thanks.

PvK
August 18th, 2006, 11:05 PM
Multiple cpp files means externs if you use globals to share info between them.

But for an object-oriented design, you have a class definition file (Foo.h) and a class implementation file (Foo.cpp) for each class, and then you use them in the context of other classes. This way, almost all the code you write solves problems for general cases, and the specific application implementation (e.g. the actual Main function of an application) can then be something more general, simple and high-level.

So Character defines a character object in so general a way, that its .h and .cpp files don't need to refer to the instance of them at all - they refer only to the definition of other related classes, but never to a specific object (or else they'd be usable only with that specific object).

So your list of classes might be something like:

GameState
Level
Character
Item
Potion
Weapon
Armor

Each would have two files, a .h and a .cpp. All would be generic implementations.

Then you'd have a Main.cpp file where the entry point and specific objects are declared. In it you'd have maybe just one GameState object, and just a few calls to its methods, like:

GameState.CreateNewGame();
GameState.Load( SavedGame );
GameState.Play();

GameState itself might have a protected Initialize() method which would be called by both CreateNewGame() and Load(), and GameState would have the only Vectors storing all the objects representing stuff that exists in the game universe.

Etc.

PvK

narf poit chez BOOM
August 18th, 2006, 11:18 PM
Huh. Thanks.

That is a radical departure in thinking. I'll have to think about it.

Right now, I'm wanting to do some visible content. Too much code maintenance makes Narf wonder if he's making progress.

PvK
August 18th, 2006, 11:36 PM
Ya. You might want to spend more time having fun making things work, and think about a more O.O. architecture for your next project.

narf poit chez BOOM
August 19th, 2006, 12:34 AM
Heh. I added armor. Now I'm making it work. Just have to fix the load routine (Again).

Everythings fixed, and armor is now available. Just check the floor in your nearest dungeon.

narf poit chez BOOM
August 19th, 2006, 12:50 AM
Anyone know how to turn off the generation of debugging information in Dev c++? I think it's padding my program.

narf poit chez BOOM
August 19th, 2006, 02:23 AM
Updated. A couple of weapons with actual names. Savegames should still work.

On the downside, characters aren't properly re-located after descending stairs. Not a game-breaker.

narf poit chez BOOM
August 22nd, 2006, 06:24 PM
Update: Simple Roguelike v0.1.5.0 (http://www3.telus.net/funnybnz/Simple Roguelike.rar)

Breaks savegames. A few different item properties. Items are now more of a trade-off.

narf poit chez BOOM
September 4th, 2006, 08:41 PM
Dev C++ doesn't seem to like one of the include files that came with the DirectX SDK.

It's one of the ones used in:
'(SDK root)\Samples\C++\Direct3D\Tutorials\Tut01_CreateD evice'

I think I have the Directx include and lib folders linked in the right place, but just to check, can somone tell me how to link the Dx SDK into Dev C++?

Thanks.

narf poit chez BOOM
September 6th, 2006, 05:48 PM
The latest (http://groups.google.com/group/rec.games.roguelike.development/browse_frm/thread/f7a02d50aff98cc4/a99ac23baec049b6#a99ac23baec049b6)

dogscoff
September 7th, 2006, 06:59 AM
Just downloaded and had a little play.

Damn Narf, that is so cool! I really envy you the skills to produce something like this. I used to do a little coding (nothing on this level of complexity) and I'm just now remembering that feeling you get from creating something from nothing.

Have you got a name for your roguelike yet? I suggest you call it "Zort".

narf poit chez BOOM
September 7th, 2006, 12:50 PM
Thanks. Responces like that make my day. http://forum.shrapnelgames.com/images/smilies/happy.gif

"Zort"? Why Zort?

dogscoff
September 7th, 2006, 01:09 PM
Well, Zort (http://en.wikipedia.org/wiki/Zort) is one of Pinky's many exclamations (along with "Narf", "Poit", "Zounds", "Egads" and others) and Zork (http://en.wikipedia.org/wiki/Zork) was a classic text-based adventure game lovingly referenced in roguelikes such as nethack (Ever wonder why the currency of the Dungeons of Doom is 'zorkmids'?)

Kind of a pun, I guess. Not a very good one though.

(I just love that you can plug "Zort" into the wikipedia and get redirected to PatB!)

narf poit chez BOOM
September 7th, 2006, 01:23 PM
Hmm, thanks.

Ed Kolis
September 7th, 2006, 01:58 PM
Hey Narf, does your roguelike have magic yet? I've become rather enamored of the runecraft system in the Nintendo DS RPG/RTS hybrid "Lost Magic"... it's quite original in that you draw runes on the screen to cast spells, and after a certain point in the game you can combine multiple runes to cast more powerful spells. Obviously you can't draw on the screen in a PC roguelike, but I thought the combining runes system would be really cool... ToME (Tales/Troubles of Middle Earth; http://www.t-o-m-e.net) uses a similar system for one of its mage classes, and if you're interested you could use it in your roguelike too! http://forum.shrapnelgames.com/images/smilies/laugh.gif In fact the idea got me so excited I was thinking of starting work on yet another roguelike project that will probably fail - why I never pick up work on the existing ones I've started I don't know, but it might be fun http://forum.shrapnelgames.com/images/smilies/wink.gif
The idea so far is that you could have a variety of runes which your character can learn, and spells are cast not from a list but by typing the rune keys - keys on the numpad, or letter keys, or whatever - I kinda like the numpad because you can have "opposed" runes (fire and water for instance) located opposite each other and some sort of "neutral" Balance or Cosmos rune in the middle. Anyway, so you type the "cast a spell" command (say "m", like in Angband), then you type 2 runes, and after you type the second rune you can target the spell. If you combine fire and fire you might get a big fireball, for instance; air and water for maybe a freeze spell; light and air for a haste spell. The more runes your character learns, the more spells he can cast - a starting character choosing the fire-mage template might only be able to cast a fireball, but once he learns a second rune (say, earth) he could now cast four spells: fireball (fire/fire), stoneskin (earth/earth), magma bolt (fire/earth), and earthquake (earth/fire)! http://forum.shrapnelgames.com/images/smilies/laugh.gif So if you had nine runes (say fire, water, earth, air, cosmos, chaos, light, dark, and balance) you could have 81 spells in your game. That might sound like a lot of spells to come up with, but Lost Magic has something like 400 spells and 18 runes, and to come up with those spells they used patterns - all the fire+X spells are beam attacks, all the water+X spells are rapid-fire attacks, all the dark+X spells are monster traps, etc.
Of course if you don't like this idea, don't use it, but I thought I'd just bring it to your attention! http://forum.shrapnelgames.com/images/smilies/wink.gif

Ed Kolis
September 7th, 2006, 04:48 PM
Here's another spellcasting idea, borrowed this time from UnAngband: Don't just use "intelligence" as the be-all and end-all of spellcasting stats! Split it up amongst several stats! Let intelligence determine how many spells you can memorize, because you have to be smart to remember them all. Let wisdom determine how powerful your spells are, because only wise men have true magical power. Let dexterity determine how likely your spells are to actually work, because if you do the hand-waving wrong it will really screw up your spell! http://forum.shrapnelgames.com/images/smilies/wink.gif You can even combine this with the runecraft idea: don't let the player use all of his myriad spells at once, but instead give him a limited number of memory slots, dependent on intelligence, in which he can place spells; in order to use a spell which is not in memory, he must have the two runes used to create it available to study from and either "copy" them (casting the spell immediately but perhaps using more game ticks since the character must concentrate both on reading the runes and moving his hands, or perhaps even destroying the inscribed runes which he is carrying) or memorize them (deleting one of his existing spells from memory if there are no more free slots).

Caduceus
September 7th, 2006, 10:09 PM
Played around with Relentless. Good job early on... I can't tell if I am equipping items I pick up though...

narf poit chez BOOM
September 8th, 2006, 12:26 AM
For magic, I'm thinking something simple, that will allow the player to build spells.

The readme has been updated with a sentence on equiping.

narf poit chez BOOM
September 8th, 2006, 03:46 PM
The latest (http://groups.google.com/group/rec.games.roguelike.development/browse_frm/thread/f7a02d50aff98cc4/a99ac23baec049b6#a99ac23baec049b6)
Bugfixes, updates and name change.

Now that I'm coherent, instead of thematic runes, maybe purpose-based runes. Supposing you have the runes for Fire, Summon, Ray and Monster. You could make an explosion spell (Fire with no control rune), but it would damage your character. You could make a Ray of Fire, Summon Fire (Explosion at a square within your LOS), Summon a Monster, Summon a Monster where a Ray hits something solid, Summon a Fire-based Monster, Summon a Ray (Which would fire a Ray from a square you choose at a target you choose, but wouldn't do anything usefull), or Summon a Ray of Fire (Much more usefull.)

Simple, versitile, quick - What do you think?

Ed Kolis
September 8th, 2006, 07:33 PM
Cool http://forum.shrapnelgames.com/images/smilies/laugh.gif

Ed Kolis
September 11th, 2006, 01:00 PM
Hey Narf, I made this attached pic for a modelling challenge over at the Wings forum, but I thought you might like to use it as an intro screen for your roguelike; besides, I just need a place to upload it to show it off at the Wings forum since I'm not at home to put it on my server http://forum.shrapnelgames.com/images/smilies/wink.gif

narf poit chez BOOM
September 11th, 2006, 08:56 PM
Thanks, soon as I figure out how to put a picture on the screen.

Ed Kolis
September 12th, 2006, 09:15 AM
You could always get one of those handy bitmap-to-ASCII programs and make it doubly old-school http://forum.shrapnelgames.com/images/smilies/wink.gif

narf poit chez BOOM
September 13th, 2006, 12:49 AM
...I didn't even know they existed. I thought that was done by hand.

Ed Kolis
September 13th, 2006, 09:08 AM
Some ASCII art is done by hand, but the really complex stuff is often done with a program http://forum.shrapnelgames.com/images/smilies/wink.gif

narf poit chez BOOM
September 13th, 2006, 05:07 PM
Huh, thanks.

Ed Kolis
September 13th, 2006, 05:24 PM
BTW, this pic will also be appearing in the following comic series as part of a guest comic next week!
http://angband.calamarain.net/

narf poit chez BOOM
September 18th, 2006, 06:46 PM
Why would the 'new' operator re-assign the same pointers?

Seriously, if you can answer that question, I can probably fix the current problem.

narf poit chez BOOM
September 19th, 2006, 12:18 PM
And now it isn't even getting past re-sizing the character array.

C++ is stupid.

narf poit chez BOOM
September 19th, 2006, 12:28 PM
Anybody want to volunteer to look at the code?

Ed Kolis
September 19th, 2006, 04:30 PM
Sure, though I'm not that great with C++, I might be able to spot something...

PvK
September 19th, 2006, 05:23 PM
Why would new re-assign what same pointers?

Fyron
September 19th, 2006, 05:49 PM
And now it isn't even getting past re-sizing the character array.

Why are you using character arrays at all? There is no reason to ever use them over string. Any time you need to pass a char* to a function, just use the .c_str() member on your string (aka: crazy_function(mystring.c_str()).

C++ is stupid.

C++ is neither stupid nor smart. It all depends on how you use it.

Why would the 'new' operator re-assign the same pointers?

I don't understand the question. New doesn't assign any pointers; it creates an object in the dynamic memory space (heap), and returns a pointer to it.

narf poit chez BOOM
September 19th, 2006, 06:04 PM
By character array, I mean an array of NPC's and PC's. And technically I should have said 'vector'.

C++ needs more comprehensive error checking.

Tomato, tomato.

Anyone who wants to see the source code, PM me, thanks.

Fyron
September 19th, 2006, 06:39 PM
C++ compilers have more error checking than most other languages (esp. g++ with things like -pedantic flags). And anyways, you can always add more by throwing and catching exceptions.

narf poit chez BOOM
September 19th, 2006, 07:53 PM
It doesn't tell me why the resize function wasn't working on the character vector! Obviously, it's not fully-featured! http://forum.shrapnelgames.com/images/smilies/laugh.gif

Fyron
September 19th, 2006, 08:22 PM
Why are you using a resize function anyways? push_back() works well.

narf poit chez BOOM
September 19th, 2006, 08:25 PM
Because, with resize you don't have to push_back something.

Fyron
September 19th, 2006, 08:36 PM
Why would you increase the size of a vector without having something to add to it?

narf poit chez BOOM
September 19th, 2006, 09:26 PM
Er, doesn't increasing the size of the vector add something to it?

Fyron
September 19th, 2006, 11:30 PM
Not in a good way. In my exprience, it's not a good idea to resize; push_back, delete items, but don't just resize it.

narf poit chez BOOM
September 20th, 2006, 02:05 AM
Maybe if I fix that the problems will go away.

Tomorrow or something. Too much coding, not enough popsicles.

I havn't had any popsicles for over a month.