void VsSimulationWindow::Initialize()
{
	SimulationWindow::Initialize();

	m_lpWinMgr = dynamic_cast<VsSimulationWindowMgr *>(m_lpSim->GetWindowMgr());
	if(!m_lpWinMgr)
		THROW_ERROR(Vs_Err_lUnableToConvertToVsWinMgr, Vs_Err_strUnableToConvertToVsWinMgr);

	VsSimulator *lpVsSim = dynamic_cast<VsSimulator *>(m_lpSim);
	if(!lpVsSim)
		THROW_ERROR(Vs_Err_lUnableToConvertToVsSimulator, Vs_Err_strUnableToConvertToVsSimulator);

	if(m_HWND)
		InitEmbedded(m_lpSim, lpVsSim);
	else
		InitStandalone(m_lpSim, lpVsSim);

	SetupTrackCamera(true);
}
void InitChatbot(char* name)
{
	// initialize system
	InitSystem(0,NULL);
	InitStandalone();
	SetUserVariable("$loebner","1");

	// treat each invocation as a new judge
	FILE* in = fopen("counter.txt","rb");
	int judgeid = 0;
	char buffer[1000];
	if (in)
	{
		fread(buffer,1,100,in);
		fclose(in);
		judgeid = atoi(buffer);
	}
	++judgeid;
	FILE* out = fopen("counter.txt","wb");
	fprintf(out,"%d\r\n",judgeid);
	fclose(out);

	// read in last sequence id to hopefully send ok on restart.
	in = fopen("sequence", "rb");
	if (in)
	{
		fgets(buffer,1000,in);
		fclose(in);
		sequence = atoi(buffer);
	}
	
	sprintf(buffer,"judge%d",judgeid);
    strcpy(loginID,buffer);
	ourMainInputBuffer[0] = 0;
	PerformChat(loginID,"",ourMainInputBuffer,NULL,ourMainOutputBuffer);     // start up chat with a judge, swallow first message
	ProcessOOB(ourMainOutputBuffer); // process relevant out of band messaging and remove
}