Author Topic: stable GAE release ( betaversion 0.2.8a is released )  (Read 4966 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
stable GAE release ( betaversion 0.2.8a is released )
« on: 23 October 2008, 08:53:48 »
What about a first stable and official release of GAE?
I would be really happy to see something like this! This Should include all stable features of GAE and lua-scripting if possible.
So no more features yet, just a stable release which can be the current base for the artists/players/documentation.
This can also be used to promote GAE a bit more.

UPDATE:
0.2.8 is released, please test it all!
here is my linux 32-binary:
http://www.titusgames.de/gae/glestadv-l ... 2.8.tar.gz
« Last Edit: 29 October 2008, 23:59:17 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

daniel.santos

  • Guest
Re: stable GAE release
« Reply #1 on: 24 October 2008, 01:02:47 »
Not a bad idea.  Perhaps we should freeze features on 0.2.x and try to get it nice and stable?  Then we could defer all new features to the 0.3.x branch.  How does that sound to everybody?  I'm still screwing with 0.2.8, I want to work out at least one more kink before I release it (most of my changes are checked in now) and I also want to get all our progress on FPM updated and released with it.

Both Glest & GAE are incompatible with xerces-c 3.0, but I'm not aiming to address that in 0.2.8, although I do want to get it fixed in 0.2.x.  When last updating my distro (Gentoo with ~amd64 keyword), it has upgraded xerces-c, so I've had to setup a separate installation of xerces-c 2.8 for GAE development.

omi

  • Guest
Re: stable GAE release
« Reply #2 on: 24 October 2008, 06:57:50 »
I think that xerces is too big ( several MB ) and not convenient for the glest needs. There is another xml paser "tinyXML" that we could use. I have used it in my projects and it works fine. I can throw away xerces from xml_parser.cpp and put there tinyXML. Daniel, I will need only one or two hours to do this.

Could you tell me which programming environment you use to compile the windows glest version without problems ( eg. eclipse, NetBeans, vs ).
« Last Edit: 24 October 2008, 13:30:47 by omi »

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: stable GAE release
« Reply #3 on: 24 October 2008, 12:29:25 »
I will help fix bugs. I have a week now to study for exams then a week of exams then I have holidays.

Quote
I think that xerces is too big ( several MB ) and not convenient for the glest needs.
I think so too, I'm not sure how many of the features of xerces Glest actually uses.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

omi

  • Guest
Re: stable GAE release
« Reply #4 on: 24 October 2008, 12:56:20 »
Not many. In fact, you need only to read the nodes and attributes, nothing more or I am in wrong.

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: stable GAE release
« Reply #5 on: 24 October 2008, 13:05:26 »
Also while we're on the topic of killing parts, I think having SDL and win32 windowing is duplicating functionality since SDL is cross-platform.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

omi

  • Guest
Re: stable GAE release
« Reply #6 on: 24 October 2008, 13:25:10 »
Quote
Also while we're on the topic of killing parts, I think having SDL and win32 windowing is duplicating functionality since SDL is cross-platform.
O yes, that's interesting but is not a native code faster and simpler then SDL library?

I wrote a new version xml_parser for the glest.
But I have not compiled this code yet... you will need to check for and corect my errors.

xml_parser.h
Code: [Select]
#ifndef _SHARED_XML_XMLPARSER_H_
#define _SHARED_XML_XMLPARSER_H_

#include <vector>

namespace Shared { namespace Xml
{

const int strSize = 256;

class XmlTree;
class XmlNode;
class XmlAttribute;

//===========================================================================
// class XmlTree
//===========================================================================

class XmlTree
{
public:
XmlTree();
~XmlTree();

void load( const string &path );
void save( const string &path );

XmlNode *getRootNode() const { return rootNode; }

private:
XmlNode *rootNode;

private:
XmlTree( XmlTree& );
void operator =( XmlTree& );

};

//===========================================================================
// class XmlNode
//===========================================================================

class XmlNode
{
public:
XmlNode( const string &name );
~XmlNode();

const string &getName() const { return name;}
const string &getText() const { return text; }
int getChildCount() const { return children.size(); }
int getAttributeCount() const { return attributes.size(); }

XmlAttribute *getAttribute(int i) const;
XmlAttribute *getAttribute(const string &name) const;
XmlNode *getChild(int i) const;
XmlNode *getChild(const string &childName, int childIndex=0) const;
XmlNode *getParent() const;

void setText( const string &text );

void addChild( XmlNode *child );
XmlAttribute *addAttribute(const string &name, const string &value);

private:
string name;
string text;
std::vector<XmlNode*> children;
std::vector<XmlAttribute*> attributes;

private:
XmlNode(XmlNode&);
void operator =(XmlNode&);
string getTreeString() const;
};

//===========================================================================
// class XmlAttribute
//===========================================================================

class XmlAttribute
{
public:

XmlAttribute(const string &name, const string &value);

const string &getName() const {return name;}
const string &getValue() const {return value;}

bool getBoolValue() const;
int getIntValue() const;
int getIntValue(int min, int max) const;
float getFloatValue() const;
float getFloatValue(float min, float max) const;
const string &getRestrictedValue() const;

private:
string value;
string name;

private:
XmlAttribute(XmlAttribute&);
void operator =(XmlAttribute&);
};

} }

#endif

xml_parser.cpp
Code: [Select]
#include "xml_parser.h"
#include <fstream>
#include <stdexcept>
#include "tinyxml\tinyxml.h"
#include "conversion.h"

#include "leak_dumper.h"

using namespace std;

namespace Shared { namespace Xml
{

using namespace Util;

XmlNode* parseXmlElement( TiXmlNode* tiNode )
{
if ( !tiNode )
return 0;

if ( tiNode->Type() == TiXmlNode::ELEMENT )
{

TiXmlElement *tiElem = tiNode->ToElement();
XmlNode *node = new XmlNode( tiElem->ValueStr() );

for ( TiXmlNode* tiChild = tiElem->FirstChild(); tiChild; tiChild = tiChild->NextSibling() )
{
switch ( tiChild->Type() )
{
case TiXmlNode::TEXT:
{
node->setText( tiChild->ToText()->ValueStr() );
}

case TiXmlNode::ELEMENT:
{
XmlNode *child = parseXmlElement( tiChild );
if ( child )
node->addChild( child );
}
}
}

TiXmlAttribute *pAttrib = tiElem->FirstAttribute();
while ( pAttrib )
{
node->addAttribute( pAttrib->Name(), pAttrib->Value() );
pAttrib = pAttrib->Next();
}
return node;
}
return 0;
}

//===========================================================================
// class XmlTree
//===========================================================================

XmlTree::XmlTree()
{
rootNode= NULL;
}

void XmlTree::load( const String &path )
{
TiXmlDocument doc( path );

if ( !doc.LoadFile() )
{
char buf[255];
sprintf( buf, "Could not load file '%s'. Error='%s'.", path.c_str(), doc.ErrorDesc() );
throw runtime_error( buf );
}

TiXmlElement* pElem = doc.FirstChildElement()->ToElement();

// should always have a valid root
if ( !pElem )
{
char buf[255];
sprintf( buf,  "File '%s' doesn't have a valid root xml element.", path.c_str() );
throw runtime_error( buf );
}

rootNode = parseXmlElement( pElem );
}

void XmlTree::save(const String &path)
{
TiXmlDocument doc( path );

if ( doc.SaveFile() )
{
char buf[255];
sprintf( buf, "Could not save file '%s'. Error='%s'.", path.c_str(), doc.ErrorDesc() );
throw runtime_error( buf );
}
}

XmlTree::~XmlTree()
{
delete rootNode;
}


//===========================================================================
// class XmlNode
//===========================================================================

XmlNode::XmlNode( const String &name )
{
this->name = name;
}

XmlNode::~XmlNode()
{
for ( u32 i = 0; i < children.size(); ++i )
{
delete children[i];
}

for( u32 i = 0; i < attributes.size(); ++i )
{
delete attributes[i];
}
}

XmlAttribute *XmlNode::getAttribute( int i ) const
{
if ( i >= attributes.size() )
{
throw runtime_error( getName() + " node doesn't have " + intToStr( i ) + " attributes" );
}
return attributes[i];
}

XmlAttribute *XmlNode::getAttribute(const String &name) const
{
for ( u32 i = 0; i < attributes.size(); ++i )
{
if ( attributes[i]->getName() == name )
{
return attributes[i];
}
}

throw runtime_error( "\"" + getName() + "\" node doesn't have a attribute named \"" + name + "\"" );
}

XmlNode *XmlNode::getChild( int i ) const
{
if ( i >= children.size() )
throw runtime_error( "\"" + getName()+ "\" node doesn't have " + intToStr( i + 1 ) + " children" );
return children[i];
}


XmlNode *XmlNode::getChild( const String &childName, int i ) const
{
if ( i >= children.size() )
{
throw runtime_error( "\"" + name + "\" node doesn't have " + intToStr( i + 1 ) + " children named \"" + childName + "\"\n\nTree: " + getTreeString() );
}

int count = 0;
for ( u32 j = 0; j < children.size(); ++j )
{
if ( children[ j ]->getName() == childName )
{
if ( count == i )
{
return children[ j ];
}
count++;
}
}

throw runtime_error( "Node \"" + getName() + "\" doesn't have " + intToStr( i + 1) + " children named  \"" + childName + "\"\n\nTree: " + getTreeString() );
}

void XmlNode::addChild( XmlNode *child )
{
if ( child )
children.push_back( child );
}

XmlAttribute *XmlNode::addAttribute( const String &name, const String &value )
{
XmlAttribute *attr = new XmlAttribute( name, value );
attributes.push_back(attr);
return attr;
}

String XmlNode::getTreeString() const
{
String str;

str += getName();

if ( !children.empty() )
{
str += " (";
for ( u32 i = 0; i < children.size(); ++i )
{
str += children[i]->getTreeString();
str += " ";
}

str +=") ";
}

return str;
}

void XmlNode::setText( const String &text )
{
this->text = text;
}

//===========================================================================
// class XmlAttribute
//===========================================================================

XmlAttribute::XmlAttribute( const String &name, const String &value )
{
this->name= name;
this->value= value;
}

bool XmlAttribute::getBoolValue() const
{
if ( value == "true" )
{
return true;
}
else if ( value == "false" )
{
return false;
}
else
{
throw runtime_error( "Not a valid bool value (true or false): " + getName() + ": " + value );
}
}

int XmlAttribute::getIntValue() const
{
return strToInt(value);
}

int XmlAttribute::getIntValue( int min, int max ) const
{
int i = strToInt( value );

if ( i < min || i > max )
{
throw runtime_error( "Xml Attribute int out of range: " + getName() + ": " + value );
}

return i;
}

float XmlAttribute::getFloatValue() const
{
return strToFloat( value );
}

float XmlAttribute::getFloatValue( float min, float max ) const
{
float f = strToFloat( value );

if( f < min || f > max )
{
throw runtime_error( "Xml attribute float out of range: " + getName() + ": " + value );
}

return f;
}

const String &XmlAttribute::getRestrictedValue() const
{
const String allowedCharacters = "abcdefghijklmnopqrstuvwxyz1234567890._-/";

for( int i = 0; i < value.size(); ++i )
{
if ( allowedCharacters.find( value[ i ]) == String::npos )
{
throw runtime_error(
String( "The String \"" + value + "\" contains a character that is not allowed: \"") + value[i] +
"\"\nFor portability reasons the only allowed characters in this field are: " + allowedCharacters);
}
}

return value;
}

} }
« Last Edit: 27 October 2008, 15:20:14 by omi »

daniel.santos

  • Guest
Re: stable GAE release
« Reply #7 on: 25 October 2008, 10:56:19 »
Sweet!  I'll definitely give it a go tomorrow.  I haven't programmed much with XML libraries, so I was just leaving well enough alone until it broke on xerces-c 3, so thanks, this was going to have to be screwed with either way :)

daniel.santos

  • Guest
Re: stable GAE release
« Reply #8 on: 26 October 2008, 06:44:48 »
omi, I have one problem: You used the code from the original Glest rather than GAE.  xml_parser.h is a file I have mercilessly modified.  I haven't done as much to xml_parser.cpp, but I have still changed that one as well.  Most of what I added to xml_parser.h is inlined shortcut functions to keep code in other places cleaner and less noisy.

Anyway, I'm going to work on a few other things right now (I need to merge 0.2.8 into the 0.3 branch) and I'll come back to this tomorrow or so.  Maybe you can give the GAE xml_parser.h/.cpp a look in the mean time? :)  And thanks again.

omi

  • Guest
Re: stable GAE release
« Reply #9 on: 26 October 2008, 08:38:27 »
Oh... damn... :(

daniel.santos

  • Guest
Re: stable GAE release
« Reply #10 on: 26 October 2008, 10:24:00 »
Quote from: "omi"
Oh... damn... :(
w00t!!! :)  
Code: [Select]
svn co https://glest.codemonger.org/svn/repos/gae/branches/0.3 gaeIf you do this part, I'll add a tinyxml.m4 or otherwise hack up configure.ac to properly check for and configure parameters for tinyxml.  I'm starting to get half way descent at working with .m4 macros, or more to the point, at finding other projects that have an .m4 macro I need and successfully ripping it off. :)

I suspect that there are few if any things you'll need to worry about in xml_parser.h because it's mostly stuff to tell the C++ inlining part of optimizer to do work (i.e., just giving different names for various sets of operations).  I know I have changed xml_parser.cpp, but I don't *think* I made a gross number of changes.  And thanks again!  If you can knock this out, I'll happily integrate it into 0.3 as it will solve the problems with xerces-c 3.0 compatibility as well.  (Side note: http://bugs.gentoo.org/show_bug.cgi?id=243188)

omi

  • Guest
Re: stable GAE release
« Reply #11 on: 27 October 2008, 08:29:42 »

omi

  • Guest
Re: stable GAE release
« Reply #12 on: 27 October 2008, 19:56:15 »
Daniel I will need your help.
How to compile GEA sources under Linux?  Where is "configure" and "autogen.sh" scripts?
I ask you about Linux beceuse I have problem to compile GEA under Windows system.

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: stable GAE release
« Reply #13 on: 27 October 2008, 23:25:42 »
Quote
How to compile GAE sources under Linux?
Go to 'mk/linux/' , configure and autogen.sh are in there.

Quote
I have problem to compile GAE under Windows system.
I think getting people compiling under Windows should be included in getting the release stable. I have already created a thread for it.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: stable GAE release
« Reply #14 on: 28 October 2008, 02:10:46 »
Quote from: "omi"
How to compile GEA sources under Linux? Where is "configure" and "autogen.sh" scripts?
cd to the sources/mk/linux directory and run ./autogen.sh, that will create the configure script.  You need to have autotools (that is, aclocal and autoconf) installed.  You then compile using jam and not make.

Quote from: "omi"
I ask you about Linux beceuse I have problem to compile GEA under Windows system.
I'm still using Visual Studio 2008 Express Edition.  It will only run for one month but I just set my system date back to January (when I installed it) and it starts right up (I change it right back too).  Visual Studio project & solution files aren't nearly as easy to manage as autoconf/make/jam, etc.  They like to keep hard paths & such.  I wrote up instructions some time back for doing this compile here (and I added a sticky FAQ with this info in it too): Compiling on Win32 using no-cost tools (MSVC++ 2008 Express)

Quote from: "omi"
merged my the xml_paser with the GEA xml_paser, but I have not compiled yet these changes ( I don't have access to my private computer ).
Sweet!! I play! :)

daniel.santos

  • Guest
Re: stable GAE release
« Reply #15 on: 28 October 2008, 04:02:33 »
omi, it has lots of problems.  I'll email you.

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: stable GAE release
« Reply #16 on: 29 October 2008, 11:56:36 »
Quote
I'm still using Visual Studio 2008 Express Edition. It will only run for one month but I just set my system date back to January
Perhaps using a different IDE? Code::Blocks, Eclipse, Dev-C++, NetBeans. They use make too.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: stable GAE release ( 0.2.8 is released )
« Reply #17 on: 29 October 2008, 23:54:45 »
0.2.8 is released, please test it all!
here is my linux 32-binary:
http://www.titusgames.de/gae/glestadv-l ... 2.8.tar.gz

Please post your bugs in the other thread:
http://www.glest.org/glest_board/viewto ... =15&t=3903
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

daniel.santos

  • Guest
Re: stable GAE release ( 0.2.8 is released )
« Reply #18 on: 30 October 2008, 20:09:49 »
Quote from: "titi"
0.2.8 is released, please test it all!
here is my linux 32-binary:
http://www.titusgames.de/gae/glestadv-l ... 2.8.tar.gz

ooh, thanks for the 32-bit binary.  Why hadn't I thought of packaging the binary with the small amount of data that GAE uses?  I'll do that with future releases.  Also, did you use any -march= flag? If not, it may not work on some processors since the default is -march=native.  The lowest common denominator that's usually accepted now is the -march=i686 flag (a pentium pro with no MMX, SSE or anything), but it's nice to offer a 32 bit binary that's something like -march=pentium4 (MMX, SSE & SSE2), it's the SSE2 instructions that make the biggest difference from what I understand.  Anyway, I hope that if somebody reads something I wrote here and knows it's wrong that you post a correction :)

daniel.santos

  • Guest
Re: stable GAE release
« Reply #19 on: 31 October 2008, 06:49:47 »
Quote from: "hailstone"
Quote
I'm still using Visual Studio 2008 Express Edition. It will only run for one month but I just set my system date back to January
Perhaps using a different IDE? Code::Blocks, Eclipse, Dev-C++, NetBeans. They use make too.
I've used Eclipse for C/C++ development, but not any of the others you listed above.  Eclipse doesn't come with a C/C++ compiler, it lets you specify an external one.  I don't know about the others.  I think that there's still an advantage to using the MS compiler on windows, those bastards have been able to spend millions, maybe tens or hundreds of millions, tweaking out their optimizer and from what I understand, it's the best optimizing compiler for x86.  I've even heard of people using it (somehow) to compile GNU/Linux.

Either way, it would be quite nice to have a means to use either the m$ compiler and/or gcc on windows, and probably the best mechanism would be to use Cygwin -> autogen.sh -> ./configure -> jam much like we do on GNU/Linux.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: stable GAE release ( betaversion 0.2.8 is released )
« Reply #20 on: 3 November 2008, 13:51:23 »
Will lua scripting be supported in GAE 0.2.x ? Or is his something for 0.3?
I would be very happy to have something official/stable with lua. This lua scripting gives us a lot of possibilities.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

daniel.santos

  • Guest
Re: stable GAE release ( betaversion 0.2.8a is released )
« Reply #21 on: 4 November 2008, 03:21:09 »
I'm planning on integrating it into 0.3.x.  It's not even out of beta in Glest yet, so there's no way to port that into a branch that we're trying to stabilize.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: stable GAE release ( betaversion 0.2.8a is released )
« Reply #22 on: 4 November 2008, 15:11:04 »
Thats ok.
But I think for 3.0 we will have the same problem that there is no official glest released with lua support.
But its already working and it only has this one bug ( and I and my son did a lot of things with it!
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

daniel.santos

  • Guest
Re: stable GAE release ( betaversion 0.2.8a is released )
« Reply #23 on: 5 November 2008, 03:15:26 »
Quote from: "titi"
But its already working and it only has this one bug ( and I and my son did a lot of things with it!
Very cool! :) :)  I haven't gotten a chance to play with it much at all yet!  I'm pretty stoked about it really and if there's only one major but, I doubt it will be too long before Martiño has it ready.  Keep in mind that adding scripting is a huge change to the engine and involves injecting at least small snippets of code in many many places.  I've integrated a small part of this in 0.3 thus far, but I have a very long ways to go.  I'm kinda hoping that the 0.3 branch can eventually integrate everything in Glest 3.2 along with the majority of important new features and become stabilized enough to seriously start talking to Martiño about merging it with Glest and calling it Glest 4.0 or something.  That's not a discussion we can seriously have yet, so that's my personal hope and it depends upon how much time each of us will have as well as how much coding contributions we can get from others for GAE.