Windows Build

Everything related to the code /
Tout ce qui touche au code
User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Windows Build

Post by Cire » Fri Dec 08, 2006 9:51 am

Zuff I'am starting a new topic here so that I can keep you informed of information related to windows builds. The biggest issue you are running up against as I step the code is it failing is that it can't find files.

This could be resolved if you were to extract the 'path' the exe is running in and build filenames using the path. I'am not sure if allegro supports such a thing as i'am just not interested in learning the allegro lib, but I do have a code snip that should solve it.

Code: Select all

#if defined TA3D_PLATFORM_WINDOWS
	void ExtractPathFile( const String &szFullFileName, String &szFile, String &szDir )
	{
		char drive[_MAX_DRIVE];
		char dir[_MAX_DIR];
		char fname[_MAX_FNAME];
		char ext[_MAX_EXT];
			
		// Below extracts our path where the application is being run.
		::_splitpath_s( szFullFileName.c_str(), drive, dir, fname, ext );
		
		szFile = fname;
		szDir = drive;
		szDir += dir;
	}
#end if
	String GetClientPath( void ) 
	{
		static bool bName = false;
		static String szName = _T("UNAVAILABLE");
		
		if (!bName)
		{
#if defined TA3D_PLATFORM_WINDOWS
			char fPath[ MAX_PATH ];
			String Tmp;

			::GetModuleFileName( NULL, fPath, MAX_PATH );

			ExtractPathFile( fPath, Tmp, szName );
#else
			szName = ""
#end if
			bName = true;
		}
		
		return szName;
	}
This should properly extract the path for windows builds and or otherwize use an empty string.

This could be placed in our namespace file (you don't have it yet but i'll send it to you soon). To use it we would need to adjust all places where it loads filenames to use 'std strings' as inputs and then pass it.
from:

Code: Select all

   translation_manager.load(  "ta3d.res" );
to:

Code: Select all

 translation_manager.load( GetClientPath() + "ta3d.res" );
Now the load function in translation manager woudl need adjusted to take a std:string (const it).

Also i'am almost appalled that there is next to know error handling in this code, if it fails to find a file it just keeps going without it, if it fails a check it just keeps going, not messages, no warnings nothing, eventually crashing down the line. We seriously need to look at this stuff.

Unless I can have 100% access to the code for a few days i'am not oging to bother as i've made so many changes lately, and most will soon be lost, but the key 3 I want to keep I will upload to you.

I'am going to get on my knees here and beg you to lets examine the code now before we get too much further. If we continue on our path we are headed the same avenu as spring is at now. And that is with such a beast of a code that its nearly impossible to do anything with, its lacks flexability and is poorly written.

Another thing is, some things are using allegro calls over stl calls. Now if you want to use allegro thats fine and i'll back you on it, I won't take myself to learn it but I will back your decession, however anywhere where an STL use can be done, it should be chosen over allegro. Keep in mind in many cases all allgro is doing is wrapping itself around platform specific code anyhow, so all you end up doing is adding a sorta 3rd party kludge call.

Chat with ya soon.

++Cire.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Fri Dec 08, 2006 10:11 am

Here is the first updated file 'TA3D_Platform.h', note that I removed alot of crap from this file, and now it specifically is what it is platform only definations and variable size typedefs. I will post the others in a sperate post.

Code: Select all

/*
**  File: TA3D_Platform.h
** Notes: **** PLEASE SEE README.txt FOR LICENCE AGREEMENT ****
**   Cire: *Defines the type of platform that we can compile an executable for.
**         *Since this is included within stdafx.h, and all cpp files MUST include
**           stdafx.h as its FIRST include there should be no need to directly 
**           include this within .h files.
**         *This file also specifies variable types and sizes, which might be 
**           size related.  It prevents any clashes or at least it should.  All other 
**           files should use these 'variable typedefs' at all times when possible.
*/
#pragma once

#include <allegro/platform/alplatf.h>	// Zuzuf: automatic platform detection

#undef TA3D_PLATFORM_WINDOWS
#undef TA3D_PLATFORM_LINUX
#undef TA3D_PLATFORM_MAC

#ifdef ALLEGRO_WINDOWS
  #define TA3D_PLATFORM_WINDOWS
#elif defined ALLEGRO_LINUX || defined ALLEGRO_UNIX
  #define TA3D_PLATFORM_LINUX
#elif defined ALLEGRO_MACOSX
  #define TA3D_PLATFORM_MAC
#endif

#if defined TA3D_PLATFORM_WINDOWS
   // 32-bit ints, guaranteed to be 4 bytes in size
    typedef unsigned __int32  uint32;
    typedef signed __int32    sint32;

   // 16-bit ints, guaranteed to be 2 bytes in size
    typedef unsigned __int16  uint16;
    typedef signed __int16    sint16;

   // 8-bit ints, guaranteed to be 1 byte in size
    typedef unsigned __int8   uint8;
    typedef signed __int8     sint8;

#elif defined TA3D_PLATFORM_LINUX
   // 32-bit ints, guaranteed to be 4 bytes in size
    typedef unsigned int  uint32;
    typedef signed int    sint32;

   // 16-bit ints, guaranteed to be 2 bytes in size
    typedef unsigned short  uint16;
    typedef signed short    sint16;

   // 8-bit ints, guaranteed to be 1 byte in size
    typedef unsigned char   uint8;
    typedef signed char     sint8;

#elif defined TA3D_PLATFORM_MAC
   // 32-bit ints, guaranteed to be 4 bytes in size
    typedef unsigned int  uint32;
    typedef signed int    sint32;

   // 16-bit ints, guaranteed to be 2 bytes in size
    typedef unsigned short  uint16;
    typedef signed short    sint16;

   // 8-bit ints, guaranteed to be 1 byte in size
    typedef unsigned char   uint8;
    typedef signed char     sint8;

#else
   #error TA3D: platform is unkown, please fix by defining correct platform in TA3D_Platform.h
#endif

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Fri Dec 08, 2006 10:12 am

Cire, post a link where we can download mvc build :)

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Fri Dec 08, 2006 10:17 am

An updated stdafx.h file.

Code: Select all


/*
**  File: stdafx.h
** Notes:  **** PLEASE SEE README.txt FOR LICENCE AGREEMENT ****
**  Cire: *stdafx.h and stdafx.cpp will generate a pch file
**         (pre compiled headers).
**        *All other cpp files MUST include this file as its first include.
**        *No .h files should include this file.
**        *The goal is to include everything that we need from system, and
**          game libiries, ie everything we need external to our project.
*/

#pragma once

// Cire:
//   Right off the bat, lets get everything we will need from STL includes.
#include <cstdio>
#include <cstdlib>
#include <map>
#include <list>
#include <vector>
#include <algorithm>
#include <string>

// Now lets get platform specific stuff.
#include "TA3D_Platform.h"

#if defined TA3D_PLATFORM_WINDOWS
// Cire:
//   I had to setup a pragma on c4312 warnings, because algero include
//     was generating alot of compiler noise.
   #pragma warning( disable : 4312 )

// Cire:
//   The below definations, make it so that we do not need to run fix
//     on allegro, to set proper platform, I'am not entirely sure how
//     other platfroms wana handle this so I just left it as including
//     allgero directly.
   #define ALLEGRO_MSVC

// Cire:
//   Since algero include will include windows headers for us, we probably
//    should make sure that when it does it excludes rarely used crap
//    from windows headers.
   #define WIN32_LEAN_AND_MEAN

   #include <allegro.h> // in allegro

// Cire:
//   Since we disabled 4312, we probably should set it back to its
//     default state.
   #pragma warning( default : 4312 )

   #pragma comment(lib, "tools/win32/libs/alleg.lib")
   #pragma comment(lib, "tools/win32/libs/agl.lib")

   #include "tools/win32/include/gl/glew.h"

   #pragma warning( disable : 4005 )
   #include <alleggl.h>
   #pragma warning( default : 4005 )
#else
// Cire:
//   Other platfroms may wish to adjust how allegro is included, for
//   now its this way.
   #include <allegro.h>
   #include <alleggl.h>
#endif

// Now lets get gl/glu support.
#include <GL/glu.h>

// Math include.
#include <math.h>
// Cire:
//   Malloc should not be platform specfic right???
#include <malloc.h>


// Cire:
//   string and wstring typedefs to make life easier.
typedef std::string  String;
typedef std::wstring WString;

// Cire:
//   Since byte seems to be common throughout the project we'll typedef here.
typedef uint8         byte;
typedef unsigned char uchar;
typedef signed char   schar;

// Floating point types, defined for consistencies sakes.
typedef float  real32;
typedef double real64;


#if defined TA3D_PLATFORM_WINDOWS
// Cire:
//   The below definations are my way of dealing with 2005 deperation
//   by pretty much redirecting them to proper secure methods, kludgy i know but
//   it works.
   #define strcasecmp(x,xx) _stricmp( x, xx )
   #define strcat(x,xx) strcat_s(x, sizeof(x), xx )
   #define strdup(x) _strdup( x )
   #define vsprintf(x,xx,xxx) vsprintf_s( x, sizeof(x), xx, xxx )
   #define strlwr(x) _strlwr_s(x, sizeof( x ) )
   #define strupr(x) _strupr_s(x, sizeof( x ) )

// Cire:
//  The below functions don't exists within windows math routines.
	static inline const real32 asinh( const real32 f )
	{
		return (real32)log( (real32)(f + sqrt( f * f + 1)) );
	}

	static inline const real32 acosh( const real32 f )
	{
		return (real32)log( (real32)( f + sqrt( f * f- 1)) );
	}

	static inline const real32 atanh( const real32 f)
	{
		return (real32)log( (real32)( (real32)(1.0f / f + 1.0f) / 
			 (real32)(1.0f / f - 1.0f))  ) / 2.0f;
	} 
#endif

// zuzuf: to prevent some warnings
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_TARNAME
#undef PACKAGE_STRING
#undef PACKAGE_VERSION


User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Fri Dec 08, 2006 10:24 am

New include file 'TA3D_Namespace.h':

Code: Select all

/*
**  File: TA3D_NameSpace.h
** Notes:
**   Cire: The goal of this file is mainly to introduce our namespace
**           Some constants are also defined in our namespace, function
**           prototypes ect.  
**         This file should be included 'second' in all other cpp files, it will
**           give cpp access to our namespace members.
*/
#pragma once

#include "TA3D_hpi.h"

#define TA3D_API_SI static inline
#define TA3D_API_EI extern inline
#define TA3D_API_S static
#define TA3D_API_E extern

namespace TA3D
{
	#define	TA3D_ENGINE_VERSION	"Version 0.2.4"
	#define	DEBUG_MODE

	namespace UTILS
	{
		// Some useful math and template functions
		TA3D_API_SI float  Deg2Rad (float Deg)  { return (Deg * 0.017453292f); }
		TA3D_API_SI double Deg2Rad (double Deg) { return (Deg * 0.017453292);  }
		TA3D_API_SI float  Rad2Deg (float Rad)  { return (Rad * 57.29578122f); }
		TA3D_API_SI double Rad2Deg (double Rad) { return (Rad * 57.29578122);  }	

		namespace HPI
		{
		}
	}

	namespace VARS
	{
		TA3D_API_E TA3D::UTILS::HPI::cHPIHandler *HPIManager;

		namespace CONSTANTS
		{
			// Common math related macros
			// Pi, our favorite number
#undef PI
#define PI 3.141592653589793238462643383279502884197169399375105

			// Square root of 2
#undef SQRT2
#define SQRT2 1.414213562373095048801688724209698078569671875376948

			// Square root of 2 over 2
#undef SQRT2OVER2
#define SQRT2OVER2 0.707106781186547524400844362104849039284835937688474

			// Square root of 3
#undef SQRT3
#define SQRT3 1.732050807568877293527446341505872366942805253810381

			// Square root of 3 over 2
#undef SQRT3OVER2
#define SQRT3OVER2 0.866025403784438646763723170752936183471402626905190

			// The natural number "e"
#undef NAT_E
#define NAT_E 2.718281828459045235360287471352662497757247093699959


			const uint32 uint32max =  0xffffffff;
			const uint32 uint32min =           0;
			const sint32 sint32max =  0x7fffffff;
			const sint32 sint32min = (-2147483647 - 1);

			const uint16 uint16max =  0xffff;
			const uint16 uint16min =       0;
			const sint16 sint16max =  0x7fff;
			const sint16 sint16min = -0x8000;

			const uint8  uint8max  =  0xff;
			const uint8  uint8min  =     0;
			const sint8  sint8max  =  0x7f;
			const sint8  sint8min  = -0x80;

			const uchar  ucharmax  =  0xff;
			const uchar  ucharmin  =     0;
			const schar  scharmax  =  0x7f;
			const schar  scharmin  = -0x80;
		}
	}

	// Below functions located in TA3D_Namespace.cpp
	TA3D_API_E String Lowercase( const String &sstring );
	TA3D_API_E String Uppercase( const String &sstring );
	TA3D_API_E bool StartsWith( const String &a, const String &b );
	TA3D_API_E std::string format(const char *fmt, ...) ;

	TA3D_API_EI void *GetMem( sint32 size, sint32 zero );

#if defined TA3D_PLATFORM_WINDOWS
	    TA3D_API_E void ExtractPathFile( const String &szFullFileName, String &szFile, 
			String &szDir );
#endif
		TA3D_API_E String GetClientPath( void );
}

template<class T> static void Swap (T &a, T &b)
{
    T temp;
    temp = a;
    a = b;
    b = temp;
    return;
}


// bit field mask operation macros
template<class T> static void SetMask (T &var, T &mask)
{
    var |= mask;
    return;
}


template<class T> static void UnsetMask (T &var, T &mask)
{
    var |= ~mask;
    return;
}


// ordinal bit manipulation macros  (least significant bit = bit "0")
template<class T> static T Bit (T &bit)
{
    return (1 << bit);
}


template<class T> static void SetBit (T &var, T &bit)
{
    return (SetMask (var, Bit(bit)));
}


template<class T> static void UnsetBit (T &var, T &bit)
{
    return (UnsetMask (var, Bit(bit)));
}


// Returns -1/1/0 for sign of a variable
template<class T> static T Sign (T x)
{
    if (x > 0)
        return (1);
    else
    if ( x < 0)
        return (-1);
    //else   
    return (0);
}
Last edited by Cire on Fri Dec 08, 2006 10:43 am, edited 2 times in total.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Fri Dec 08, 2006 10:26 am

New .cpp file named TA3D_Namespace.cpp

Code: Select all

#include "StdAfx.h"
#include "TA3D_Namespace.h"

namespace TA3D
{
   String Lowercase( const String &sstring )
   {
      String Return;

      Return.resize (sstring.length());
      for( uint32 i = 0; i < sstring.length(); i++)
         Return[i] = tolower (sstring[i]);

      return (Return);
   }

   String Uppercase( const String &sstring )
   {
      String Return;

      Return.resize (sstring.length());
      for( uint32 i = 0; i < sstring.length(); i++)
         Return[i] = toupper (sstring[i]);

      return (Return);
   }

	bool StartsWith( const String &a, const String &b )
	{
		String y = Lowercase( a );
		String z = Lowercase( b );
		uint16 ai, bi;

		ai = (uint16)y.length();
		bi = (uint16)z.length();

		if( ai > bi )
			return  ( (y.compare( 0, bi, z ) == 0 ) ? true : false );
		else
			return ( (z.compare( 0, ai, y ) == 0 ) ? true : false );
	}

	String format(const char *fmt, ...) 
	{
		if( !fmt ) 
			return "";

		int   result = -1, length = 256;
		char *buffer = 0;

		va_list args;
		va_start(args, fmt);

		while( result == -1 )
		{
			if( buffer )
				delete [] buffer;

			buffer = new char [length + 1];

			memset(buffer, 0, length + 1);

#if defined TA3D_PLATFORM_WINDOWS
			result = _vsnprintf_s( buffer, length, _TRUNCATE, fmt, args );
#else
			result = _vsnprintf(buffer, length, fmt, args);
#endif
			length *= 2;
		}

		String s( buffer );
		delete [] buffer;

		va_end(args);

		return s;
	} 

#if defined TA3D_PLATFORM_WINDOWS
	void ExtractPathFile( const String &szFullFileName, String &szFile, String &szDir )
	{
		char drive[_MAX_DRIVE];
		char dir[_MAX_DIR];
		char fname[_MAX_FNAME];
		char ext[_MAX_EXT];
			
		// Below extracts our path where the application is being run.
		::_splitpath_s( szFullFileName.c_str(), drive, dir, fname, ext );
		
		szFile = fname;
		szDir = drive;
		szDir += dir;
	}
#endif
	String GetClientPath( void ) 
	{
		static bool bName = false;
		static String szName = "";
		
		if (!bName)
		{
#if defined TA3D_PLATFORM_WINDOWS
			char fPath[ MAX_PATH ];
			String Tmp;

			::GetModuleFileNameA( NULL, fPath, MAX_PATH );

			ExtractPathFile( fPath, Tmp, szName );
#endif
			bName = true;
		}
		
		return szName;
	}

   // Cire: Useful malloc operation.
   inline void *GetMem( sint32 size, sint32 zero )
   {
      void *result;

      if( zero )
         result = calloc( size, 1 );
      else
         result = malloc( size );

      /*
      TODO: Global DEBUGGER NOTIFICATION HERE.
      if( !result )
      GlobalDebugger->Failed to alloc memory for hpi
      */
      return result;
   }
}


User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Fri Dec 08, 2006 10:51 am

Balthazar, I am still working on the release, as it stands now there are still some crashers in the exe, as soon as I have those resolved I will posta release build.

Sadly however my next step is to 'resync' my code with zuff's once he uploads these changes to cvs, in the process I will lose alot of changes to the code, we HAVE to find a soulation to checking out files, this coding and throwing stuff away is for the birds.

I figured zuff would be away till today and I would just upload the entire package to him, but looks like he stayed home this week. I'am hoping however that once i sync this code with his, and that while he is busy with working on a model editor I can have exclusive rights to the code for a few days and get a windows build working.

The executable weighs in at just under 700kb (release), so thats a pretty big savings in size over his 3mb version.

++Cire.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Fri Dec 08, 2006 2:12 pm

Update, I can get all the way to the menu, after clicking play it then throws an exception which i'am attempting to debug now, i am assuming that its looking for a file that it can't find and then attempting to use its data.

Because the application so poorly manages loading and manulplating data its very hard to debug, unless we step the code line by line which is a real pain.

++Cire.

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Fri Dec 08, 2006 2:12 pm

Yes, it`s pretty nice saving. You mean the size of 700 kb - without runtime packages and dynamic libraryes? Yeah, pretty nice size.

What about sinchronization - yes, it`s a difficult thing to do, but once the main part of engine will be ready, you both can just tweak different parts of it. Make a plan of fixes and don`t do both one work... But i don`t know how to do it really :P

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Fri Dec 08, 2006 2:55 pm

Well usually I use a safe source server, but since there is no 'linux' version of it that i'am aware off it screws it. In essience in a source server as I connect to it, it attains all the most recent copy of the code, as I start to work on a file it locks it at the server, so others can download it but can't work on it till I close the file.

It more or less assures that only 1 person can be working on a file at a time. In most cases I am a senior developer and thus I can 'close' down ones access to a file to take control of it, which forces the users work to be saved, then transfering it to my control. This happens quite often but usually when I take control of a file I only need a few brief moments on it in which it then immeadatly reopens on that users computer.

Theres alot of options with such a thing. CVS is nice don't get me wrong I'am not bashing it, but it don't prevent code overwritting, and it don't tell me that 'joe blow' is working on this code, ect... The checkout features in source server own CVS.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Fri Dec 08, 2006 10:32 pm

Of course using such a source server would be nice but I have a slow DSL connection so having to open and close files from a server would be slow, when I download something I can't do a commit to CVS or it has to download slowly. So I think a CVS-like solution would be better for me. I can set up a subversion repository if you can't use CVS on your dev computer.

I have merged your files to my working copy, it all works with a few modifications (mainly build error fixes) but it works and I uploaded it to CVS. I will be working on the 3DMEditor until it gets ready with a fully working 3DM format (shader support, etc...) so you will have the time to do tweak the code as long as you don't want to edit the 3DO module since it's where I am going to add stuff for 3DM format before splitting it into two modules : 3DO and 3DM, one for each format, with all stuff related to the editor (from the original 3DO module) in the 3DM module.
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Sat Dec 09, 2006 2:24 am

Have you tried to run the current code on linux? There are a number of issues here and there that need resolved, for example, in the map loading part it strips off the .tnt extension but leaves the maps\ part attached, when it tries to load map data, it appends a map\ to it so it becomes maps\maps\filename.tnt, i noticed this will debuging windows build.

I havn't resynced my copy with yours yet but i'am going to shortly. I am currently researching how to tell a mission map from a multi-player map so we can 'filter' those out. I'd also like to use the TA map selection background instead of the one your using so that as the user selects the map we can also show data on it and crap as well.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sat Dec 09, 2006 10:04 am

The code runs fine on Linux, I don't see where I forgot to remove "maps\\", in the menu module, it's removed when we get the map list, and when loading the map it just replace "tnt" with "ota".

For the selection background you mean the screen where you configure players, resources, ...? This has to be done, the map selecting function was there only to allow selecting a map, since there was nothing else to configure when I started TA3D.
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Sat Dec 09, 2006 2:07 pm

My copy must be quite a bit different then yours then.

I'll sync mine with yours now, sadly every change I made will soon be lost.

For the next few days please let me know what files you change so I don't adjust them, i'll keep track of any files I do change so I can send them to you when your ready to work on the source again.

++Cire

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sat Dec 09, 2006 11:13 pm

For the next few days, I am working on the editor, so mainly 3dmeditor.cpp/.h 3dmeditor_sub.cpp and the 3do module. Does subversion work on your PC?? I will set up a subversion repository if it works.
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Sun Dec 10, 2006 4:16 am

Your compiler must be awfully forgiven and make alot of 'assumptions', as i've found countless numbers of compile errors that should have prevented your from compiling the source.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Sun Dec 10, 2006 5:24 am

Kinda been meaning to ask you zuf, do you do alot of coding in java or c#, reason i'am asking is I notice you like to place alot of 'code' in header files which is a strange thing for c++ programers.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun Dec 10, 2006 12:13 pm

No I don't code in java or c#. I place lot of code in header files because TA3D is my first project using modules, and without modules .h and .cpp are the same. But it's mainly because when I am looking for a function or something I like not to have to look for it through lot of files except when it's a huge function, but a small one which is an inline function doesn't need for me to be in a .cpp when I don't need to make changes very often.
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Sun Dec 10, 2006 6:03 pm

Ok, i've been diligently working on the source code, and managed to get it compiling again under MSVC 2005 (aka vc8). There are just a handful of warnings i think last count was 15 or so.

Anyhow a few issues are a few things I approached differently and a few that I don't know exactly how to solve 'yet'. First thing I did was replace just about every 'fopen' command with a new function call to TA3D_OpenFile, (takes 2 arguments filename and mode), and returns a FILE * or null in case of error, its also platform safe.

Now one issue that i'am having problems with is the 'matrix' class uses allegro code for 'fixed', however stl also has a 'fixed' defination, and the compiler is bitching about which one to use, normally I would use the namespace to clarify, however 'allegro' is not namespace safe so to solve for now before I include ta3d_namespace, i have to include 'matrix.h'.

Another issue is alot of places its recasting variables from say float to bool **boggle**, in most cases I adjusted it to look at the value, if its 0 or less I assigned it as false otherwize true.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Sun Dec 10, 2006 6:33 pm

**sigh**:

Can you direct me to where I can attain the 3rd party library that you used for jpeg, getting linking errors and need the library, I'd rather not have to compile another lib so a binary in the format of .lib would be nice.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun Dec 10, 2006 6:59 pm

you should find JPGAlleg here:
http://www.ecplusplus.com/index.php?page=projects&pid=1

but there is no binary for this lib, only source so you will need to build it.
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Mon Dec 11, 2006 1:23 am

Man, why are we contining to bang our heads against the wall using substandard 3rd party libraries when when signal library would do the entire job, is more c++ compliant, much better optomized and orginized and is pretty much a complete library wrapped up in one.

I'am speak about boost lib, i'am pretty sure it compiles under every platfrom we would want, its tried and trusted.

At this rate we are gona be requiring about 400 dll's by the time the project even nears completion.

Not to mention that much of this code is very kludgy and in some areas poorly written.

Seriously man, i've spent more time last week and this week getting 3rd party binaries compiled and running under windows then acutally doing much productive work at all. I can't understand why on earth these 3rd party people don't provide fuckign binaries for thier products. Sure they provide the source but not everyone is interested in modfiging thte source, they just want the binary without having to do all the work involved in getting said binaries built.

Anyhow if your so interested in adding jpeg support why not just use the jpeg lib by 'Thomas G. Lan', its free, trusted, and has binaries built for it (very small and tight).

++Cire.

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Mon Dec 11, 2006 12:40 pm

Cire, one vote for you :) If there are not very much to change, why don`t we just use stable well-known library?

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Mon Dec 11, 2006 3:21 pm

I didn't say we could convert over to it easilly, it would take some time, some research and expermentation, ect..

But again, we are starting to move in another direction then orginally intended, so half a dozen to one, six to one in the other.

JPEG support could have been added later after we had a functional and playable build.

Personally I think we need to continue working where we are, forget network support for another month or two, get something 'playable' scripting fully functional with decent framerates when unit counts gets up into a certain range. Perhaps missions working, then move onto networking. Once that is done we could release TA3D as a 3d clone of TA, at which point we can go on to enhacements.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Mon Dec 11, 2006 4:18 pm

Well i'am at a stand still i'll upload the code to zuff later today, I can't get the jpeg library to compile correctly.

When I build it as a 'exe' i am getting uresolved external symbol on '_main', when I build it as a dll Its not generating a library file, WTF?

And i'am not gona keep playing with it to get it to build i'am sick of messing around getting 3rd stuff to compile under windows when they are too fucking lazy to provide soulations for thire projects.

So untill a jpg dll/lib is provided i'll leave building executables to zuff, this is strange shit where we are targeting a small group of linux users when we know damn fucking well that the majority of those who will be using the product will be windows users. **BOGGLE**

Imho we should be targeting a decent build under windows 1st, and then providing work arounds to getting it to compile under linux/mac.

If I sound a bit frustrated, thats good cause i spent most of this week not working much on the project but getting 3rd party libs to work under windows and not doing anything productive at all. and just as i'am starting to make progress into getting the application to run well under windows, I have to resync and loose most of my changes, then run into a new 3rd party lib that again causes more headaches.


++Cire.

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Mon Dec 11, 2006 5:52 pm

Yes, you are damn right, Cire. Zuzuf, let`s face the truth, there are at least 100 windows users versus each linux user. There are tons of very stable and comfortable lib`s for windows, there much more docs for them...
Maybe we should really focus on Windows build, and make TA3D more windows-oriented, than linux-oriented and make Linux build our second goal?

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Mon Dec 11, 2006 6:58 pm

I just can't abandon even for a while the Linux build since I work with Linux!! Now the jpeg lib is included in TA3D so it shouldn't be a problem to build now. Cire, if you are bored of loosing your work why don't you send me your working copy?? So I can sync with what you did, and you won't have to do it again :) !
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Mon Dec 11, 2006 7:25 pm

Cool, I'll provide a link to download the 'src' dir shortly, i've slightly changed just about every cpp/.h file. mostly just slight changes with the exception of console.cpp/.h they were rewritten completely. You might wana have a peek at it and test the build as well. I removed the ta3d_namespace from stdafx.h and included it at the start of almost all .cpp files now.

There are still some compile warnings in the project itself, but very veyr few, like i said about 10 or so, however allegro lib is generating lots of warnings, about 80 or so, i look at them and most arn't serious so should be ok.

In the src dir i give you I have the 'tools' dir, it contains alot of libs and includes that windows needs for the allegro/allegorgl/glew32/zlib libs and includes. So windows users of vc8 shouln't need to download and compile those libs if they don't want too.

After you upload it, i'am gona resync with it again, and hopefully it will compile, place the jpg lib in the lib dir in tools dir for windows, if all goes well i'am gona start debugging it again and get it functional on windows. Once that starts there are still several classes i wana rewrite, as well as implement sound/msuci support via fmod, i already have the basic classes done for it, however you will need to attain the fmod .so files to get it to compile under linux.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Mon Dec 11, 2006 7:28 pm

you won't need any lib for jpeg support since I included JPGAlleg as a module of TA3D.
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Mon Dec 11, 2006 7:37 pm

ok http://gpserver1.com/Cire/src.zip Its the 'src' directory, as I have said I have adjusted just about every file.

Please sync it with yours and then test the build under linux, then sync with cvs on source forge and let me know when your done so I can continue working.

Also thank you for the lib, I really appreicate not having to modify my build environment again to install gcc for windows.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Mon Dec 11, 2006 10:36 pm

That's done, the resulting code builds on Linux and is uploaded to CVS. I also fixed a few bugs:
_a crash due to a call to a wrong function in the console module (on Linux only), it was a modification I made but which doesn't work with this new module
_a bug with the ToggleShow function of the console:
when m_show was set to false m_show^=m_show; returns false so I set it to
m_show^=true;
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Tue Dec 12, 2006 12:08 am

cool, it should be easier to expand now however. The input probably should be converted to a std::string but that can be done in time.

We shoudl also start to make sure that we have a error trap function so that we can 'try' to clean up stuff should a fatal occur and we must exit gracefully.

I modified the recording so that it don't need to open/close the file each time something needs added to the log, instead it opens it and keeps it open and closes it only when the class is destoryed or a call to stop recording. If you noticed also I provided a second constructor that allows the immediate starup of recording. Finally I also moved the print stystem data to a call in the class which simplifies things.

Right now we are initing alot of variables globally at the start of each cpp file, later I figure we can add a namespace function for 'intilizate' and place all our intilalzation of globals in it.

Finally I would like to see us start using nameing standards. In classes, member variables hsould start with a m_, to make it even easier a i16 f, b, i32, i8, r32, ect shoudl be after the _and finally the variables name. I know it makes things longer but it also makes it easier to track through variables. I wouln't worry too much when we only have afew variables in each class but when we start getting lots should follow this standard.

the same should be done for globals only instead of starting with a m_, we should start with a g_, so in reality our Console should be something like g_cpConsole, this tells me quickly at looking at it that it is global, and a class pointer.

We could do tihs at a later date, tonight i'am gona resync my code with yours and at that point I have 2 classes i wana screw with, first is the sound/music managing classes, and second is i'd liek to rewrite the class for configuration.

Now are you gona be around all week, or are you leaving for the week, do I still have full rights to the code, or are you going to be working with it this week? If so lets try to keep each other apprised of changes or files we are working with.

++Cire.

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Tue Dec 12, 2006 9:27 am

Nice work, team! Here is a present for you :)
Image

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Tue Dec 12, 2006 11:20 am

Could you please reupload the code and convert it all back to 'dos' format, your editor must be saving them in 'mac' format'.

I'am getting tons of c4335 errors (file is mac format) on almost all files, especially key include allegro files.

++Cire.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Tue Dec 12, 2006 11:46 am

this can't be the same stuff i sent you, i removed just about every fopen in all the source code and standarized it to a call to TA3D_OpenFile(x,xx), as well as fixed most of the compile warnings in most of the .h/cpp files, it all seems back to how it was again.

I've only just started compiling the code and got more then 16 errors, and a 144 warnings.

++Cire.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Tue Dec 12, 2006 1:13 pm

I added a new string helper routine to TA3D Namespace, which should make your life a bit easier. I notice that you are doing alot of operations on string searchs wiht uppercasing things and what not, but are also starting to shift over to using std::string and thus having to cast its c_str as char *, ect..

So I added this.

Code: Select all

	sint32 SearchString( const String &Search, const String &StringToSearch, bool IgnoreCase )
	{
		static const std::basic_string <char>::size_type NotFound = -1;
		std::basic_string <char>::size_type iFind;
		String sz1, sz2;

		if( IgnoreCase )
		{
			sz1 = Uppercase( Search );
			sz2 = Uppercase( StringToSearch );
		}
		else
		{
			sz1 = Search;
			sz2 = StringToSearch;
		}

		iFind = sz2.find( sz1 );

		return (( iFind == NotFound ) ? -1 : (sint32)iFind );
	}
The last argument is optional and set to 'true', thus u don't have to uppercase things as this will do it for you, remember that you can past char *, or strings to this and it will construct a string if its a char otherwize will reference it as a string.
\

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Tue Dec 12, 2006 6:26 pm

It's hard to see all the differences between the files you sent me and my working copy. I have read all the files you sent but I couldn't just copy them over my working copy since I made modifications concerning the editor and the new model format.

As far as the 'mac' format is concerned, I use UTF8 to store the code, but I think CVS is able to convert it so the problem isn't on my side, you should configure CVS to convert it to windows's text format.

Balthazar -> :wink: nice work, nice idea, we should put it on the web site, on the welcome page!! but it's Total Annihilation and not Totall Annihilation, it's a typing error.
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Tue Dec 12, 2006 6:36 pm

Well i'am still getting linking issues, as stdafx.h i noticed now has a #include "jpeg/ta3d_jpg.h", and there are some calls that use jpg within ta3d.cpp, in fact 3 unresolves symbols, without that library i can't build this as linking just fails.

So back to squre one.

++Cire.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Tue Dec 12, 2006 6:38 pm

Its ok for the 'src' files to be converted to that 'mac' format as I can deal with that its that some reason every allegro file in tools\win32 had them so it has to be you uploading them or you musta changed them in some way.

I used my old copy of them as the newer ones also seemed to be generating alot of errors.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Tue Dec 12, 2006 6:46 pm

that's strange, because I just copied those files from your zip into my working copy without editing them. I have just checked they are in UTF8, so it must be on your side, I know CVS do conversion when it thinks it's needed.

As far as JPGAlleg is concerned, you need to build with the files in jpeg dir, all the .cpp files, these are the modules of JPGAlleg, normally you just build them once and that's done.
=>;-D Penguin Powered

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Tue Dec 12, 2006 6:49 pm

ok, I just replaced fopen by TA3D_OpenFile and I uploaded my working copy.

I should be there all the week, but after 7 pm (french time). We must find a better way to synchronize our work (i spent ~2 hours merging your code with mine).
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Wed Dec 13, 2006 3:36 am

I agree, but what, something that is compatabile with windows and linux, something that allows 'locking' of files as one user works on it and prevents another from opening that file for edit at the same time, and so on.

Anyhow that did it, adding the files within the jpg dir worked. However my copy is probably now outa sync with yours. I also moved some stuff around a bit but i think i will stop here and resync my source with yours again.

The biggest issue I see with the build thou is that it it loads say a fielw from gfx/blah.tga. This needs changed to do...

TA3D_OpenFile( GetClientPath() + "gfx/blah.tga" );

In other words windows build wants properly set paths to read files from, oddly it seems to work on some files but not on others. Once I have a stable version running i will work on sound/music support and should be outa most of the source code for a few days while i work on these new classes.

I would also like to add to the window version the ability to read the registry looking for TA's path, if found it will pull hpi,ccx, ect files from ta's rather then the user having to copy them to the ta3d dir.

We also need to start traversing back through code and start throwing some errors and using exception handling code to catch these and others. For example, if hpi manager don't find any files to work with, it should throw an error, which is caught in the main function that is creating the hpi class, which can then display it to the user. Its much more professional this way then simply bombing out with no explination of whats wrong.

++Cire.

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Wed Dec 13, 2006 6:47 am

Cire, I don`t think tha registry searching thing is really so usefull. Many of TA users playing at the same time in Original TA and TA with one ore some Mods, so the ability of TA 3D to search for needed files must be available only for totala1.hpi. Other resources like totala2,3,4.hpi or *.ufo should be searching only in TA 3D dir.

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Wed Dec 13, 2006 1:46 pm

Balthazar, for the few lines it will take to look in TA's dir its likely worth the effort. In essence it will first look in TA3D dir but if it don't find any then it will result to looking in TA's dir.

Zuff I was looking at the TA3D Config class, and i notice that everythign is casted as float values, except where it writes values out, it writes them as true/false in some cases, but internally it uses values as 'floats'.

I also noticed thta its writting out name = value and so on, do we really need this? I get what your aiming for is a file that we can 'edit' via a text editor but again, do we need this?

What id like to do is change this over to a true binary file fixed format, but it would impose some restrictions. That said it would however make reading and writting these files MUCH faster and easier from a coding point of view.

Heres how it would work...

1 we would have a limit on the size of a variables name say oh i dunno 15 characters 'shadow_quality' is a variable name, now since we are wroking with pure float values, we would write out the value of float next, so what you are doing is writting a fixed file size of (15 characters)(float)(15 characters)(float), reading them back requires no extra work at all since your reading 15 bytes, which will contain the null character, then the value, untill u reach an EOF.

I would like to drop the config_option struct and change this over to a map[name]=value; name of course woudl be a std::string and value the float, could even add to the class to have it do some compares.

If you were aiming to expand this to other variables, such as int and string then it wouln't be much of a change but writting/reading would require an extra 3 bytes of data to tell you when reading it in what it was, first byte would be say 1 == float, 2 == int, 3==string, the other 2 bytes would tell you how big the value was in case it was a string.

You coudl still place this in a map even with various data types, only instead of map<string,float> it would be something like map<string,void *>, the downside to this is that when u internally use the code u would have to know what the value was when reading it and cast to what you want for example String str = (String)Config->GetValue( "blah" ); or int x = (int)Config->GetValue( "blah" );

What ya think?

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Wed Dec 13, 2006 6:11 pm

We could read from registry the installation path of TA...3D because we will add a few things and even if TA3D is compatible with TA, TA isn't compatible with TA3D's new features. On Linux, personal game data would be stored in user directory as a hidden dir allowing each user to have its own configuration and data but the .hpi, .ufo, .ccx, ... data should be in an other directory which path should be stored in registry (windows) or in a file in ~/.ta3d/ on Linux.

The configuration file should never be a binary file:
_this text file isn't big (on most file system, it will take only a block of 4ko or something like that, in fact the minimum allowed by the FS)
_we don't need to have a very fast system for configuration, it's not a critical component of the game
_if the game crashes (at start for example), we should be able to edit this file to fix it.

You can use a map to store all the config data, it will be easier to add configuration variables.

I didn't edit my code since last time I uploaded it to CVS, so you can still work on your code or send it to me, I will overwrite my working copy.

You said CVS doesn't work for you, what is exactly the problem?? You didn't get all my code from the CVS web interface?? So it should work for public CVS, for developper access you only need a CVS account on sourceforge.net so I add you to the developper list with write access to CVS.

I don't really like the file locking method since I often need to read a part of a file I am not writing to and it takes bandwidth (remember I have a slow DSL... :x )
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Thu Dec 14, 2006 3:26 am

Well i'am going to write up a few more classes and do a few optomizations and then skimp out on the project, nothing more annoying that orginized confusion and loss of data if you know what I mean.

CVS is a tool that is well like steping back in the stone age from my point of persepective, it does not prevent overwritting of files or the working on several files at the same time so to speak. It, or you, or something likes to strip out windows formats on window files (cr/lf). I can see it from the regular source files, but files that are dubbed as windows only?

Anyhow, TA3D is starting to step in a direciton i'am not ready to go to yet, which is moving to new formats of units and maps when we don't even have anything truely functional yet, we are adding jpeg support, yet not one of TA's units/maps needs jpeg support.

We auta be looking at optomizing the shit outa the engine and getting it to run at peek proficency with full scripts/ai/units/maps/menus when we seem to have our focus elsewhere.

I will work on a new ta config file/ta local mode, and fmod classes and then say my good byes. Theres no doubt in my mind that TA3D could and probably will do great things, once ognization is in place, but I can pretty much guartee that you will eventually have to come up with a decent project management, as not many programers will be willing to continuely loose work.

I don't see the logic behind not using some type of file locking mechanics, file locking does not mean that you can't read a file, just that so and so is working on it, it can even request that the user close the file so you can work on it for a period of time. You need to look for 'safe source' soulations, I don't really know of any under linux but i'am sure thier must be some. And as for the bandwidth issues, that totaly don't make since to me as its text file, a few k of bytes which is updated only when your hash does not match that of the server files hash.

Give me a few days and i'll have new classes for ta config/translation and fmod.

++Cire.

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Thu Dec 14, 2006 6:55 am

Yeah, Cire seems to be right. The first goal was to make playable version with multiplayer support, but not something that yet not working and with new models format, jpeg support, and so on. It`s very usefull for modders, but we have no modders yet, and if TA 3D will not be playable, we don`t get any modders at all, so what for all this stuff?
There are should be skilled 3D modellers, but I doubt they`ll be here before really playable version of TA 3D. Yes, new 3D trees is cool, but it can be done later, once TA 3D become really playable.
There are now pathfinding yet, moving scripts, multiplayer support and many more important things for now.
What should we do?

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Thu Dec 14, 2006 6:25 pm

you are right, we need something that works even i it's not finished. Something people can play in order to make TA3D more popular. So next step will be networking and AI. But for networking we will wait for Evan, since I don't know anything about networking.
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Thu Dec 14, 2006 7:58 pm

Then, Cire, Zuzuf, let`s create a plan of TA 3D development, after Cire make all his class modifications.
1. Add chosing side ARM/CORE.
2. Add info about units, I`ve wrote about -> Hp, Dmg, Exp and so on.
3. Add pathfinding support and create some movement scripts (Land/Water/Air) that will use velocity, acceleration, latency, size and other units variables in calculation.
4. Add multiplayer support.
5. Add dumb-cheater-ai that`ll just build few factories and send all units on attack.

For AI development we can call our old AI programmer :))) If he`ll like to return.

Any suggestions are wellcome :)

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Thu Dec 14, 2006 8:48 pm

Another new function in TA3D_Namespace.cpp

Code: Select all

	String TrimString( String &sstring, String &TrimChars )
	{
		int nPos, rPos;
		String Result = String( sstring );

		// trim left
		nPos = (int)Result.find_first_not_of( TrimChars );

		if ( nPos > 0 )
			Result.erase(0, nPos);

		// trim right and return
		nPos = (int)Result.find_last_not_of( TrimChars );
		rPos = (int)Result.find_last_of( TrimChars );

		if ( rPos > nPos && rPos > -1)
			Result.erase( rPos, Result.size()-rPos );

		return Result;
	}
In header looks like

Code: Select all

	TA3D_API_E String TrimString( String &sstring, String &TrimChars = String( " \t\n\r")  );
Basically allows trimming of characters from a string.

++Cire.

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests