PDA

View Full Version : Need some advice on C# documentation


Blackdog_kt
06-21-2012, 06:40 PM
I started a Bsc in computer science this year and today i just finished my final exams.
I'm probably going to keep myself busy with a few personal projects during the summer so that i don't get rusty, it turns out from what my professors tell me that i'm quite good at it for a beginner, plus i like the whole coding deal and i'm looking to expand my horizons a bit.

So, i'm thinking of taking up a side project on my free time that will revolve around CoD. I need some suggestions for books and/or online tutorials, but something that gets you through all key concepts.

What we're working on in uni is Java, so i have a grasp of key concepts in object oriented programming and modeling things comes very naturally to me. From what little i could find on C# (there's a lot available, but i didn't have the free time through the academic year to spend learning a second language on my own), it seems that the syntax at least is very similar.

However, i would prefer a comprehensive guide, because i think it's better to skip a chapter if i already know something, than not have documentation on something i lack knowledge of.

What i came up a few months ago was C# station: http://www.csharp-station.com/Default.aspx
At first glance it seems good, if someone with more knowledge on the subject could take a look and give me a second opinion it would be excellent.

Any other suggestions welcome, so that i can get working on it my spare time. Thanks in advance guys ;)

P.S. What i'm thinking of is a supply tracking system for multiplayer, so that we can have some starting and victory conditions, then have a mini-campaign unfold depending on player actions.

Smokeynz
06-21-2012, 09:02 PM
The problem I have with many guides, especially online ones is they get too wordy.....because they can. When someone gets excited they have a need to purge all, .......

Anyway without falling into the same trap of wordy purging, I find dot pearl quite good for simple examples of basic methods for a newbie like me to understand.

http://www.dotnetperls.com/

FG28_Kodiak
06-22-2012, 04:59 AM
The best way to learn a programming language is to use it ;)

There are free e-books available for C#, you can take a look at:
http://www.readwriteweb.com/hack/2011/05/free-e-books-on-c.php


And feel free to ask ;)

Blackdog_kt
06-22-2012, 08:15 AM
Thanks for the suggestions everyone.

The best way to learn a programming language is to use it ;)



True. I also got to reading the official documentation on MSDN.

The thing is that i'm in a spot where i know some things and foundation techniques that hold for most if not all OOP languages. For example, i had to create a card game for an assignment (we use Java in uni), so i'm familiar with modelling/extending classes properly, using control structures/statements, making a GUI with the built-in libraries and connecting it with the game state, exception handling, etc.

This brings me to a spot where i know how to do most of what i want to do, but having to translate it to another language: a matter of syntax and the specific language peculiarities.

For example, i see that C# can automatically create get/set methods, etc.
It's the small things like that which will be different.

I think i will start with the resources on MSDN and work in parallel with the links you guys gave me.

Also, i have one more question. When coding for a standalone program, i can just use the Visual Studio IDE to test and debug/execute, while following the language conventions.

But what are the conventions for using the code inside CoD? I always see people starting with a class declaration that is the same in all scripts, i think it's:

public class Mission : AMission

I assume the : symbol means extending a class, right?

Plus, is this a limitation of the public interface we're given by CoD? I assume the filename and class name have to match the name of the FMB-created mission and the class has to extend AMission (which is given to us by CoD), so that it inherits all the properties/methods we need. Am i correct?

FG28_Kodiak
06-22-2012, 08:40 AM
public class Mission : AMission

I assume the : symbol means extending a class, right?


Mission is derived from AMission.

the abstract class AMission contains:

public abstract class AMission
{
// Methods
protected AMission();
public virtual void Init(ABattle battle, int missionNumber);
public virtual void Inited();
public virtual bool IsMissionListener(int missionNumber);
public virtual void OnActorCreated(int missionNumber, string shortName, AiActor actor);
public virtual void OnActorDamaged(int missionNumber, string shortName, AiActor actor, AiDamageInitiator initiator, NamedDamageTypes damageType);
public virtual void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages);
public virtual void OnActorDestroyed(int missionNumber, string shortName, AiActor actor);
public virtual void OnActorTaskCompleted(int missionNumber, string shortName, AiActor actor);
public virtual void OnAiAirNewEnemy(AiAirEnemyElement element, int army);
public virtual void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft);
public virtual void OnAircraftCutLimb(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, LimbNames limbName);
public virtual void OnAircraftDamaged(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, NamedDamageTypes damageType);
public virtual void OnAircraftKilled(int missionNumber, string shortName, AiAircraft aircraft);
public virtual void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft);
public virtual void OnAircraftLimbDamaged(int missionNumber, string shortName, AiAircraft aircraft, AiLimbDamage limbDamage);
public virtual void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft);
public virtual void OnAutopilotOff(AiActor actor, int placeIndex);
public virtual void OnAutopilotOn(AiActor actor, int placeIndex);
public virtual void OnBattleInit();
public virtual void OnBattleStarted();
public virtual void OnBattleStoped();
public virtual void OnCarter(AiActor actor, int placeIndex);
public virtual void OnMissionLoaded(int missionNumber);
public virtual void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex);
public virtual void OnPersonHealth(AiPerson person, AiDamageInitiator initiator, float deltaHealth);
public virtual void OnPersonMoved(AiPerson person, AiActor fromCart, int fromPlaceIndex);
public virtual void OnPersonParachuteFailed(AiPerson person);
public virtual void OnPersonParachuteLanded(AiPerson person);
public virtual void OnPlaceEnter(Player player, AiActor actor, int placeIndex);
public virtual void OnPlaceLeave(Player player, AiActor actor, int placeIndex);
public virtual void OnPlayerArmy(Player player, int army);
public virtual void OnPlayerConnected(Player player);
public virtual void OnPlayerDisconnected(Player player, string diagnostic);
public virtual void OnSingleBattleSuccess(bool success);
public virtual void OnTickGame();
public virtual void OnTickReal();
public virtual void OnTrigger(int missionNumber, string shortName, bool active);
public virtual void Timeout(double sec, DoTimeout doTimeout);

// Properties
public ABattle Battle { get; private set; }
public IGamePlay GamePlay { get; }
public int MissionNumber { get; private set; }
public int MissionNumberListener { get; protected set; }
public ITime Time { get; }
}


the virtual methods are called by events (Player enters an AiActor, Plane is Landing etc.) and can replaced by the programmer (override) so you can react to the game events.

AMission and in addition the GamePlay Object (from interface class IGamePlay) are the two important classes to get informations from the Game.

IGamePlay:

public interface IGamePlay
{
// Methods
AiActor gpActorByName(string actorName);
bool gpActorIsValid(AiActor actor);
AiAirGroup gpAiAirGroup(int ID, int army);
AiAirGroup[] gpAirGroups(int Army);
AiAirport[] gpAirports();
int[] gpArmies();
string gpArmyName(int army);
void gpAviPlay(string args);
bool gpBattleIsRun();
void gpBattleStop();
AiBirthPlace[] gpBirthPlaces();
ISectionFile gpConfigUserFile();
ISectionFile gpCreateSectionFile();
ISectionFile gpCreateSectionFile(string line, out string firstWord);
DifficultySetting gpDifficultyGet();
IRecalcPathParams gpFindPath(Point2d a, double ra, Point2d b, double rb, PathType type, int army);
int gpFrontArmy(double x, double y);
double gpFrontDistance(int army, double x, double y);
bool gpFrontExist();
AiAction gpGetAction(string name);
AiTrigger gpGetTrigger(string name);
AiGroundGroup[] gpGroundGroups(int Army);
void gpHUDLogCenter(string msg);
void gpHUDLogCenter(Player[] to, string msg);
void gpHUDLogCenter(Player[] to, string msg, object[] parms);
void gpHUDLogCenter(Player[] to, string msg, object[] parms, double lifeTime);
object[] gpInvoke(object[] args);
bool gpIsServerDedicated();
bool gpIsServerSingle();
bool gpIsValidAccess();
LandTypes gpLandType(double x, double y);
ISectionFile gpLoadSectionFile(string fileName);
void gpLogServer(Player[] to, string format, object[] args);
void gpLogServerArg(bool newArg, string format, object[] parms);
void gpLogServerBegin(Player[] to, string format);
void gpLogServerEnd();
AiAirGroup gpMakeAirGroup(AiAircraft[] items, AiAirWayPoint[] way);
int gpNextMissionNumber();
Player gpPlayer();
void gpPostMissionLoad(ISectionFile file);
void gpPostMissionLoad(string fileName);
Player[] gpRemotePlayers();
string gpSectorName(double x, double y);
void gpSetOrderMissionMenu(Player player, bool thisSubMenu, int ID, string[] keys, bool[] bSubMenu);
ITime gpTime();
}

Blackdog_kt
06-22-2012, 02:16 PM
Cheers, thanks a lot. I'll try to have a look over the weekend and see what i make out of it all. ;)

ATAG_MajorBorris
06-23-2012, 03:11 PM
Good Luck Blackdog:cool:

If all goes well will you use these skills for missions building too?