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

Author Topic: making a custom ACCC?  (Read 3918 times)

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
making a custom ACCC?
« on: Jun 01, 12, 03:57:34 PM »

Hi!

I spent several past weeks looking into a HeroEngine_ACCCController client class, removing everything i didn't understand to the bare bones. I managed to get it from overwhelming 2641 lines of code to the 391 lines of code. Now the characters have basic movement up, down and forward and basic rotation.
Here is the result (sorry for the poor quality video):

http://www.youtube.com/watch?v=G6LFm6G11Ko&feature=youtu.be

Then i figured out that i don't have any movement interpolation, so i added movement interpolation using only my female intuition, and the result is not that impressive, but it works.
Here is the result (sorry for the poor quality video):

http://www.youtube.com/watch?v=3D7bWp_NehA&feature=youtu.be

The point is, if anyone is interested, i could make a raw tutorial on how to make this. With a couple of tweaks this could be used if anyone is making a game with non-organic characters, like spaceships for example.


I also want you to find and fix the bugs, since i will most likely be using something like this in my game.



Cheers!
Logged

Gothrek

  • General Accounts
  • *
  • Posts: 92
    • View Profile
Re: making a custom ACCC?
« Reply #1 on: Jun 06, 12, 12:55:28 AM »

great work man. Tks for share with us!!!

but u dont publish any code?
« Last Edit: Jun 06, 12, 12:57:18 AM by Gothrek »
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: making a custom ACCC?
« Reply #2 on: Jun 06, 12, 01:28:24 AM »

Nice :)

a tutorial would be helpful if you have time to do it ;)
Logged

Davidvanpelt

  • General Accounts
  • *
  • Posts: 1
    • View Profile
Re: making a custom ACCC?
« Reply #3 on: Jun 06, 12, 06:02:46 AM »

Very nice! A tut would be great :)
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: making a custom ACCC?
« Reply #4 on: Jun 09, 12, 07:34:37 AM »

These are the steps needed to implement the controller i was talking about.
I take full responsibility for any damage these steps do to you or your world.
I belive this is an advanced level tutorial, since there are lots of steps and tiny details that are easy to overlook.
If you run into any problems i might try to help, it all depends if i'll have time or not.

1. Start Heroblade but dont go past character selection screen.

2. SERVER: create Tutorial_ACCCClientControl server class
3. SERVER: create Tutorial_ACCController server class
4. CLIENT: create Tutorial_ACCCClientControl client class
5. CLIENT: create Tutorial_ACCController client class

6. SERVER: build Tutorial_ACCCClientControl server class to look like the one in the image:
https://dl.dropbox.com/u/79625595/Tutorial_ACCCClientControl_server.png

7. SERVER: build Tutorial_ACCController server class to look like the one in the image:
https://dl.dropbox.com/u/79625595/Tutorial_ACCController_server.png

8. CLIENT: build Tutorial_ACCCClientControl client class to look like the one in the image:
https://dl.dropbox.com/u/79625595/Tutorial_ACCCClientControl_client.png

9. CLIENT: build Tutorial_ACCController client class to look like the one in the image:
https://dl.dropbox.com/u/79625595/Tutorial_ACCController_client.png

This one is the most complex class, and you will need to create 19 new fields.
Here is the list of new fields you need to create and add to this class:

Tutorial_ACCCIsRotation boolean
Tutorial_ACCCIsTranslation boolean
Tutorial_ACCCMessageInterval timeinterval
Tutorial_ACCCMovementStepInterval timeinterval
Tutorial_ACCCMovementTotalInterval timeinterval

Tutorial_ACCCRotationFillLostSteps boolean
Tutorial_ACCCRotationSpeed float
Tutorial_ACCCRotationStepCountdown timeinterval
Tutorial_ACCCRotationStepCounter integer
Tutorial_ACCCRotationStepsTotal integer
Tutorial_ACCCRotationTotalCountdown timeinterval
Tutorial_ACCCRotationVector vector3

Tutorial_ACCCTranslationFillLostSteps boolean
Tutorial_ACCCTranslationSpeed float
Tutorial_ACCCTranslationStepCountdown timeinterval
Tutorial_ACCCTranslationStepCounter integer
Tutorial_ACCCTranslationStepsTotal integer
Tutorial_ACCCTranslationTotalCountdown timeinterval
Tutorial_ACCCTranslationVector vector3

Also note that this class is using 5 fields which are part of the clean engine just for the simplicity reasons. You need to add them to this class as well:

HeroEngineACCC_LastMessageSentTime
HeroEngineACCC_MoveDirection
HeroEngineACCC_NavMode
HeroEngineACCC_SideDirection
HeroEngineACCC_State

Together with the 6 fields inherited from _ACCController, the total number of fields on this class should be 30.


10. CLIENT: add two new enumeration values (UP and DOWN) to the HeroEngineACCC_MoveDirections enumeration, so that it looks like the one in the image:
https://dl.dropbox.com/u/79625595/HeroEngineACCC_MoveDirections.png


11. SERVER: create SCRIPT for the Tutorial_ACCCClientControl server class and COMPILE/SUBMIT:
https://dl.dropbox.com/u/79625595/Tutorial_ACCCClientControl_server.txt
12. SERVER: create SCRIPT for the Tutorial_ACCController server class and COMPILE/SUBMIT:
https://dl.dropbox.com/u/79625595/Tutorial_ACCController_server.txt
13. CLIENT: create SCRIPT for the Tutorial_ACCController client class and COMPILE/SUBMIT:
https://dl.dropbox.com/u/79625595/Tutorial_ACCController_client.txt
14. CLIENT: create SCRIPT for the Tutorial_ACCCClientControl client class and COMPILE/SUBMIT:
https://dl.dropbox.com/u/79625595/Tutorial_ACCCClientControl_client.txt


15. CLIENT: In Tutorial_ACCController client class uncomment line 276: me.Tutorial_UpdateACCCReplicatedFields(pos,rot) and COMPILE/SUBMIT


16. CLIENT: create 2 new fields and add them to the client class E_playerCharacter
Tutorial_InputLeftMostRecent boolean
Tutorial_InputUpMostRecent boolean


17. CLIENT: create new SCRIPT called Tutorial_Input_Movement and COMPILE/SUBMIT
https://dl.dropbox.com/u/79625595/Tutorial_Input_Movement.txt


18. CLIENT: create new SCRIPT called Tutorial_Input_Camera and COMPILE/SUBMIT
https://dl.dropbox.com/u/79625595/Tutorial_Input_Camera.txt


19. REPOSITORY BROWSER: open up repository browser and update [Movement] and [Camera] layers in GameKeyBindings.ini
line 69 [Movement] = Tutorial_Input_Movement
line 93 [Camera] = Tutorial_Input_Camera
Make sure to doublecheck that the file is really changed.


20. SERVER: in E_ACCC server class in method HE_getACCControllerClass add the new controller:
    ACCControllerClass = "tutorial_acccontroller"
Comment out the rest:
//    ACCControllerClass = "heroengine_acccontroller"
//    ACCControllerClass = "e_acccontroller"
COMPILE/SUBMIT


21. At this point i think it's a good idea to exit and restart HeroBlade.

Good luck!
« Last Edit: Jun 09, 12, 10:45:48 AM by AWW_boss »
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: making a custom ACCC?
« Reply #5 on: Jun 10, 12, 01:41:40 PM »

Things to do next.
Open up the script for Tutorial_ACCController client class and take a look at this code block:

Code: [Select]
#define smoothMovememnt

method _onConstructACCController()
  myChar as NodeRef = me._accControllerOwnerRef

  me.Tutorial_ACCCTranslationSpeed = 0.001
  me.Tutorial_ACCCRotationSpeed = 0.1
  me.Tutorial_ACCCMessageInterval = 00:00:01.000
  #if smoothMovememnt
  me.Tutorial_ACCCMovementTotalInterval = 00:00:01.000
  me.Tutorial_ACCCMovementStepInterval = 00:00:00.025
  #endif
 
  // Glommed on control classes may have a constructor which needs a chance to initialize values
  if HasMethod(me, "_onSpecializedConstructACCController")
    me._onSpecializedConstructACCController()
  .
 
.

1. Log two characters and place them in the same Clean Test Area.

2. Comment out the following line and COMPILE/SUBMIT:
// #define smoothMovememnt

3. Move first character to another Clean Test Area.
Second character should follow the first to the same Clean Test Area.
This is important as this will restart the controller and the new change in controller behaviour will be visible.

4. Check what happens with the translation and the rotation of the character which is not under your control, but under the control of the other client (aka remote character)
Hint: commenting out smoothMovememnt will turn off the movement interpolation and the remote character will teleport to a new position/rotation angle every time a new movement message arrives.
The time interval between two movement messages is defined here:
me.Tutorial_ACCCMessageInterval = 00:00:01.000.

Just want to say again that the movement interpolation which i implemented here most likely is not the best available. Since i only joined the game dev world couple a months ago i didn't have too much time to explore the subject. I belive there have to be better algorithms out there and would appreciate your help on how to improve this.

5. Revert all changes and COMPILE/SUBMIT.
« Last Edit: Jun 11, 12, 04:12:09 AM by AWW_boss »
Logged

Niimus

  • World Owners
  • ****
  • Posts: 13
    • View Profile
Re: making a custom ACCC?
« Reply #6 on: Jun 20, 12, 02:40:00 AM »

Thanks very much for this !!!!!

Ran through it last night and all worked fine.
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: making a custom ACCC?
« Reply #7 on: Jun 20, 12, 04:11:25 AM »

Great. I will updated it soon, since it doesn't work with NPCs
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: making a custom ACCC?
« Reply #8 on: Nov 28, 12, 03:13:13 AM »

This tutorial is old, poorly done and not a very popular one. Removing it would probably be the best idea.
Logged

TheRabid

  • General Accounts
  • *
  • Posts: 41
    • View Profile
Re: making a custom ACCC?
« Reply #9 on: Nov 30, 12, 09:31:17 AM »

NOoooooooOOOoo please don't remove this tutorial. It's very valuable information, any information is useful. Please do not delete.
Logged