HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] FPS Reference  (Read 1161 times)

DragonFist

  • General Accounts
  • *
  • Posts: 140
    • View Profile
[Resolved] FPS Reference
« on: Jun 28, 12, 12:07:08 AM »

I'm going through the FPS Demo to get examples on how some things work and following the chain of actions on firing a weapon.  I get to the server side class of FPS_Weapon and the request to fire a weapon which calls another method to do this action.  However, everything but setting the time of the weapon fire is commented out.

Yet things work in game.  What am I missing?
« Last Edit: Nov 01, 12, 12:12:03 PM by HE-Cooper »
Logged

HE-JAY

  • HeroEngine
  • *****
  • Posts: 122
    • View Profile
Re: FPS Reference
« Reply #1 on: Jun 28, 12, 10:05:20 AM »

All important player actions in the FPS are directed by the client and mediated by the server.  Attacking with a weapon, for example, uses reverse replication to send events to the server and then to other players connected in the area. This logic starts in the client-side method FPS_Weapon::FPS_WeaponAttack, follows into FPS_Weapon::FPS_WeaponAttackDelayed, and then finishes with $FPS_EVENT.FPS_SendPlayerAttackEvent and $FPS_EVENT.FPS_SendPlayerHitEvent. These events are received in other clients' client-side scripts FPS_EventPlayerHitClassMethods and FPS_EventPlayerAttackClassMethods, respectively.
Logged

DragonFist

  • General Accounts
  • *
  • Posts: 140
    • View Profile
Re: FPS Reference
« Reply #2 on: Jun 28, 12, 11:51:17 AM »

Thanks, Jay.  I'll see if I can follow that logic.
Logged

DragonFist

  • General Accounts
  • *
  • Posts: 140
    • View Profile
Re: FPS Reference
« Reply #3 on: Jun 29, 12, 02:40:15 AM »

Very interesting to review this, it has given me quite a few ideas.  Correct me if I am wrong, it seems to me that in this demo, the client is being authoritative.  I don't see any server checks going on.  Which is fine, it is a demo.  I just want to make sure I'm not missing anything.
Logged

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: FPS Reference
« Reply #4 on: Jun 29, 12, 06:34:44 AM »

For the most part yes. For twitch games you need the client to "play now, log, follow up later, ban". Etc.
Logged

DragonFist

  • General Accounts
  • *
  • Posts: 140
    • View Profile
Re: FPS Reference
« Reply #5 on: Jun 29, 12, 02:54:35 PM »

I'm not making a twitch game.  I'm looking at using raycasting for targeting purposes.  For example, either from a 1st Person view or an over the shoulder, the camera is being controlled by the mouse and anything caught by the raycast is highlighted as if it had been clicked or tab selected in most mmo's.

I'm also thinking that similar code with a wider areas (through a few rays with random 25% offest and + .25% distance) on the server side to ensure we don't have packet sniffers allowing attacks from the other side of the world and not even looking at the target.

The rest with be handled by whatever RPG attack rules I choose to implement.

I'll have to figure out the targeting aspect, we don't need to be replicating that constantly to everybody, that stays at that client and the data is sent via an event like the ones used in the FPS Demo to address client-side prediction.

How would I go about grabbing this on the server-side?  Would I just need to create classmethod scripts for the server side versions of the events, perform my calculations, change the appropriate stats and let replication address the health, etc. updates?
Logged