Results 1 to 17 of 17

Thread: Struct per pawn

  1. #1
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default Struct per pawn

    I'm currently trying to find a way to record each player position into a struct... I need to record the player position every X seconds and store those up to an Y number of time.

    This is for an unlagged script.

    I'm not sure if I could do it without messing with the xPawn. Personnaly, I don't want to go play in there.

    I can probably record the location of any xPawn at anytime, but I dunno how to have a struct for each xPawn in the game. Kind of variable variable?

    Meh... No idea how to do that.

  2. #2

    Default

    From what unspecific information you give it would seem you need a variable length array. You can check the actors and fill the array in the mutator object itself. Try its Tick event.

  3. #3
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    Quote Originally Posted by Xyx View Post
    From what unspecific information you give it would seem you need a variable length array. You can check the actors and fill the array in the mutator object itself. Try its Tick event.
    I need 1 array per player.
    The length of the array would be constant and doesn't really need to change.

    Ok... Let me explain.

    Each player (pawn) would need an array that would store the location of said player every 0.02 seconds for 0.2 seconds (Ping of 200ms) ( so, 10 variables in the array ) Once the codes reach the last variable of the array, it start back at the start, overwritting value entered 220 ms ago.
    When someone shot, the server check the instigator ping, round up the value to get a 20ms value (20-40-60-etc...) and check where was all the player back at the time the instigator shooted using said array of variable.
    So, every player need an array that is updated all the time so the server can do a rollback on their location.

    All that should be server side only, since only the server need to check to hit/kill.

    Of course, the filling of the variable would be done with a Tick(). That's not the problem.
    The problem I see, is how to have an array for each player without messing with xPawn and such. How do I tell it to create an array per player?
    Last edited by Lightstriker; 10-16-2006 at 11:37 AM.

  4. #4
    Banned
    Join Date
    Aug 2006
    Posts
    42

    Default

    Why don't you just make many arrays? You don't have to use all.

  5. #5
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    Quote Originally Posted by ION3 View Post
    Why don't you just make many arrays? You don't have to use all.
    What is the max number of player you can have in UT? 32? 64? That's a lot of array called!
    Also, assigning every player to a specific arraw may be a bit hard.

    Of course, the easiest would be to have those variable in the xPawn, and like that each player would have his own.

    Maybe should I make a class that is child to xPawn?

    Then how to tell the game to use my CustomPawn has player insteed of xPawn?
    Last edited by Lightstriker; 10-16-2006 at 12:06 PM.

  6. #6
    MSgt. Shooter Person
    Join Date
    Jul 2006
    Posts
    59

    Default

    You can either make a LinkedReplicationInfo for the pawn and record this stuff there.

    Or, you can make a different child class, manage its creation/deletion yourself, and record it there.

    Or, you can make an array of pawns/locations and manage that yourself, and record into that.

    The first option is probably the best.
    Last edited by Lotus; 10-16-2006 at 01:00 PM.

  7. #7
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    Quote Originally Posted by Lotus View Post
    You can either make a LinkedReplicationInfo for the pawn and record this stuff there.

    Or, you can make a different child class, manage its creation/deletion yourself, and record it there.

    Or, you can make an array of pawns/locations and manage that yourself, and record into that.

    The first option is probably the best.
    I don't need replication for that stuff... Everything should be handle by the server.

    I'm thinking of maybe using a CustomPawn with the array I need to replace the xPawn and make the replacement in the CheckReplacement(). I know it works for other actors... but dunno how Player would react.

  8. #8
    MSgt. Shooter Person
    Join Date
    Jul 2006
    Posts
    59

    Default

    Don't replace the pawn, check out SpawnCollisionCopy in MutUTComp and the PawnCollisionCopy class in the utcomp source for an example of the second way i mentioned of doing it.

    You could also (maybe?) give the pawn an Inventory item and record it there.
    Last edited by Lotus; 10-16-2006 at 01:05 PM.

  9. #9
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    Quote Originally Posted by Lotus View Post
    Don't replace the pawn, check out SpawnCollisionCopy in MutUTComp and the PawnCollisionCopy class in the utcomp source for an example of the second way i mentioned of doing it.

    You could also (maybe?) give the pawn an Inventory item and record it there.
    Hmmm.... UTComp seam to do what I want... It's a bit more complexe then I first tought.

    //Edit : Just noticed... UTComp do replace xPawn... :/
    Damn the thing is complexe...
    Last edited by Lightstriker; 10-16-2006 at 01:37 PM.

  10. #10
    MSgt. Shooter Person
    Join Date
    Jul 2006
    Posts
    59

    Default

    It replaces xpawn, but for unrelated reasons to recording the stuff for netcode.. none of the netcode stuff is in pawn... only brightskins and forcemodel are tied to the pawn replacement.
    Last edited by Lotus; 10-16-2006 at 01:36 PM.

  11. #11
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    Quote Originally Posted by Lotus View Post
    It replaces xpawn, but for unrelated reasons to recording the stuff for netcode.. none of the netcode stuff is in pawn... only brightskins and forcemodel are tied to the pawn replacement.
    Noticed...

    Think my skill are no way near what is needed to integrate their timetravel system into my mod.
    I will continue to read it. But it's complexe stuff.

  12. #12

    Default

    This is for a mutator (or gametype/something similar) right? Simply stick a 32-length or variable-length struct array into the mutator or gametype object. 32 location/time structs is peanuts.

  13. #13
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    Quote Originally Posted by Xyx View Post
    This is for a mutator (or gametype/something similar) right? Simply stick a 32-length or variable-length struct array into the mutator or gametype object. 32 location/time structs is peanuts.
    Creation of an array isn't really problematic... Creation on the fly of the array + constant assignation/creation/destruction of player/array/data as player join/leave is a bit more problematic.

    (Remember... I'm a noob)

    After readying UTComp scripts a lot... I may be able to transplant only the timetravel part.

    The weapon part will be harder... Since my current Fire class isn't looking like a the normal one.

    Meh... Sure those who did UTComp network part are bright.

  14. #14

    Default

    Why would you need to create an array on the fly? Are you still thinking about creating the array on the pawn? That would require the LinkedReplication approach, which is unnecessarily complex for what you are trying to do.

    Simply code an array of struct arrays in your mutator. How many location/timestamps do you need? You can hardcode that no problem if you're not going for the hundreds.

  15. #15
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    Quote Originally Posted by Xyx View Post
    Why would you need to create an array on the fly? Are you still thinking about creating the array on the pawn? That would require the LinkedReplication approach, which is unnecessarily complex for what you are trying to do.

    Simply code an array of struct arrays in your mutator. How many location/timestamps do you need? You can hardcode that no problem if you're not going for the hundreds.
    Hmm... I maybe don't understand how array are made/assigned and filled...

  16. #16

    Default

    You declare the array in your mutator. Like so (more or less):

    Code:
    struct TimePos
    {
        var Location;
        var TimeSeconds;
    }
    
    var array <array<TimePos> > PlayerInfo[32];

  17. #17
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    49

    Default

    I understand the struct part...

    But what does the
    Code:
    var array <array<>> PlayerInfo[32]
    do?


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.