Comments (3)
Hey,
you seem to have seen why we can't really just give back the player-objects. The thing is, in Valves internal code there is a new object created when a player connects, so I don't feel like it makes sense if I try to let it survive.
This, coupled with the fact that there's no event raised when a player connects
There is event the possibility that a player leaves the PVS an re-enters it that could lead to a new object - without any game-event.
But this is actually a bug - I currently really don't have the time, but if anyone opens a pull-request to add these events I'd be very willing to accept those. See 44413d8 on how to implement it.
What's the recommended way of dealing with player reconnects?
Aggregate everything by the SteamID. You got, for example, a Dictionary<Player, List<Kill>>
? Make it a Dictionary<long, List<Kill>>
, and let the key be the SteamID.
You want to check if two Players are equal? Check for their SteamID. If you really want you can override GetHashCode
and Equals
(and maybe the ==
operator) to only check if the SteamID equals, then you can check for Player-Equality the way you do now.
from demoinfo.
There is event the possibility that a player leaves the PVS an re-enters it that could lead to a new object - without any game-event.
Are you saying that the connect/disconnect events sometimes aren't raised in the demo or that the parser sometimes doesn't catch them? Also, what does PVS stand for?
I just assumed that it was a conscious decision not to include player connects/disconnects, but it sounds like that's not the case so I'll add them in and make a pull request later tonight.
Aggregate everything by the SteamID. You got, for example, a Dictionary<Player, List>? Make it a Dictionary<long, List>, and let the key be the SteamID.
This was my initial thought, but there would still be a problem in my program of tying to SteamIDs to their Player objects. That's where the connect/disconnect events come in -- I can just modify the dictionary whenever a player connects. An alternative I suppose would be to make a PlayerDict class that wraps the dictionary accessor with a KeyNotFoundException exception handler.
from demoinfo.
PVS
The potentially visibile set. It's the players you can possibly see. If they leave and rejoin, it might give a new reference without the player having actually reconnected.
I just assumed that it was a conscious decision not to include player connects/disconnects
Yes, it was. But I see that it was the wrong one.
tying to SteamIDs to their Player objects
Simply try not to do that, even if it's the harder way. If you want to find the player just do a Parser.Players.FirstOrDefault(a => a.SteamID == needle)
- at least that's how I handle things.
Sure it's a bit slower, but actually not that slow.
from demoinfo.
Related Issues (20)
- Fix or Walkaround on parser for third party platforms HOT 5
- Include MP5-SD HOT 1
- Crash on parser.ParseToEnd(); HOT 1
- Does not parsing all players properly HOT 4
- Calculating a player's bone positions HOT 5
- How to get voice chat?
- PacketEntitesHandler.cs string 132 HOT 4
- Exception thrown for game event "inferno_expire" HOT 1
- Player position reported switches to different player after death HOT 1
- Parser NotImplemented exception after exactly 15 ticks HOT 2
- FaceIt Demos HOT 4
- bullet_impact event HOT 2
- Various bug fixes for demoinfo
- m_Collision.m_vecMins gets incorrect values for func_hostage_rescue entities HOT 2
- Almost all datas are wrong in Player.Weapons
- parser.ParseToEnd() -> System.NotImplementedException HOT 12
- I cant use the libray HOT 1
- System.Exception: 'Roy said I should throw this.' HOT 9
- Player hurt event health damage exceeding players previous health HOT 1
- Invalid File-Type - expecting HL2DEMO HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from demoinfo.