Autor Tema: Many Questions  (Leído 5643 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Grainovich

  • Moderator
  • Polkovnik
  • *******
  • Mensajes: 21269
  • Carisma: 645
    • Ver Perfil
Re:Many Questions
« Respuesta #60 : octubre 12, 2014, 08:02:05 pm »
Well... Stecher , I found it finally!!  :tillo:

Please, download again the hrcodwar.cs (hrcodwar_server.rar) and make your own changes.

There are several changes and it's quite complicated explain step to step the code lines changes.

https://www.dropbox.com/sh/anpckmbcd5pcc9c/AABhERL7VMEhnJQy5IEGQSW9a?dl=0

The Bravete, score points, all is fixed.... I hope ;D , I have thoroughly tested the system score and yes! you was right, the columns units were a problem, now the system count and score is ok.

As is tradition, the capture / escape bug is still pending  :P

"Fue en España donde los hombres aprendieron que uno puede tener razón y ser derrotado, que la fuerza puede destruir el alma, y que a veces el coraje no obtiene recompensa" - Albert Camus

3./JG51_Stecher

  • Cadete
  • *
  • Mensajes: 26
  • Carisma: 0
    • Ver Perfil
Re:Many Questions
« Respuesta #61 : octubre 14, 2014, 08:33:17 am »
Got it, thanks.

3./JG51_Stecher

  • Cadete
  • *
  • Mensajes: 26
  • Carisma: 0
    • Ver Perfil
Re:Many Questions
« Respuesta #62 : octubre 16, 2014, 06:15:56 am »
Just confirming that the reused units are no longer double scoring in the new version.

But I have a potentially big question about how penalties are enforced.  We've been trying for a couple weeks to add in more penalty settings for various events, like ditching and bailing.  And I was hoping to separate injury penalties from captures and deaths.  Although we may be close to figuring out how to add more than the current 3 penalties, we haven't gotten it to work yet.

But perhaps a bigger issue for some ideas we have for our campaign, is the possibility of changing the penalty enforcement trigger.  Right now, it appears that it kicks you out of the server if you are under any penalty time, and you are connected (or trying to reconnect).  We would love to change it so that the penalty enforcement triggers when you try to take off in the plane (wheels up, not just spawning), as opposed to simply being on the server.  This will allow players who have been killed/captured, to still play as a flak gunner or tank commander, if they want to, instead of just having to leave.  We think it will help us hold better attendance throughout missions, allowing people to stay online and play, while still maintaining our "one life" (as a pilot) policy.  We're poking around with the cs, and are trying to figure these things out ourselves, but we'd appreciate a hint. ;)  Is this a simple change in code, where we call on a different event (for takeoff), or would this be really complicated to achieve?

Grainovich

  • Moderator
  • Polkovnik
  • *******
  • Mensajes: 21269
  • Carisma: 645
    • Ver Perfil
Re:Many Questions
« Respuesta #63 : octubre 17, 2014, 07:37:27 pm »
Oh Stecher, I understand you so well and I would like to help you to developing new features... believe me, I cant, so sorry.

When we finished the main version we canceled a lot of planned features because we have not more time to developing it.

One of these cancel feature is the possibility to drive tanks and AAA , yes! we thought on this seriously ;D , in fact, developing this feature is easy, I think this is possible with a little changes on the code, actually this feature is disabled because his consequences is not controlled by the system.

Consequences? , yes!, when you are in pilot rol If you leave your plane flying (with esc for example) you will get a penalty ok?, but... what happens If you drive a tank along several sector (we suppose you can do it without bridges) and leave it?, this is logic? the drive or his gunner (in one tank can be two human) should get a penalty?, yes? no? and what is the correct logic? , and another problem, If a commander can move a unit a numbers of sectors... what happens with a tank moved with human interaction?, if he has moved much that these sectors? can do it?, and his coordinates? must be update in the memory to save correctly in the json files... and events!! you must to write new events for "person enter in a tank like pilot", "another person enter in a tank like gunner", etc, etc...

You see, it's is not complicated (for me that i wrote the code but for another can be a serious hell) but even for me this will need a lot of hours of coding and testing this new feature, hours of at least two person trying all possible consequences, "I drive and I dead by you", "I drive, get gunner and open fire to your airplane", "I drive and another person on gunner site open fire over your plane", etc... etc...

About the more penalties... in fact, ditching and baling will be the same, because the system have to calculate if you will be capture, escape or simply return to your home, all is resume in capture penalty or not, and it's more complicated, because is possible the pilot is injured and must to get rest in the hospital, in this case, you have a lot of possible events.

In this days, the SG1 squad (http://sg1.es/foro/hrcodwar-iii) pick up the code and they are implementing new interesting features like fuel returned, bombing and destroying by range and kilos of explosives, control of pilots out of battle area and another features that they are planning, who knows!? , is possible they will code your wishes features! ;D

Anyway, the penalties control is in:

public void piloto_Penaliza(int indice_piloto, string causa, Point2d coordenadas)

Every time you got to sit in a plane (or a tank ;D) or move inside of it,  the next events will be fired.

HRCODWAR_OnPlaceEnter(Player jugador, AiActor actor, int placeIndex)
HRCODWAR_OnPlaceLeave(Player piloto, AiActor actor, int placeIndex)

These events is pretty important and basically controlling all events in the campaign.

Now, the event function is disabling the vehicle units is on HRCODWAR_OnPlaceEnter, you can see:

Código: [Seleccionar]

// Es un aparato o una unidad terrestre??
string clase_aparato = "(unknown)";
if (vehiculo.InternalTypeName().IndexOf("bob:Aircraft") != -1)
{
    clase_aparato = vehiculo.InternalTypeName().Replace("bob:Aircraft.", "");
}
else
{
    eventos_Terrestre_Sacar_Jugadores(vehiculo);
    return;
}

The function eventos_Terrestre_Sacar_Jugadores(vehiculo) is making the job.

Stecher, the ideas are simples but the reality is a little more complicate  :P

"Fue en España donde los hombres aprendieron que uno puede tener razón y ser derrotado, que la fuerza puede destruir el alma, y que a veces el coraje no obtiene recompensa" - Albert Camus

3./JG51_Stecher

  • Cadete
  • *
  • Mensajes: 26
  • Carisma: 0
    • Ver Perfil
Re:Many Questions
« Respuesta #64 : octubre 22, 2014, 07:04:14 am »
Okay, that clears up one major issue.  I was really confused why we kept getting kicked out of the guns.  I though it was something I was doing wrong with the server settings or something.  So you actually made it do that on purpose, because it doesn't track or enforce the player status while in a ground object.  I understand that, but I am actually happy that it does not track the player.  Our idea was to use it as a means to let people play who had been killed as a pilot, since they can't fly again.  Just a simple way to playing something, outside of the penalty system.  So commenting that one section out of the code makes it work almost exactly how I was hoping it would. ;D

Even if it will revert the vehicle position to where it started instead of where it had been driven to, I doubt that's ever going to be more than a single 10km sector anyway.

SG1_Lud

  • Mladishy Leytenant
  • **
  • Mensajes: 110
  • Carisma: 0
    • Ver Perfil
Re:Many Questions
« Respuesta #65 : octubre 26, 2014, 12:22:43 pm »
Just confirming that the reused units are no longer double scoring in the new version.

But I have a potentially big question about how penalties are enforced.  We've been trying for a couple weeks to add in more penalty settings for various events, like ditching and bailing.  And I was hoping to separate injury penalties from captures and deaths.  Although we may be close to figuring out how to add more than the current 3 penalties, we haven't gotten it to work yet.

But perhaps a bigger issue for some ideas we have for our campaign, is the possibility of changing the penalty enforcement trigger.  Right now, it appears that it kicks you out of the server if you are under any penalty time, and you are connected (or trying to reconnect).  We would love to change it so that the penalty enforcement triggers when you try to take off in the plane (wheels up, not just spawning), as opposed to simply being on the server.  This will allow players who have been killed/captured, to still play as a flak gunner or tank commander, if they want to, instead of just having to leave.  We think it will help us hold better attendance throughout missions, allowing people to stay online and play, while still maintaining our "one life" (as a pilot) policy.  We're poking around with the cs, and are trying to figure these things out ourselves, but we'd appreciate a hint. ;)  Is this a simple change in code, where we call on a different event (for takeoff), or would this be really complicated to achieve?

As Grainovich says, it is doable but if you want yo make it right, and keep the code being "healthy" and efficient, there are a few things to do.

There are several ways to let the player enter the game and let him do some things (except taking a new plane), but IMO the correct way would be (sketch):

* create a new property in the class HRCODWAR_PILOTO, like banned_from_planes (bool)
* if you are in the middle of a ongoing campaign, you will need to add a new constructor [json constructor] to the class, which does NOT have that property. Thus you can load the last mission json wihtout gettin a runtime error when the system loads the jsons at the beginning of the next match.
* then when the player connects (handled by piloto_Conecta(player) ) you have to avoid the kick currently coded.
* then when he tries to enter a place (handled by HRCODWAR_OnPlaceEnter) you have to avoid when the current code detects that the player has entered a ground vehicle ->( look for eventos_Terrestre_Sacar_Jugadores) and code your own logic.

Your own logic will have to take care of a lot of possibilities, (if you follow Grainovich logic for the planes you can get a slight idea of the work to be done).

Then you have to track down though the code, every time that the class HRCODWAR_PILOTO (or its matching collection HRCODWAR_PILOTOS) is looking at the place of the pilot, the logic is not broken by having the pilot in a vehicle.

Then you have to check that when the player is killed, the vehicle is correctly disabled and/or destroyed, and the points added to the initiator..

Are you still reading? :D

Then you will discover that anyone with a gun can destroy your buildings and win the war alone... :D

(In the latest mod we have introduced a new feature to avoid this , we will publish it very soon)

So basically I concur with Grainovich. Doable yes, but you will have to weight the pros and the cons. But as your original idea is to give something to do to the banned players, I can suggest you something: we are implementing a new feature for Radar Fighter Command for RAF and Freya for Lutwaffe, largely based on Kodiak's work. The way we have coded it it would be very simple to let the player act as controller for their team, by asking the radar stations and reporting to the flight leaders...

A final word: We know that as the code is commented and developed in spanish, it is difficult to follow if you don't speak our language. While we develop our mods, we are investing a significative amount of time in documenting every function, and how to add new features to HRDCODWAR step by step, while keeping the original structure. ( We don¡t want to add new features at the price of messing up the code until it becomes unreadable, hard to maintain or uneficcient.) This project was called "HRCODWAR Programmer Reference".

We will share with the Community, currently is written in Spanish and its growing as we learn new things,  if you have the patience until we finish it... in the meantime feel free to ask us. :)


SG1_Lud

  • Mladishy Leytenant
  • **
  • Mensajes: 110
  • Carisma: 0
    • Ver Perfil
Re:Many Questions
« Respuesta #66 : octubre 26, 2014, 12:31:19 pm »
I forgot one thing: if you are coding your own stuff , it would be great if you follow some conventions:

- comment out every block you create with something like // GHOST SKIES MOD
- name your versions after the main HRCODWAR version, adding your own subversion. For instance, we use 3.65s wich means: based on main version HR 3.6 , subversion 5s by SG1
- make your features to be enabled/disabled by a simple change in a variable stored in conf.ini


Of course you're not obliged to do that, but if you plan to share your work this is a good way ( me thinks)

Saludos