Rio will be ready: Despite all the setbacks and ridicule being thrown at these Games they won't be a write-off. Credit:Renata Brito "Do you want to come to a party?" one of my new friends – who was a DJ – asked via his girlfriend, who spoke some English. "You bet," I said via the international language of two thumbs up. One or two (dozen) Caipirinhas later and I was on the back of a moped, weaving through the cobbled streets, through the blur of multi-coloured shacks and labyrinthine alleyways, going higher and higher before I found myself in the middle of a heaving dance floor of sweaty, smiling Brazilians. Even though I was the only foreigner there, I felt safe because I had been invited into the favela by people who no longer lived there but once did.

Then I heard the gunshots. Bang! Bang! Bang! They weren't coming from the dance floor but they weren't far away, somewhere in the distance. I panicked and started to run. Everybody else just kept dancing, like nothing had happened. So, yes, going to the favela party with complete strangers with gunshots fired nearby was one of the dumbest things I've ever done – but also the funnest​.

It's the story I tell most people when talking about the chaos, danger and hedonistic beauty of Rio de Janeiro, one of the most mysterious, fascinating, frustrating, lethal and visually spectacular cities in the world. It's also the host city for the Games of the XXXI Olympiad – the first Games to be held in South America. Given the Rio-bashing of late, though, why should the world bother to turn up? The Zica virus. Incomplete venues. (The velodrome, where Australia hopes to grab fistful of medals, isn't yet done). Unfinished railways. Drug-resistant super-bugs in polluted waters. Rio's anti-doping lab has been shut down. President Dilma Rousseff is being impeached for corruption. Last week, acting president Michel Temer agreed to the transfer of 2.9 billion real ($1.16 billion) from the federal government's coffers to Rio de Janeiro state to help pay the Olympic bills. The scandal engulfing Petrobas – the country's giant oil company – continues to suck up and spit out politicians and public figures.

In 2009, when Rio de Janeiro won the right to host these Olympics – beating Madrid, Tokyo and Chicago – Brazil's economy was soaring. The Economist predicted it would soon go past Britain and France as the world's fifth-largest economy. Icon: Brazilian football great Pele attends a ceremony to award him with the Olympic Order at the Pele Museum in Santos, Brazil. Credit:AP The manifest difference between rich and poor has rarely been so clear, according to those who live there. When I covered the FIFA World Cup in Brazil two years ago, there was palpable rage about the federal government spending US$15 billion ($20.2 billion) on shiny new venues despite the poverty in many parts of the country. I visited the Vasco da Gama favela during the tournament and one of the prominent locals, Carlao, told me: "There shouldn't be a World Cup, for many reasons. The stadiums have cost too much. The health system is bad. The education system is bad. Transport is bad. Security is terrible. Why have we spent so many dollars on this, when it could've been spent on that?"

This anger often bubbles and overflows into street crime, with lilywhite gringos with Gucci sunglasses on their head and loosely holding onto handbags an easy target. Don't blame it on Rio. Crime has always been an issue in Brazil, and Rio in particular. Cariocas report crime has skyrocketed since the World Cup. Australian Olympic officials consider security to be their main concern at these Olympics, not least after Australian Paralympian Liesl Tesch and a team official were held at gunpoint last week. Earlier this year, an AOC official was sitting in a cafe in iconic – and relatively safe – Ipanema when a man walked in and repeatedly shot a waiter.

Australia's chef de mission Kitty Chiller has called for an increase in security and banned Australian athletes from going anywhere near the favelas. Fairfax Media has also banned its staff from going near them. No favela parties? Boo. So are these Olympics going to be a write-off? A farce? An international embarrassment? Absolutely not. Sprint king Usain Bolt. Credit:AP Apart from the obvious storylines around Usain Bolt and Michael Phelps and if Tinder will crash the Wi-Fi in the athletes' village, there's the once-in-a-lifetime Instagram pics of the Maracana during the opening and closing ceremonies, beach volleyball at midnight on the sand at Copacabana and archery at Sambodromo, the home of Rio's Carnival festival.

For all the dismissive ridicule being thrown at these Rio Olympics before they even begin, what will save them are those the outside world seems to fear the most. It's people. For all the criticism levelled at Brazilians, they definitely have their priorities in order. Football is first, having a good time is second and the rest, well, that's a distant third whenever they get around to attending to it. It might mean you're sitting in traffic that doesn't move for hours, or take half a day to check in for a flight, or wonder if the bill will ever come at a restaurant. But when you're sitting at a kiosk at Ipanema, sipping coconut water and eating a Misto Quente​ while looking out over the Atlantic Ocean and trying to piece together the night before and all the people you just met, none of that matters.

Loading These Olympics will be fine ... But just in case it all goes sour, you'll find me at the nearest favela party. Just don't tell my bosses where I am.