Game Development Community

FGE (Flight Game Example) Port...

by Quinton Delpeche · in Torque Game Engine Advanced · 06/02/2009 (7:00 am) · 52 replies

This is in response to some comments posted on the discount of FGE (Flight Game Example) blog post (www.garagegames.com/community/blogs/view/17325/). I have now started the porting process of FGE to TGEA 1.8.1 and decided to post the progress of it in the forums.

I have made some solid progress with the port to TGEA 1.8.1 and will move on to a T3D port once I am completed with this one. The only item that I have not ported is the VMPlayer, but FGE still plays music in the background as before ... it is just now a random selection and can't really be controlled or managed.

I am in the final stages now and busy with the final porting of the scripts and guis to make them look the same as the Decane originals but also to ensure that they are the TGEA 1.8.1 guis and not the older TGEA 1.0.1.

Here are some screenshots showing off the port ... you will need the original FGE to compare ... but anyway. :)

www.novogeek.org/files/stuff/FGE_TGEA_1-8-1.png
I should ahve the final port finished by the weekend and then Martin Schultz (Decane) will make it available to all current owners of FGE, please note that I am not adding any artwork or assets and the originals are still in place. It is up to Martin Schultz (Decane) to decide whether they want to update them to the new TGEA 1.8.1 or not. I have merely ported the stuff over and ensured that it works.

About the author

Gobbo Games is an Independent Games Development company operating from Durban in South Africa. We believe in creating high-quality cost-effective games that remain true to the belief of Independent Game Developers around the world.

#21
07/11/2009 (1:43 pm)
oh and not sure what one i used for the aiWheeledVehicle, so here is a link to the source files. extract and place them in: engine/source/T3d add to project.

www.rolanddynamics.com/aiwheeledvehicle.rar
#22
07/11/2009 (2:17 pm)
This still hasn't fixed the problem with processtick, something else you did must have resolved that. Any ideas?
#23
07/11/2009 (2:19 pm)
Roland: Can you package you AIFlyingVehicle classes for me as well ... I want to diff on yours and mine and see what else could have changed. :)

I seriously need to pinpoint this puppy ... it has become like a personal mission in my life. :D
#24
07/11/2009 (2:23 pm)
yeah np, here are the cpp and header files:

please note i did not delete alot of the old stuff, just commented it out so the code may be abit cluttered.

www.rolanddynamics.com/aiflyingvehicle.rar
#25
07/11/2009 (2:36 pm)
I think you may be having the same problem as we are Roland, but your changes have allowed the AIFlyingVehicle to control itself from the client side by removing the reference to mAimObject in the getAIMove() code. mAimObject is not ghosted to the client-side AIFlyingVehicles but the mMoveDestination is.

Have you tried this on a dedicated server?

Also in case you guys are interested, this should spam your console once we actually get AIFlyingVehicle::processTick() to be called on the server-side object:
void AIFlyingVehicle::processTick(const Move* move)
{
	if (isServerObject())
	{
           Con::errorf(ConsoleLogEntry::Script, "Server AIFlyingVehicle::ProcessTick!");
		Move aiMove;
		if (!move && getAIMove(&aiMove))
		{
			move = &aiMove;
		}
		Parent::processTick(move);
	}
}
#26
07/11/2009 (3:36 pm)
In T3D/gameProcess.cpp replace the existing
ServerProcessList::onTickObject() function with this one:
void ServerProcessList::onTickObject(ProcessObject * pobj)
{
   SimObjectPtr<GameBase> obj = getGameBase(pobj);
   AssertFatal(obj->isServerObject(),"Client object on server process list");

   // Each object is either advanced a single tick, or if it's
   // being controlled by a client, ticked once for each pending move.
   GameConnection * con = obj->getControllingClient();

   if (con && con->getControlObject() == obj)
   {
      Move* movePtr;
      U32 m, numMoves;
	  con->mMoveList.getMoveList(&movePtr, &numMoves);

          //Midhir was here.
	  if (con->isAIControlled())
	  {
		  AIConnection *c = dynamic_cast<AIConnection*>(obj->getControllingClient());
		  c->getMoveList(&movePtr, &numMoves);
	  }

      for (m=0; m<numMoves && con && con->getControlObject() == obj; m++, movePtr++)
      {
         #ifdef TORQUE_DEBUG_NET_MOVES
         U32 sum = Move::ChecksumMask & obj->getPacketDataChecksum(obj->getControllingClient());
         #endif
      
         obj->processTick(movePtr);

         if (con && con->getControlObject() == obj)
         {
            U32 newsum = Move::ChecksumMask & obj->getPacketDataChecksum(obj->getControllingClient());

            // check move checksum
            if (movePtr->checksum != newsum)
            {
               #ifdef TORQUE_DEBUG_NET_MOVES
               if (!obj->mIsAiControlled)
                  Con::printf("move %i checksum disagree: %i != %i, (start %i), (move %f %f %f)",
                     movePtr->id, movePtr->checksum,newsum,sum,movePtr->yaw,movePtr->y,movePtr->z);
               #endif

               movePtr->checksum = Move::ChecksumMismatch;
            }
            else
            {
               #ifdef TORQUE_DEBUG_NET_MOVES
               Con::printf("move %i checksum agree: %i == %i, (start %i), (move %f %f %f)",
                  movePtr->id, movePtr->checksum,newsum,sum,movePtr->yaw,movePtr->y,movePtr->z);
               #endif
            }
         }
      }
      //Midhir was here.
      if (!con->isAIControlled()) con->mMoveList.clearMoves(m);
   }
   else if (obj->mProcessTick)
      obj->processTick(0);
}

Then in T3D/aiFlyingVehicle.cpp replace the existing AIFlyingVehicle::processTick() function with this one:
void AIFlyingVehicle::processTick(const Move* move)
{
	Move aiMove;
	if (getAIMove(&aiMove))
	{
		move = &aiMove;
	}
	Parent::processTick(move);
}

This seems to have made my AIFlyingVehicles fully functional, I do not know how this will affect AIPlayer movement, though.
(Edit: I just ran my executable with the Stronghold demo and Kork appears to have suffered no ill effects from my meddling, it looks like this fix is good until somebody can provide a better one.)


You can download my working AIFlyingVehicle.cpp/.h and gameProcess.cpp files from here
#27
07/11/2009 (5:15 pm)
and don`t forget to add: #include "T3D/aiClient.h"

at the top of gameProcess.cpp at the end of the include list. otherwise you will get compile errors on AIConnection
#28
07/11/2009 (5:43 pm)
Ah, yes, I knew I forgot something ;)

(Edit: I had both included while I was messing around with this but actually it's #include "T3D/aiConnection.h" )

(P.P.S.: You can actually replace that code above:
if (con->isAIControlled())  
      {  
          AIConnection *c = dynamic_cast<AIConnection*>(obj->getControllingClient());  
          c->getMoveList(&movePtr, &numMoves);  
      }

with this cleaner bit:
if (con->isAIControlled())
		dynamic_cast<AIConnection*>(con)->getMoveList(&movePtr, &numMoves);
#29
07/11/2009 (6:17 pm)
ok will try that once i get back home. With the current way it is the ai fly to a certain spot then barrel roll inplace. reverting back to teh original function the ai fly`s around , even though it seems it is barrel rolling the whole way.
#30
07/11/2009 (8:08 pm)
cool bean just tested it and it works better now. The AI even fly`s closer to properly now. Good job mate.

this is awesome , now i can move forward with my projects. :P now to rig them up with guns and get them to attack me.
#31
07/11/2009 (8:09 pm)
I put my working files in a zip file and linked them in my response above in comment #26
#32
07/12/2009 (12:15 am)
Jesse: Awesome job ... thank-you very much. :)

Roland: Thank-you very much for your help as well. :)

I have said it before and I will say it again ... the GG community is THE BEST community I have ever had the pleasure of being a part of.
#33
10/12/2009 (5:05 pm)
Just on an added note, due to some minor commitment issues at work, the porting of this was put on hold ... I am now in a position to forge ahead with this again.

I apologise to all of you who were expecting this sooner ... I will get right back on the ports as soon as time permits again ... my apologies for the delays folks I am really disappointed in myself. I will put this through highest priority now.
#34
10/13/2009 (2:05 am)
any assistance I can give? Im kinda doing the same thing with T3D
#35
10/13/2009 (2:42 am)
Cyberkada: How far along the process are you? Is it using the FGE (Flight Game Example)?

I pretty much have it working in TGEA 1.8.1 (except for VMPlayer) and 1 bug, but I haven't started on the T3D port yet.

I need to keep it as true to the FGE as possible ... not sure how I am going to distribute to only FGE owners ... but that is a problem for another day. :)
#36
10/20/2009 (7:58 pm)
The scout model doesn't work in T3D 1.0.1. I need an updated dts. (The repairship and other models work). Or I can update the model with full normal/spec/diffuse support... The T3D script and asset structure is *different*. I'll have 'em flying and fighting by tomorrow...
#37
10/21/2009 (2:28 am)
The models don't work in TGEA either ... the LOD goes all "wonky". The models appear fine further out but when you approach them they completely disappear.

I will have to re-export them anyway.

With the release of 1.8.2 now (and because it is in essence a final release), I will re-port my code to that version. Hopefully I can put this to bed soon enough.

Good job on your port. :)
#38
11/09/2009 (12:36 am)
Bumpin this, as I'm wondering if the above issues were solved.
I can't program yet, but slowly learning, so i'm not much help, but i couldn't fix it myself either.
Looking forward to buying this as soon as possible for TGEA 1.8.2 as i've heard its one of the better flying examples.
#39
11/09/2009 (3:48 am)
yeah, I'm really keen to see a T3D port, I'm putting off an attempt untill I see whats happening here...
#40
11/09/2009 (4:36 am)
The biggest problem I am currently having is that the AI (Bots) don't respond correctly.

There have been a few fixes put up on this post and they don't seem to work correctly for me ... so I have had to revert back to a previous build and try the fixes again.

I am also having some problems with the existing models and LOD ... so I need to re-export those models.