Sunday, March 14, 2010

I'll write more about the implementation details tomorrow, but for now, heres a video showing the new opponents system!
(edit: painful level of detail below)




The opponent data baked into each track is made up of nodes (points) and paths between nodes.  After parsing that data, I end up with a list of nodes, and for each node, several possible paths.

When the race starts, each opponent finds the node closest to themselves.  They then work out which path to take from that node, and also what they will do at the end of that next path. (So the opponents are looking 2 steps ahead).  This means they know how tight the next corner is going to be.  As they accelerate along the path, they constantly work out how long it will take to brake to get around the corner.  This means they can keep their speed up, but slow down enough to get around tight corners (usually!).  The opponent data also has a max speed setting per path, like if the path ends  at the edge of a cliff, but its not used consistently.  I'm not even sure if the original game uses that data.

I've made each node quite big, so opponents don't need to drive exactly over it - this means they will start turning before reaching the middle of the corner, and can get around it a bit faster.

Theres 3 different types of paths - Race, General and Cheat.  Race paths direct the AI around the race track, general paths let them drive around random streets, and cheat, as far as I can see, lets them get to places that normally they wouldnt normally be able to get to. (like hard to reach rooftops etc).  A good implementation will be to choose a mix of race and general paths, generally biasing towards race paths, and use cheat paths occasionally when the player isn't looking!  Currently, the opponents always choose the race path.

Also, when the player gets far away from an opponent, the original game teleports the opponent near the player.  I still have to implement that and also opponents attacking the player.  Fun stuff :)

18 comments :

  1. :o this is looking real promising. The opponents seem to have a nice racing speed. They follow the paths only now right? I like how the smoke and skid marks appear on them. :) Their behavior seems somehow nice and aggressive, like that.

    ReplyDelete
  2. Thanks :) Yep, they only follow the paths in this version, but to attack the player will use most of the same code. The skidmarks arent working properly (they are in bits, rather than joined up lines). When I made the skid system I had no opponents, so it only handles 1 car properly

    ReplyDelete
  3. Looking forward to this release! Carmaggedon is one of my all time favorite!

    ReplyDelete
  4. awesome maan!! i love the original carma 1 physics but this - this blows my head! => http://img15.imageshack.us/img15/9828/103355.png

    ReplyDelete
  5. can you publish carmageddon file spec.

    ReplyDelete
  6. Please people, or at least robots

    ReplyDelete
  7. http://www.youtube.com/watch?v=hoWxwAjjDeE&fmt=22

    ReplyDelete
  8. http://www.youtube.com/watch?v=duHuyHqzr6I&fmt=18

    ReplyDelete
  9. Oh, one more request! Is there any way you could enable a widescreen mode? 1080p Carmageddon would be great! :-)

    ReplyDelete
  10. I've been trying to implement car damage (deformation) through PhysX in a way that means all the custom C1 cars which have no damage data will be able to be damaged :) I am so close, but currently there appears to be a bug in PhysX that may mean I have to scrap the idea. Im waiting for help on the physx forums at the moment. :(

    Widescreen is already working :)

    ReplyDelete
  11. Do you fully understand now how the deformation system works? Any chance you'd share your knowledge? Econobrick and me would like to add correct crush data chunks to our C1 cars.

    Only noticed now that you bought opencarmageddon.com; I hope you won't have any problem with that, I guess it won't but IMO names such as OpenC1 or OpenCarma would have been even safer. I wonder if the actual license owners would really protect the name/game as much as they did ~5 years ago.

    Eager to see the progress on the deformation part.

    ReplyDelete
  12. I posted what I've found about the crush data here: http://blog.1amstudios.com/2009/08/i-havent-had-much-time-to-work-on-this.html

    Its not complete, but a start. The deformation part I was hoping to leave to PhysX - which would mean that we don't need to generate all the crush data for addon cars. Ive been blocked waiting for support from PhysX but not getting anywhere (and it looks like a bug in PhysX) so have decided to shelve it for now and get on with sorting out the audio, and maybe take a few days off work next week and start working on pedestrians, basic menu. Enough to get a demo out hopefully :)

    ReplyDelete
  13. Yeah I figured I'd just go ahead and grab the domain, if SCi really get annoyed I'll just call it something different :)

    ReplyDelete
  14. Omg just found this project, this is awesome.

    ReplyDelete