project-navigation
Personal tools

Author Topic: First coding attempts : pilots  (Read 14349 times)

Offline Malick

  • Rookie
  • ***
  • Posts: 72
    • View Profile
First coding attempts : pilots
« on: February 16, 2011, 08:29:47 pm »
Hi all,

This is my first coding attempt, so I started with something which I thought could be easy to implement.

My goals are :
1 - learn the coding basics and get used to the project structure.
2 - improve the implementation of the pilots ingame, in order to make them as refined as soldiers.

For this, I will start with simple mods and patches, just to see if I catch the principle.
First step : number of spawned pilots during campaign (starting and monthly)

See next posts for more details.

Malick

Offline Malick

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: First coding attempts : pilots
« Reply #1 on: February 16, 2011, 08:32:40 pm »
STEP 1 :
Make initial / starting number of pilots depend on campaign difficulty setting (in campaign.ufo)
Make number of pilots generated each month depend on Nations satisfaction (in nation.ufo)

It 'seems' to work...
I'm trying to create a patch with GIT and then I'll post it here for you to test.
I'll be back :)

Malick

EDIT : I think I found the way to make a patch... Can you try it and tell me if it works ?
OK, the filename is not the one I expected, but anyway, you can still try ^^
« Last Edit: February 16, 2011, 08:57:08 pm by Malick »

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: First coding attempts : pilots
« Reply #2 on: February 16, 2011, 10:55:35 pm »
Hey!

Welcome on board, and Grat for your first patch!

However as I remember available pilot count was "unlimited" by design so you can always fly your aircraft. But I think your patch is needed (I wanted to do that, thanks!) and this design must be dropped soon. The problem is if we implement pilot stats and have 512 pilots on start, players will just select the best of best of best and leave (or remove) the others. Pilot counts should be probably higher though, but it's fine.

Briefly read your patch, it seems to be fine but have no time to playtest now.
But:
* you should fix the comments in it. As you see the diff (patch) knows which lines exactly you added there is no need to sign your name everywhere, we don't do it either.
* doxygen comments with double asterisk on the start or *< have special meaning you should use this form only in those special cases (in the middle of the code we usually don't use it) Check Coding guidelines for more on our syntax rules

And at last: You can/should post patches to our Tracker so it isn't lost.

-geever

Offline Malick

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: First coding attempts : pilots
« Reply #3 on: February 16, 2011, 11:18:08 pm »
Hi geever,

Thanks for the feedback. It's rather simple anyway : generate x pilots at game start and y each month. I ruthlessly copied code from the soldiers lines :)
Regarding comments with my name in it, it's just to make it easier for me : I get often lost in the hundreds of files and thousands of lines... I'll remove them when i submit an official patch on the tracker, thanks.

I have made a simple roadmap for improvement of the pilots. If there is something already done by the team, I'll be glad to follow it, otherwise, here are my ideas :
1 - make pilots generated at the campaign start and each month depending on difficulty and nations [done]
2 - save the number of missions and shot down ufos, show it on screen [open]
3 - create a set of ranks, link them to the missions / kills for promotion [open]
4 - create a set of skills and attributes [open]
5 - create rules so that the skills have an impact on aircraft speed, range, targeting, missile evasion, crash survival etc.. [open]

If you have any comment or proposal, feel free to jump in !
I've been on these forums for sooooo long without contributing, it's time I do something ;)

Malick

EDIT : sent on tracker as 'pilots generated in campaign'. Please tell me if everything works fine, as I may have messed with the patching process  ::)
« Last Edit: February 17, 2011, 12:07:16 am by Malick »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: First coding attempts : pilots
« Reply #4 on: February 17, 2011, 09:04:51 am »
Quote
Regarding comments with my name in it, it's just to make it easier for me : I get often lost in the hundreds of files and thousands of lines... I'll remove them when i submit an official patch on the tracker, thanks.
git status and git diff answer u the thing u change

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: First coding attempts : pilots
« Reply #5 on: February 17, 2011, 11:06:41 am »
1 - make pilots generated at the campaign start and each month depending on difficulty and nations [done]
2 - save the number of missions and shot down ufos, show it on screen [open]
3 - create a set of ranks, link them to the missions / kills for promotion [open]
4 - create a set of skills and attributes [open]
5 - create rules so that the skills have an impact on aircraft speed, range, targeting, missile evasion, crash survival etc.. [open]

We should discuss it with BTAxis. We have plans for pilots. Join to our IRC channel (in the evening, CET).

-geever

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
Re: First coding attempts : pilots
« Reply #6 on: February 17, 2011, 11:07:59 am »
Great to see your motivation, Malick  8)

Offline Malick

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: First coding attempts : pilots
« Reply #7 on: February 18, 2011, 12:03:05 am »
Hi there,

Thanks for the warm welcome.

I gave a look on the proposal for pilots and I think this is rather close. We can discuss this, I'll try to join the IRC in the next few days.

In the mean time, did you find any issue with the patch (the test one here or the one on the tracker) ?

On my side, I'm trying to implement simple attributes/skills.
I'm looking for the definition of character templates (soldier_heavy, soldier_assault etc..)... Where can I find them ?
Anyway, it's too late to code anything right now, so I'll test this maybe on sunday.

Malick


Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: First coding attempts : pilots
« Reply #8 on: February 18, 2011, 08:00:35 am »
I gave a look on the proposal for pilots and I think this is rather close. We can discuss this, I'll try to join the IRC in the next few days.

The proposal you probably found on wiki is a bit outdated - I mentioned it to BTAxis already. What I know is that pilots will have one stat, not three, but other details should be discussed.

In the mean time, did you find any issue with the patch (the test one here or the one on the tracker) ?

No, sorry.

On my side, I'm trying to implement simple attributes/skills.
I'm looking for the definition of character templates (soldier_heavy, soldier_assault etc..)... Where can I find them ?

did you ceck the ufo-scripts?

-geever

Offline Malick

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: First coding attempts : pilots
« Reply #9 on: February 18, 2011, 07:41:07 pm »
Quote
did you ceck the ufo-scripts?

For some reason, team_templates didn't show up in codeblocks. Or I was falling asleep.  ;D
I got them now.

I'll be glad to have a chat with BTAxis and anyone who wants to join.
The attributes and skills I expected to implement were :
Code: [Select]
Attributes : Speed / Health / Mind
Skills : Piloting / Targeting / Evasion / Survival

Each governing particular parts of the interception, normal flight and air combat.

See you later...

Malick

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: First coding attempts : pilots
« Reply #10 on: February 19, 2011, 10:56:27 am »
Hi Malick, good show on working on the pilots so far. Let's talk about the design for pilots and air combat a bit.

Firstly, as you will probably already know, there's the proposal for UFO interceptions, which still counts as what we want to end up with eventually. Therefore, the pilot design should be done in this context.

Secondly, there's the old pilots proposal that stevenjackson did. This is old and no longer considered in line with our wishes, so this is the part we're looking to redesign here.

Now, my idea so far was just to use one stat for pilots that governed everything, but I see you've got something more complex in mind. So the questions I think we should answer are:
1) What exactly does each attribute do? Do the attributes only translate to a bonus to skills? If so, why do we need them?
2) What do each of the skills do exactly, in the context of the interception proposal?
3) By what mechanic do each of the attributes and skills improve?

From what I can see, 1) seems easy to answer: we don't need attributes. Pilots play a much smaller role in the game than soldiers, so they don't need to be modeled in too much detail. A pilot's performance can be adequately expressed in his skills alone, I feel.
As for 2), I think targeting, evasion and survival have obvious applications. Targeting gives a bonus to weapon accuracy, causing more shots to hit the target, evasion reduces enemy accuracy, and survival increases the chance of a rescue mission appearing if the pilot is shot down. I'm not sure about piloting, though. A plane doesn't fly any faster just because it has a good pilot. Not sure what this skill would do.
Finally 3), this depends on how far you want to go. But there seem to be only limited ways in which the various stats can increase independently from each other, since a pilot basically always does the same thing (shoot at the UFOs, and get shot at in turn). I think you'll end up with stats uniformly increasing most of the time, which is why they might as well be a single stat. But this is a point of further discussion.

Offline Malick

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: First coding attempts : pilots
« Reply #11 on: February 20, 2011, 12:58:23 pm »
Hi BTAxis,

Thanks for your reply. Here are some of my thoughts :

1 - I agree in fact pilots do not really need 'attributes'. Everything can be expressed ingame by a skill, as they play in real time (no TU), do not take shots (no health) etc... So, I'll remove this.
2 - The piloting skill is like a 'driving' skill. A friend has exactly the same car as mine. However, he is always able to drive faster and use slightly less gas than me. How does he do that ? Well, he probably knows better than me. Furthermore, this is an all-around skill that could apply to both interceptors and dropships. However, coding its influence in game will be another story...
3 - Skill improving in mission : that's a trickier one. When a pilot uses his/her skills, then they will improve. How much ? To be defined, tested and debugged.

As a summary, I'll start with the 4 following skills : Piloting, Targeting, Evasion, Survival.
It seems reasonable enough, and covers the events in the life of a PHALANX pilot.

To geever : I uploaded a corrected patch on sourceforge. Can you tell me if it works ? I'm sorry, I messed with the patch file, so I think I have corrupted it.

Malick

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: First coding attempts : pilots
« Reply #12 on: February 20, 2011, 01:47:28 pm »
3 - Skill improving in mission : that's a trickier one. When a pilot uses his/her skills, then they will improve. How much ? To be defined, tested and debugged.

I think you'll run into a number of issues with that. If a pilot's skills when they get used, then wouldn't that encourage getting shot down, in order to train the survival skill? And wouldn't it encourage sending pilots out on flights all the time, even when there are no actual UFOs to intercept or missions to go to? And in combat, how would evasion and accuracy NOT improve equally quickly? Remember, the only way having multiple stats is meaningful at all is if they're used individually and independently from each other. Otherwise they're just a gimmick.

Offline Malick

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: First coding attempts : pilots
« Reply #13 on: February 20, 2011, 02:17:01 pm »
Well, for the survival skill, there will be a good chance of loosing the pilot each time he's shot down. If the player is willing to take the risk.
And, having the pilots flying all the time just to improve their 'piloting' skill doesn't sound foolish to me : our respective air forces do it all the time ! The only limiting factor would be price of fuel and availibility for scramble / interception.
For targeting, if the pilots hits something, then his skill improves.
For evasion, it may be used as an additional check in the calculation in 'AIRFIGHT_ProbabilityToHit'. If succesful, then, the skill improves.

Right now, I'm struggling with the amount of code to be created just for the pilots.
Please correct me if I'm wrong :
Pilots can not use the same structure as the soldiers character_s.
As for the UGV, I need to create dedicated structures with attached functions :
- characterPilot_s
- CHRSH_CharGenPilotSkills to assign the skills
- chrPilotScoreGlobal_s to store them (and allow an evolution over time).

After this,  I'll modify the chrtemplates to take chrPilotTemplate, with parsing of the info from the template.ufo file.

I'm in for some serious coding !

Malick

EDIT: Alternatively, I may also modify the existing structure to take into account the new skills...
1 - I add new skills, all characters have them, but pilots have 0 skill in ground combat and soldiers 0 skill in flying. However, the savegames won't work.
2 - I re-use existing skills, will be less clean, but slightly easier. (for ex, ASSAULT - > PILOTING, HEAVY -> TARGETING, SNIPER-> EVASION...

What's your preferred solution ?
« Last Edit: February 20, 2011, 02:43:19 pm by Malick »

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: First coding attempts : pilots
« Reply #14 on: February 20, 2011, 02:49:36 pm »
And, having the pilots flying all the time just to improve their 'piloting' skill doesn't sound foolish to me : our respective air forces do it all the time ! The only limiting factor would be price of fuel and availibility for scramble / interception.

THe problem is not that it's unrealistic, but that it's not very fun. Scheduling air time for pilots would make for some tedious micro-management.