Author Topic: Military GAE Help  (Read 2199 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Military GAE Help
« on: 14 August 2009, 06:12:22 »
As you could see from the military thread, I am making a GAE custom version.

I have a few questions:
-There was a release of code before on hiding the mouse icon thing that appears in windowed. Can someone help me find that code part?
-Where is the code for the difficulties? I found the code for the ending menu screen, and gave the case the difficulties for easy and expert, as well as I found the code for putting those difficulties into the new game screen, but can't find where to put them exactly
-Is there anyway to make the labels (in the options and about menu states) work like a link. I've tried a few things, but nothing doing.

I managed to modify the about screen and startup screen, added in some options on the options screen, and removed the Huh%s??? around language strings that are not defined in the language file. That's great for debugging, but a player should never have to see Huh.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Military GAE Help
« Reply #1 on: 14 August 2009, 09:49:15 »
-There was a release of code before on hiding the mouse icon thing that appears in windowed. Can someone help me find that code part?
Fine question.

Quote from: omega
-Where is the code for the difficulties? I found the code for the ending menu screen, and gave the case the difficulties for easy and expert, as well as I found the code for putting those difficulties into the new game screen, but can't find where to put them exactly
Erm, there isn't any. Glest doesn't have difficulty levels per se, the 'difficulty' is simply how many AI opponents, and whether they are Ultra or not.

Quote from: omega
-Is there anyway to make the labels (in the options and about menu states) work like a link. I've tried a few things, but nothing doing.
You'd need to do the tests in MenuStateOptions::mouseClick(), much as it's done for the buttons and listboxes. I'd advise against doing this, the current gui is bulky and not much fun to work with, as you may have noticed Hailstone has begun integrating a new GUI, unless you're planning to release imminently you'd be better off waiting a little while.

Also, if you want to let infantry move in forests, let me know, the pathfinder can be very easily adapted for new fields of movement.

And finally, a word of caution.
C++ is not to be taken lightly, I know from looking at the modmaker that you know how to program, but C++ is a 'low level' language, it doesn't do a lot for you. You need to be very careful about such enthralling things as memory management, C++ does not 'collect your garbage' like most modern programming languages do, you allocated some memory, you'd best remember to release it when you're done with it... or your program will leak memory.  That's but one potential pitfall.

I don't want to discourage you in anyway, on the contrary, I just want to try to encourage some patience, C++ isn't really geared for rapid development in any case, as you'll no doubt learn.  Persistence and patience is key.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Military GAE Help
« Reply #2 on: 14 August 2009, 11:42:35 »
-There was a release of code before on hiding the mouse icon thing that appears in windowed. Can someone help me find that code part?
Fine question.
Say, I think it was hailstone, or some other member of the GAE team, most likely hailstone. I don't think you were here yet, so only he may know...

-Where is the code for the difficulties? I found the code for the ending menu screen, and gave the case the difficulties for easy and expert, as well as I found the code for putting those difficulties into the new game screen, but can't find where to put them exactly
Erm, there isn't any. Glest doesn't have difficulty levels per se, the 'difficulty' is simply how many AI opponents, and whether they are Ultra or not.
What I meant by difficulties is the AI level. For example, normal ai gets 100% of the resource and ultra gets 150%. This means ultra is a high difficulty level. What I want is to find the code that specifies ultra, and clone it to make an easy difficulty which only gets 50% of the resources and expert difficulty, which gets a nice 200% of the resources. I know this can be done because hailstone (or someone) mentioned doing it before in a test.

Also, if you want to let infantry move in forests, let me know, the pathfinder can be very easily adapted for new fields of movement.
Hmm, yes, this would be great. It could use a new field value (ie: forest) that will move on land that is covered in tileset object 1 and 2 (trees and dead trees). Might be good for some units. But then again, I wonder if it could screw up some of the tactical aspects of the game. Air units lose some of their advantage too, since other units are capible of 'shortcuts'. While it may be a good thing to impliment in GAE, I'm not sure if I will use it in military. As well, there was talk about this before, and there was the restriction of view by the trees that was worrysome.

And finally, a word of caution.
C++ is not to be taken lightly, I know from looking at the modmaker that you know how to program, but C++ is a 'low level' language, it doesn't do a lot for you. You need to be very careful about such enthralling things as memory management, C++ does not 'collect your garbage' like most modern programming languages do, you allocated some memory, you'd best remember to release it when you're done with it... or your program will leak memory.  That's but one potential pitfall.

I don't want to discourage you in anyway, on the contrary, I just want to try to encourage some patience, C++ isn't really geared for rapid development in any case, as you'll no doubt learn.  Persistence and patience is key.
Mmm, yes I understand. While I'll be honest, and admit my coding isn't anywhere near as good as I'd like, I think I should have the ability to make many, if not all of the changes that I have planned so far. Namely because I am recycling existing code rather than making unique new code (if it aint broke, don't fix it). Meaning that I am using what you have done, reproducing, and changing it. For example, I was able to easily add a new name to the credits of the about screen (and moving the two on the bottom row over to ensure it's still centered) once I figured out where all the code was.

That's the tricky part. Glest's code is often scrambled in many places. While it is catigorized for the most part by what it does, it is still hard to find, especially if the code you need references to other code or variables described earlier. The lack of proper commenting makes it slightly harder too.

I don't suppose you could recommend the ideal order to read through the folders (ie: read this folder first, then this, then the shared, etc;).

By the way, I really still need the source for 0.2.12, which does not appear to be on codemonger or sourceforge...

*I'm not ashamed to admit I understand next to nothing about all the open GL code. However, I don't need to modify really any of that, so that's fine*

*** What would you recommend, if I want to get started within a few weeks (maybe 2?). Should I wait for the graphical GUI, or should I go ahead? I can easily wait a bit without penalty, because I still have plenty to do for military that does not need the coding, as that can be last, though I can't wait forever. Do you have a rough estimate (even within a couple weeks) for the release date of the gui version (and do make sure to release the source).

EDIT//
One other note, is the language file of the current version 0.2.12 correct? It seems to be missing a few of the new values in my file, which I think I got most of them...
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Military GAE Help
« Reply #3 on: 14 August 2009, 13:07:38 »
What I meant by difficulties is the AI level. For example, normal ai gets 100% of the resource and ultra gets 150%. This means ultra is a high difficulty level. What I want is to find the code that specifies ultra, and clone it to make an easy difficulty which only gets 50% of the resources and expert difficulty, which gets a nice 200% of the resources. I know this can be done because hailstone (or someone) mentioned doing it before in a test.

UnitUpdater::updateHarvest()
Code: [Select]
//update resources
int resourceAmount = unit->getLoadCount();
if (unit->getFaction()->getCpuUltraControl()) {
resourceAmount *= ultraResourceFactor;
}

Quote from: omega
That's the tricky part. Glest's code is often scrambled in many places. While it is catigorized for the most part by what it does, it is still hard to find, especially if the code you need references to other code or variables described earlier. The lack of proper commenting makes it slightly harder too.

I don't suppose you could recommend the ideal order to read through the folders (ie: read this folder first, then this, then the shared, etc;).

There is no ideal order, and you sure as hell don't want to be reading all of it anyway.  You've just got to find what your looking for, then 'explore' from there.  I'll assume you're using Visual C++ Express, in which case you can 'get around' by right clicking things, 'go to declaration' will take you to where the function/variable is declared, typically in a header file, 'go to definition' will take you to where it is defined, and 'find all references' will do a 'find' through all the source, telling you everywhere a variable is used, or where a function is called.

For very simple things liking changing strings you might be alright, but the kind of C++ you're going to find in a game like Glest is not something you're going to figure out in a couple of weeks. Years of intensive study perhaps, but not weeks, not months.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Military GAE Help
« Reply #4 on: 15 August 2009, 00:50:16 »
Good to see you are getting into the programming side Omega.

You can start at glestMain() in main.cpp and step through it until you get bored. Coincidentally this is where the showMouse code is. Also do a "find all references" on renderMouse2d() in renderer.h
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Military GAE Help
« Reply #5 on: 16 August 2009, 10:37:41 »
Fantastic! Thanks for your help. I am trying to figure out where all the references to the CPU level would be so I can make a few more levels (easy and expert) I found ai_rule, unit_updater (this isn't in 0.2.12 though, is it? I think it was removed), the new game menu, and some where else too. I made a change in one other place that had all the difficulty levels in a case, but I can't remember where... Will have to do a search. I normally will be using VS 2008, but I lost it in my crash, and the filesize is huge. For now, I am using a very old version. 2003... Ugh. I haven't actually gotten around to compiling yet, but I see no reason it won't work. However, I gotta figure out if I want to compile it. I might wait for the next version, I might not. I guess it depends on how far along the next version of GAE is when I am done the modeling...
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Military GAE Help
« Reply #6 on: 17 August 2009, 08:52:50 »
Sorry for the DP.

A few more questions:

-In the AI scripts, the build priority is defensive buildings, warrior-producing buildings, then resource producing buildings.
Is this in reverse order, or is there another reason for this order?

-What is that config sh thing? It appears to be some script, but no clue how to use it. I guess it's old school method for me. Whee!

-How is a XML element specified to be optional // EDIT, don't answer this. Since you said the new version uses TinyXML or something instead of xerces, then that method is probably obsolete, if not, go ahead and answer).

-To enable some of the debugging things you had, we'd just remove the ifndef (and if there is any, the else tags for that if statement), correct? Out of curiosity, why is it ifndef? That means if not defined, right? So wouldn't it be ifdef? Or am I mistaken?

-Is there anyway to make a tga image be displayed as a 2D image covering the entire screen, and then kill it on command (I would like to make an image come up on command (a key press) and then leave on command (another key press). I am not sure if I would get this done, but is there anyway to display that image, using the current source, before the GUI is added? I suppose it would be far easier with a GUI, but I want to start my coding the moment I'm done everything else. With just 2 units, the main menu model, and to GAE-ize the XMLs to go, I expect to be done the main faction within the week, and move onto the final step, coding it, and I'll use whatever version of GAE is available.

*If it appears that the new version of GAE won't be released within a week (I doubt), then could ANYONE please upload the entire source in a COMPRESSED FILE? Having dial-up, I am no fan of downloading via SVN. Thanks! ;)
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

kazakore

  • Guest
Re: Military GAE Help
« Reply #7 on: 17 August 2009, 10:48:38 »

-In the AI scripts, the build priority is defensive buildings, warrior-producing buildings, then resource producing buildings.
Is this in reverse order, or is there another reason for this order?


Think about it. If resource producing had highest priority then very little else would be made. Defensive structures can not be built until a lot of research has been done so for much of the game this will be skipped and they will move to the next item.

At least that would be my assumption...

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Military GAE Help
« Reply #8 on: 17 August 2009, 12:05:12 »
-What is that config sh thing? It appears to be some script, but no clue how to use it. I guess it's old school method for me. Whee!
A shell script, it's for real operating systems, not windows ;)

Quote from: omega
-How is a XML element specified to be optional // EDIT, don't answer this. Since you said the new version uses TinyXML or something instead of xerces, then that method is probably obsolete, if not, go ahead and answer).
The game still uses the same interface for XML, most of the functions take an optional bool parameter indicating whether the requested thing is required or not.

Quote from: omega
-To enable some of the debugging things you had, we'd just remove the ifndef (and if there is any, the else tags for that if statement), correct? Out of curiosity, why is it ifndef? That means if not defined, right? So wouldn't it be ifdef? Or am I mistaken?
No, don't go removing them... they are there to allow you to compile with or without it easily, you just define the symbol or not, then that code gets compiled in or completely ignored.  The define can be in the source somewhere, but debugging ones are often used in many places so it's best to define it in on the command line (or using visual studio, in the project properties).

Quote from: omega
-Is there anyway to make a tga image be displayed as a 2D image covering the entire screen, and then kill it on command (I would like to make an image come up on command (a key press) and then leave on command (another key press). I am not sure if I would get this done, but is there anyway to display that image, using the current source, before the GUI is added?
Yes, but not as easily as you are probably hoping.

Quote
*If it appears that the new version of GAE won't be released within a week (I doubt), then could ANYONE please upload the entire source in a COMPRESSED FILE? Having dial-up, I am no fan of downloading via SVN. Thanks! ;)
here you go, 414 KB,
https://sourceforge.net/projects/glestae/files/glestae_source/0.2.12/gae-0.2.12-src.7z/download
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Military GAE Help
« Reply #9 on: 19 August 2009, 05:29:59 »
Thanks for the download. Is there any new dependancies needed? (I have the v 0.2.11 dependancies).

Thanks for answering the XML question, but can you specify what that code is? Most likely a function, if it carries another value. I guess I'll look myself.

My bad about the debugging. How do you define in command line though?

Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Military GAE Help
« Reply #10 on: 19 August 2009, 14:33:42 »
Dependancies LUA and ZLIB, PM me if you want me to email them to you.

I don't have a c++ 'rig' on the computer I'm currently on, but if you look in the xml_parser files, you'll find functions that have 'default parameters', the declaration (in the header file) might look like,
Code: [Select]
class XmlThing {
   ...
   SomeReturnType getAttribute ( string &name, bool req = true );
   ...
}
What this means is the function takes a second parameter of type 'bool' which can be omitted, in which case it gets a default value, in this case true.

so when calling it you can ...
Code: [Select]
// get an attribute named path, this will throw an exception if not found
attrib = xmlThing.getAttribute ( "path" );

// or, get an attribute named path, or NULL if there isn't one
attrib = xml.getAttribute ( "path", false );

Excuse my made up examples, but as I said, I don't have the code to look at right now  :-\

To define something project wide in VC, goto 'properties' on the project, 'c++' page 'preprocesser' and its should be there somewhere, again, sorry to be vague...
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Military GAE Help
« Reply #11 on: 19 August 2009, 19:24:03 »
Ah yes, I see. I think I'll have no trouble finding that.

I see how it is a default boolean, meaning if I don't specify it, it will become the default, but if I specify, it will overwrite the default.

I've PMed you for the dependancies.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert