1. Do you need support for Assetto Corsa Competizione? Please use the proper forum below and ALWAYS zip and attach the WHOLE "Logs" folder in your c:\users\*youruser*\AppData\Local\AC2\Saved. The "AppData" folder is hidden by default, check "Hidden items" in your Windows view properties. If you report a crash, ALWAYS zip and attach the WHOLE "Crashes" folder in the same directory.
  2. FOR ASSETTO CORSA COMPETIZIONE: If you report issues with saved games, please always zip and attach your entire User/Documents/Assetto Corsa Competizione/Savegame folder!
  3. If your game executable is missing, please add your entire Steam directory to the exceptions in your antivirus software, then run a Steam integrity check or reinstall the game altogether.

Let's talk about broadcasting (programmer's thread)

Discussion in 'ACC General Discussions' started by Minolin, Dec 12, 2018.

  1. Brado23

    Brado23 Racer

    So I assume you saying to replace this....

    Code:
            internal void Disconnect()
            {
                using (var ms = new MemoryStream())
                using (var br = new BinaryWriter(ms))
                {
                    br.Write((byte)OutboundMessageTypes.UNREGISTER_COMMAND_APPLICATION); // First byte is always the command type
                    Send(ms.ToArray());
                }
            }
    
    with this:

    Code:
            internal void Disconnect()
            {
                using (var ms = new MemoryStream())
                using (var br = new BinaryWriter(ms))
                {
                    br.Write((byte)OutboundMessageTypes.UNREGISTER_COMMAND_APPLICATION); // First byte is always the command type
                    br.Write((int)ConnectionId);
                    Send(ms.ToArray());
                }
            }
    
    ??
     
    Doug Duthie likes this.
  2. expor

    expor Rookie

    Correct, that will fix the sdk example application. Can easily be checked by doing multiple connect and disconnect when using a low interval like 100ms. Before the fix it will become terribly slow to connect after a few attempts, with the fix it should be instant every single time.

    Sorry I'm writing a node js application so my snippet was from my own code.
     
    Toon Knapen, Doug Duthie and Brado23 like this.
  3. jackOO7

    jackOO7 Rookie


    Yea for this is best way have disconnect event from the game (kunos please), or u can set position at the end of grid for inactive cars, but soon i will have better solution for it...
     
  4. Brado23

    Brado23 Racer

    Hey jack007. Thanks for the reply. I found a solution for this yesterday which seems to work quite well. Don't know if it is the most elegant way but definitely works and have done a fair amount of testing yesterday with public servers that have their entry list changing regularly. To fix I added these lines to BroadcastingViewModel.cs :

    Code:
            private void MessageHandler_OnEntrylistUpdate(string sender, CarInfo carUpdate)
            {
                CarViewModel vm = Cars.SingleOrDefault(x => x.CarIndex == carUpdate.CarIndex);
    
                if (vm == null)
                {
                    vm = new CarViewModel(carUpdate.CarIndex);
                    Cars.Add(vm);
                }
    
                vm.Update(carUpdate);
    
                var currentEntryList = _clients[0]._entryListCars; //Need to change this to pickup the correct client automatically rather than hardcoding
                var existingCars = Cars.Where(c => currentEntryList.Any(uc => uc.CarIndex == c.CarIndex)).ToList();
                var removedCars = Cars.Except(existingCars).ToList();
    
                foreach (var car in removedCars)
                    Cars.Remove(car);
            }
    
    This code executes after each Entry List Update. To make sure this happens at least once every 30 seconds I changed this in BroadcastingNetworkProtocol.cs:

    Under case InboundMessageTypes.REALTIME_CAR_UPDATE:

    Code:
    if(carEntry == null || carEntry.Drivers.Count != carUpdate.DriverCount || (DateTime.Now - lastEntrylistRequest).TotalSeconds > 30)
    
    Hope that helps some else. Had me stuck for ages when I was trying to work out how the flow of everything occurs.
     
    Toon Knapen likes this.
  5. Doug Duthie

    Doug Duthie Racer

    @Minolin,
    I understand that no tyre state information is available on Broadcast API- someone mentioned that this is to keep ACC in line with the realism that if a driver can't see tyre state IRL, then nor can we in ACC. What would be nice though (especially as post session garage is no longer available to view tyre condition) would be to have a broadcast message after pit stop and end of session to report on the tyre wear and state. I'd like to be able to review if my driving style is gentle to tyres, or I'm murdering them
    Cheers
     
  6. bartouze

    bartouze Gamer

    Code:
     case InboundMessageTypes.BROADCASTING_EVENT:
                        {
                            BroadcastingEvent evt = new BroadcastingEvent()
                            {
                                Type = (BroadcastingCarEventType)br.ReadByte(),
                                Msg = ReadString(br),
                                TimeMs = br.ReadInt32(),
                                CarId = br.ReadInt32(),
                            };
                          
                                evt.CarData = _entryListCars.FirstOrDefault(x => x.CarIndex == evt.CarId);
                            OnBroadcastingEvent?.Invoke(ConnectionIdentifier, evt);
                        }
    i want to put a condition there so it only invoke if the type byte is = to 4 ( accident ) .

    any ideas ?
     
  7. Doug Duthie

    Doug Duthie Racer

    How about

    Code:
                        case InboundMessageTypes.BROADCASTING_EVENT:
                            {
                                BroadcastingEvent evt = new BroadcastingEvent()
                                {
                                    Type = (BroadcastingCarEventType)br.ReadByte(),
                                    Msg = ReadString(br),
                                    TimeMs = br.ReadInt32(),
                                    CarId = br.ReadInt32(),
                                };
    
                                evt.CarData = _entryListCars.FirstOrDefault(x => x.CarIndex == evt.CarId);
    
                                if (evt.Type == BroadcastingCarEventType.Accident)
                                {
                                    OnBroadcastingEvent?.Invoke(ConnectionIdentifier, evt);
                                }
                            }
     
    bartouze likes this.
  8. bartouze

    bartouze Gamer

    oh thanks a lot dude, that is exactly what i was looking for but my syntax was bad !
     
  9. bartouze

    bartouze Gamer

    in the BroadcastingEventView.xaml

    when i replace
    Code:
        <TextBlock Grid.Column="1" Text="{Binding Evt.TimeMs}" />
    wich work

    by

    Code:
        <TextBlock Grid.Column="1" Text="{Binding SessionTime}" />
    it send me accident but the "SessionTime" column is empty , any idea where i am geting it wrong ? :)
     
  10. Brado23

    Brado23 Racer

    SessionTime is a part of the SessionInfoViewModel. You need to make this variable accessible from the ViewModel you are working in.
     
  11. Brado23

    Brado23 Racer

    @Minolin

    Now that the console release is coming to a close, is there any chance we can pretty please get some of your time when you have a chance to have a look into the following things which aren't working in the broadcast API....

    TeamName - Doesn't display in multiplayer. Does display when running a single player session.
    TimeOfDay - Always displays as 0:00
    WorldPosX - Always 0
    WorldPosY - Always 0
    Yaw - ?
    TrackPosition - Always 0

    Accidents come up like #vs. #-1271002704 which you mentioned in the past may be datatype conversion failures.

    Also, did RainLevel and Wetness values change with the recent weather updates in the game in 1.4.3 (I think?). We had a high Rain and Flooded race last night and the RainLevel and Wetness values were reporting 60% and 60%. I thought they should have been higher than that?

    If you could spare some time to look at these we would appreciate it very much. I have a Live Timing app and updated Broadcasting client waiting to use these once they are working properly.

    Thanks,
    Brad
     
    Toon Knapen likes this.
  12. Zeraxx

    Zeraxx Racer

    ^^ I second this, would be nice to get a rough ETA of when this will be fixed.
     
  13. Toon Knapen

    Toon Knapen Gamer

    Hello @Brado23 , what live-timing app are you building? Just curious because we are also building one, you can see it at https://pitwall.live (and follow the SRO e-sports race of the AM's, Silver's and Pro's this weekend on it with the live video-feed integrated)
     
  14. Brado23

    Brado23 Racer

    Hi mate. I made it for the league I race in (Octane Online Racing (https://www.twitch.tv/octaneonlineracing)). The live timing app can be seen in action at... https://www.twitch.tv/livetiming during races.

    Your app looks great. I'll have to try it out.
     
    Last edited: Jun 20, 2020
  15. Toon Knapen

    Toon Knapen Gamer

    If you want to try it out for your league, just get to our discord and we can set it up. We just add your league in the championship overview and give you an exe that you run when in ACC and that exe will capture all timing data and send it in real-time to our platform for visualisation.
     
  16. bartouze

    bartouze Gamer

    i tried but i had to make it wrong , i will try again .

    i c/p the variable from the sessioninfoviewmodel to the other but not working =)
     
  17. It's not so simple for now. But I'm planning to make a simple installation guide.
     
  18. LiveRacers

    LiveRacers Gamer

    Hi,

    I would like to add ACC to LiveRacers for live timing.

    Is there going to be a similar server UDP interface that we can connect for real time data?

    Regards,
    Stefan
     
  19. RadstaR

    RadstaR Rookie

    Any bug fixes in near future ? Or this is final version forever because nobody answer questions and do not repairing many months old bugs :(
     
    Zeraxx likes this.
  20. bartouze

    bartouze Gamer

    they work on GT4 dlc , and the was intended to be an exemple of what you can do as stated in first post , so it's definitly not the priority i guess :)
     
Similar Threads
Forum Title Date
ACC PS4 - XB1 General Discussions Let's talk multiplayer/online servers Jul 11, 2020
Chit Chat Room Let's talk about Sim Dream modding Jun 20, 2020
ACC General Discussions Let's talk about broadcasting (user's thread) Dec 12, 2018
Console Lounge Let's talk vote to kick Mar 18, 2017
Console Lounge Quick race weekend (let's talk abou it Vol.1) Feb 24, 2017
Chit Chat Room Let's talk Lotus 98T Feb 17, 2017
Console Lounge Porsche Cayman GT4 - Let's talk gearing Jan 16, 2017
Console Lounge Let's talk about rage quitters... Dec 9, 2016
Chit Chat Room 935/78 - Let's talk setup and driving Oct 30, 2016
Console Lounge Let's talk about braking Oct 6, 2016
Suggestions Let's talk weather (I am not asking for rain). Aug 15, 2016
Chit Chat Room Let's talk wheels...again. why not? Aug 27, 2014
ACC PS4 - XB1 General Discussions Let's do something, this is going to get ugly...(Servers) Aug 3, 2020
ACC General Discussions Let's get acquainted? Nov 28, 2019
ACC General Discussions POLL! Let's buy this game again every year to support Assetto Corsa guys! Jul 20, 2019

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice