I'm programming my own game at the moment, its connecting to a server and the server sends some spawn info and eventual other players who are connected.

When a player moves, and an other player is also connected, the client of Player2 crashes. I don't know what is causing this, the only error I get is:

This application has requested the Runtime to terminate it in an unusual way.

So my question is, does anybody know where this is coming from?
I already tried to add an exception there but it doesn't trigger.

Thanks alot!

Recommended Answers

All 9 Replies

Dozens of options...
Most commonly:
- Writing in memory you didn't reserve
- deleting memory you didn't claim

But without seeing some code, it's a guessing game.

Dozens of options...
Most commonly:
- Writing in memory you didn't reserve
- deleting memory you didn't claim

But without seeing some code, it's a guessing game.

Ill post the code where I think it is coming from:

case c_Move:
	temp = NULL;
	temp = Client->GetPlayerInfo(args[0]);
	if(temp == NULL)
		cout << "Failed to get info\n";
	else
		try {
			temp->SetPosition( atof(args[1]), atof(args[2]) );
		} catch(exception& e) {
			cout << "Exception in c_Move: " << e.what() << endl;
			}
	break;

// This is the function where it tries to get the PlayerInfo
CHARACTER* CLIENT::GetPlayerInfo(char* Name)
{
	CHARACTER* returN = playerList[Name];
	return returN;
}

// This is the function where it adds an player to the list
map<string, CHARACTER*> CLIENT::AddPlayer(char* Name, CHARACTER* Character_class)
{
	map<string, CHARACTER*> asd;
	Character_class->SetName(Name);
	this->playerList.insert(pair<string, CHARACTER*>(Name, Character_class));
	return asd;
}

Oh btw, it prints the error on the Command line, I don't get that Dialog =P. Maybe it is important to tell?

Oh btw, it prints the error on the Command line, I don't get that Dialog =P. Maybe it is important to tell?

You don't get WHAT dialog?

Nick is correct. The possibilities are endless. You have to track it down somehow. If it's running on a server, it may be harder to find (and it might not). You need to find out exactly where it's happening. If there is some way to use a debugger and stick breakpoints in, do it. If not, I generally take a spray paint can and write "Vern was here 1", "Vern was here 2", Vern was here 3" all over my program until I find that if "Vern was here 2" prints, but not "Vern was here 3", something may have happened between 2 and 3. Then I experiment further till I nail it down.

But there's nothing in the code that jumps out and says "A HA!", at least not to me.

You don't get WHAT dialog?

Nick is correct. The possibilities are endless. You have to track it down somehow. If it's running on a server, it may be harder to find (and it might not). You need to find out exactly where it's happening. If there is some way to use a debugger and stick breakpoints in, do it. If not, I generally take a spray paint can and write "Vern was here 1", "Vern was here 2", Vern was here 3" all over my program until I find that if "Vern was here 2" prints, but not "Vern was here 3", something may have happened between 2 and 3. Then I experiment further till I nail it down.

But there's nothing in the code that jumps out and says "A HA!", at least not to me.

The windows dialog when something crashes. You know, the "Send report, don't send report" thing.
Anyway, I know how to debug so I'm gonna do that then. I was just asking, maybe you had it before and how you fix it.

Thanks alot for your time and ill try to figure it out!

The windows dialog when something crashes. You know, the "Send report, don't send report" thing.
Anyway, I know how to debug so I'm gonna do that then. I was just asking, maybe you had it before and how you fix it.

Thanks alot for your time and ill try to figure it out!

I wouldn't read too much into the "Send Report" message. I just ran this program through Visual Studio:

#include <cassert>

int main ()
{
	assert (2 + 2 == 5);
	return 0;
}

and got that message. Run it from the command line and I don't. Your program crashed and something about that crash triggered that message. Probably ANY crash would have resulted in that message. I don't think that message popping up helps you much in tracking down the cause.

I find assert statements extremely helpful when debugging. I also like CUnit, which expands on the abilities of assert. You can assert something and not have the program abort. But everyone has their own debugging styles.

Anyway, unfortunately, I don't know that that "Send Report" gives you much of a clue. It's really generic. Good luck!

Its not about the dialog though. I got it more than once in my life and I don't look at it anymore. I just mentioned that I got the error on the commandline instead of the dialog, which I never really had before. Anyway, thanks for you help and I will try to fix it. Well try.. I actually HAVE to xD. I want to publish my game after the spring break or something. Thanks alot!

where this is coming from?

The runtime code calls abort() (or perhaps even your own code?).

Which compiler/IDE/OS you are using?

The runtime code calls abort() (or perhaps even your own code?).

Which compiler/IDE/OS you are using?

Nah I already found the problem. When outside the debugger, I forgot to initialize some pointer and that it why it crashes. I've not been able to fix it just yet, though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.