Labels

July 11, 2012

day5 - race track coordinate concept

Yesterday I had some thoughts on the toughest challenges I will have to overcome during the development.  I think it is wise to reckon them before I start the work on technical aspects of the game.
Here is the first task that got me a little worried.

getting precise player positions in the race track space
This includes for AI and player to know its exact distance from start and finish and distance from both track sides. I want to avoid any ray-checks from car to do that. It is too expensive and not very accurate. One solution is to have loads of colliders (sensors) covering the track, so whenever car touches one of the sensors we know how far the car is from sides and finish then it is possible to compare it with other cars and we know which car is leader and so on. But it is just not very efficient to manually add them for a hundred kilometers long track. 
What I have in mind is to convert world space position to track-relative position. So it would switch from world xyz coordinates to track uv coords. U would correspond to travelled distance and range from 0.0 to 1.0 where 0.0 is start line and 1.0 is finish line (not sure about floating point precision here) and V would be track width ranging from -1.0 to 1.0 where 0.0 is middle of the track. This idea comes from THIS blog post about AI coordinate system used for MotoGP. I think it is very elegant and simplifies a lot of tasks especially AI behavior and keeping them on track without using bunch of waypoints and ray-check system.


How would that work?

Vector power!
Race tracks will be made of segments which I will deform by curve and multiply with array till the end of the length of curve. Lets assume that 1 track segment is a quadrilateral (tetragon) made of 4 points. To switch to track-realtive coordinates we need to know world position for each track segment. This means getting each point of track into an array and sort them to form lines, so each segments start & end line act as sort of check point. Then for each car we can get on which segment the car is on and calculate the fraction of the segment covered with point-quad or point-triangle intersection function.

I already got a chance to implement an efficient ray-quadrilateral intersection test in BGE and it works really nicely, though I have to check performance compared to point-triangle intersection functions.

Here is a simple illustration:




The tracks will have sharp turns, loops, banks, tilts and variety of configurations which makes the work on AI really hard, but converting all to track-relative coordinates "flattens" and "straightens" the track which makes work with AI ridiculously simple.
some examples:

if (player.distance > otherplayer.distance):
    #you are ahead of other player

difference = player.distance - otherplayer.distance
if (difference < treshold):
    #start collision avoidance
    #start the overtake process?

how to check on which side to overtake an opponent:

if(overtake = 1):
    #overtake in progress
    player_ahead.width > 0.0 ? go_left : go_right
    #see on which side is more space and go
    #here we can also override previous statement to check if car width is wide enough to fit in the narrowest side and so on..

this all is just a theory now how I imagine it to work in my game. I think many commercial racing games use similar approach and it works, but they have dedicated professional programmers up to the task. will see how I can handle this when I start the work. I am open for suggestions and perhaps there is even a better solution for this.

Now I take a few day rest from the project as I am moving from France to Belgium and then back to Latvia.

Edit:
I got working the basic concept of coordinate system:
https://dl.dropbox.com/u/11542084/get_track_position.blend
If this proves to be efficient enough for big tracks then I will use it in the game.

References:
1 - http://blogs.msdn.com/b/shawnhar/archive/2009/12/30/motogp-ai-coordinate-systems.aspx

2 - http://answers.unity3d.com/questions/25189/race-position-help.html
3 - http://gamedev.stackexchange.com/questions/2382/how-would-one-determine-the-position-of-a-participant-in-a-racing-game
4 - http://graphics.cs.kuleuven.be/publications/LD04ERQIT/

55 comments:

  1. Create point a for frame n point b for frame n-1 get length of vector (a - b) increment distance traveled every frame, hard to explain i will just post a blend file later

    ReplyDelete
    Replies
    1. Thank you so much, I will look into the blend as soon as I get back to home.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. http://dl.dropbox.com/u/27147863/distance_from_start.blend

    ReplyDelete
  4. http://dl.dropbox.com/u/27147863/distance_from_start.blend

    ReplyDelete
    Replies
    1. Thanks, it is a nice way to get total distance traveled, but not quite what I am looking for. Here is a proof of concept of stuff mentioned in my post: https://dl.dropbox.com/u/11542084/get_track_position.blend

      Delete
  5. what happened to that game. Did you stop working on it. I was looking forward to see your progress

    ReplyDelete
    Replies
    1. I had to take a break during the summer due work and time restrictions. I will write a post it in here. But I am not gonna stop working on the game just yet - have to finish it first :)

      Delete
  6. great article to write, which is quite a good post.
    Prom Dresses 2016

    ReplyDelete
  7. Hey - just wanted to let you know upbge has render attachments now for super fast render.

    ReplyDelete
  8. I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Tommy Jarvis Jacket

    ReplyDelete
  9. This was an extremely wonderful post. Thanks for providing this info.
    tony soprano leather jacket

    ReplyDelete
  10. thanks for sharing informative, I really feel your blog content quite different from others bloggers.

    Dataguru supplies transparency, dedication, reliability, and credibility in its work procedure. The B2B information is thoroughly researched and robust. It guarantees maximum precision in its marketing head database.

    ReplyDelete
  11. Amazing website, Love it. Great work done. Nice website. Love it. This is really nice. office.com/setup
    ij.start.cannon
    www.amazon.com/mytv
    Microsoft365.com/setup

    ReplyDelete
  12. Superior infrastructure is the first reason for the large number of companies located in List of companies in Noida Sector 63. It is one of India's most planned cities, with wide roads, clean subways and underpasses.

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. http://123hpcomsetup70136.ampblogs.com/123-hp-com-setup-37631104
    http://123hpcomsetup35221.blogocial.com/123-hp-com-setup-35653629
    http://martinfragn.onesmablog.com/123-hp-com-setup-39740516
    http://dallasapcln.pages10.com/123-hp-com-setup-37980736
    http://griffinpoctd.blogolize.com/123-hp-com-setup-40504267
    http://123-hp-com-setup18135.bloguetechno.com/123-hp-com-setup-36305813
    http://123hpcomsetup01737.shotblogs.com/123-hp-com-setup-16122651
    http://zandercaocp.tribunablog.com/123-hp-com-setup-16325097
    http://collinmxfms.blogzet.com/123-hp-com-setup-16907254
    http://123-hp-com-setup75939.blogminds.com/123-hp-com-setup-483042
    http://andyirlek.suomiblog.com/123-hp-com-setup-17457725
    http://123-hp-com-setup14713.pointblog.net/123-hp-com-setup-40160751
    http://123-hp-com-setup72580.full-design.com/123-hp-com-setup-43893441
    http://123hpcomsetup93925.thezenweb.com/123-hp-com-setup-38226536
    http://edgarieqbm.tinyblogging.com/123-hp-com-setup-42759017
    http://123hpcomsetup27775.ampedpages.com/123-hp-com-setup-30096666
    https://zaneozjpw.blog5.net/43362167/123-hp-com-setup
    https://juliuspiwju.affiliatblogger.com/53087827/123-hp-com-setup
    https://troynyiov.diowebhost.com/56765121/123-hp-com-setup
    https://juliusgvekt.fitnell.com/42149848/123-hp-com-setup
    https://marcovospp.dbblog.net/32968022/123-hp-com-setup
    https://shanerneuf.ezblogz.com/33007001/123-hp-com-setup
    https://damienewlwj.designertoblog.com/32584894/123-hp-com-setup
    https://123-hp-com-setup36383.blogs-service.com/32685581/123-hp-com-setup
    https://manuelyshuh.bluxeblog.com/33231821/123-hp-com-setup
    http://angeloxtjvh.blogdigy.com/123-hp-com-setup-16288646
    http://123-hp-com-setup55257.tblogz.com/123-hp-com-setup-16860619
    http://rowannyfns.uzblog.net/123-hp-com-setup-16747398
    http://123hpcomsetup02975.canariblogs.com/123-hp-com-setup-17849888
    https://judahamuyh.qowap.com/61106169/123-hp-com-setup
    https://connerzlfhh.blog2learn.com/49445044/123-hp-com-setup
    https://123-hp-com-setup81088.jiliblog.com/60635838/123-hp-com-setup
    http://juliustjxis.pages10.com/123-hp-com-setup-37980906
    https://123hpcomsetup64814.getblogs.net/32754318/123-hp-com-setup
    http://edgarycybv.ampblogs.com/123-hp-com-setup-37631305
    http://123hpcomsetup82591.blogocial.com/123-hp-com-setup-35653844
    https://donovanyvite.dsiblogger.com/33026541/123-hp-com-setup
    http://123-hp-com-setup49124.onesmablog.com/123-hp-com-setup-39740747
    http://123-hp-com-setup05706.blogolize.com/123-hp-com-setup-40504478
    https://123hpcomsetup47924.ka-blogs.com/55764052/123-hp-com-setup
    https://123-hp-com-setup71297.blogofoto.com/32855226/123-hp-com-setup
    http://123-hp-com-setup23166.bloguetechno.com/123-hp-com-setup-36306039
    http://marioozhoq.shotblogs.com/123-hp-com-setup-16122881
    https://judahdnwdj.timeblog.net/38825946/123-hp-com-setup
    http://elliotbpyfu.tribunablog.com/123-hp-com-setup-16325339
    http://123hpcomsetup04703.blogzet.com/123-hp-com-setup-16907499
    https://travisncjou.acidblog.net/32957049/123-hp-com-setup
    http://123-hp-com-setup30368.blogminds.com/123-hp-com-setup-483292
    https://beckettrrpux.fireblogz.com/32618271/123-hp-com-setup

    ReplyDelete
  16. It's actually a great and helpful piece of information. I am satisfied that you just shared this useful information for us.
    Yankee Letterman Jacket

    ReplyDelete
  17. I truly appreciate this article post. Really looking forward to read more. Want more. 안마

    ReplyDelete
  18. After I initially left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and now every time a comment is added I get 4 emails with the same comment. There has to be a means you are able to remove me from that service? Thanks! 카지노사이트
    (mm)

    ReplyDelete
  19. Pretty component to content. I simply stumbled upon your blog and in accession capital to say that I get in fact enjoyed account your weblog posts. Any way I will be subscribing on your feeds or even I success you access constantly fast.

    야한동영상

    ReplyDelete
  20. Amazing issues here 오피헌터 . I am very glad to see your post. Thanks so much and I’m taking a look forward to contact you.

    ReplyDelete
  21. Great blog right here! Additionally your site a lot up very fast! What host are you the use of? Can I am getting your associate hyperlink in your host 횟수 무제한 출장 ? I wish my web site loaded up as fast as yours

    ReplyDelete
  22. I wish to show my thanks to this writer just for bailing me out of this type of incident. After scouting throughout the world-wide-web and finding advice which are not productive, I figured my life was well over. Being alive without the presence of strategies to the issues you have solved as a result of this posting is a crucial case, as well as the kind which might have negatively damaged my career if I had not discovered your site. Your own personal training and kindness in taking care of the whole thing was helpful. I am not sure what I would’ve done if I had not encountered such a solution like this. It’s possible to now look forward to my future. Thanks very much for your high quality and amazing guide. I won’t think twice to propose your blog post to anybody who wants and needs guidance on this matter.바카라사이트

    ReplyDelete
  23. Thanks so much for giving everyone a very brilliant opportunity to read in detail from this blog. It can be very great and also jam-packed with amusement for me personally and my office colleagues to search your site a minimum of thrice in 7 days to study the latest tips you will have. And lastly, I’m just actually fascinated concerning the wonderful inspiring ideas you serve. Selected 2 areas in this post are truly the most efficient we have all ever had.바카라사이트

    ReplyDelete
  24. Thanks for posting this info. I just want to let you know that I just check out your site. Tekkadan Jacket

    ReplyDelete
  25. Excellent information Providing by your Article thank you for taking the time to share with us such a nice article. Feel free to visit my website; 카지노사이트

    ReplyDelete
  26. Starting to export the company's products to other countries can be considered a turning point in the company's progress. After 32 years, the company acquired half of the total shares of Korea and quickly established its company in variousaftabnews.ir branches.

    ReplyDelete
  27. I like what you guys are up too. Such smart work and reporting! 카지노사이트핫

    ReplyDelete
  28. I really liked your article. I have learned a lot from this article on this site. I will be very grateful for this information. I have come to know a lot more from your article about this site. I want you to write more articles on the same topic.

    So now If anyone wants to buy a printer then we have a suggestion canon ij setup printer to do work properly.

    ReplyDelete
  29. Thank you Foreign visitors who wish to visit the Turkey need to apply for Turkey transit visa for US citizens online. apply for Turkey evisa, travelers need to fill out an application form, select your country and click on the blue button that reads- Apply.

    ReplyDelete
  30. Wow, superb weblog structure! How long have you been blogging for? you make running a blog look easy. The whole look of your site is great, let alone the content material! Feel free to visit my website; 토토사이트

    ReplyDelete
  31. I have taken your writing very well. Where can I get this information? I want to write good writing like you. Would you like to be a guest blogger on my website? Feel free to visit my website; 배트맨토토

    ReplyDelete
  32. Very good blog post about plastering a one bed flat. I am very happy to see this post and interested to find another good post in coming days. Thanks for it 야동

    ReplyDelete
  33. Blockchain is decentralized, meaning it is not controlled by any organization. "It's like Google Doc that anyone can work on," says BuchiOkoro, CEO and founder of the African Cryptocurrency Exchange. No one owns it,https://econews.ir/fa/content/3174564 but anyone with a link can help; "And as different people update it, so does your version."

    ReplyDelete
  34. Possibly, users do encounter a lot of technical issues associated with Netgear wndr4720 default password or log into it. If you are stuck with login, then you are supposed to launch the Nighthawk app and then log in with your Netgear. You should launch a web browser and then connect your router's network. Enter the routerlogin.net or http://192.168.1.1 in the address bar, and then the router login window will display and then enter the router admin username and password. Also, the username is admin.

    ReplyDelete
  35. IAS is one of the top-searching ISO 9001 Certification Bodies in Asian countries. We offer an easy yet effective process to achieve a globally recognized ISO 9001 Certification. It is the popular Quality Management System (QMS) certification followed by many organizations in Asia. This certification is a great treasure for an organization regardless of its size, type, and nature. Moreover, it assists organizations to reach the next level in the Asian business market. Call @ +6531591803 or visit our blog https://iasiso-asia.com/VN/iso-9001-certification-in-vietnam/

    ReplyDelete
  36. I am really pleased to read this blog posts which includes tons of
    valuable information.
    메이저사이트
    온라인경마
    경마사이트

    ReplyDelete
  37. I am a fan who has watched your writing from before. I have learned a lot from you. Please come to my site and help me.
    majortotositepro1
    racesiteinfo1
    oncasinositeinfo1
    totopickpro1

    ReplyDelete
  38. A connect canon pixma printer to wifi printer is an excellent printer, home-accommodating printer that combimned extraordinary elements with a reasonable cost. On the off chance that you own different gadgets from which you really want to print or need to avoid the problem of overseeing trapped wires, you ought to get a remote printer.

    ReplyDelete
  39. It's really great. Thank you for providing a quality article. There is something you might be interested in. Do you know 룰렛사이트? If you have more questions, please come to my site and check it out!


    ReplyDelete
  40. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me. 토토

    ReplyDelete
  41. The construction industry, like you, is clearly not afraid to bring about a way they believe." He longs for more enthusiastic writers.Follow your heart constantly.

    바카라사이트

    안전놀이터

    토토

    토토사이트

    토토

    바카라사이트

    ReplyDelete
  42. In the academic lives of students, research papers hold a special place. Students must learn to view research as an investigation into relevant and challenging topics. For online research paper help experts in accessing enormous amounts of information from the internet and reinforcing the teaching of suitable information and technology usage are accessible. Plagiarism is defined, and students are taught how to avoid it. As part of the research paper writing process, students and teachers have the opportunity to explore intellectual property rights and ethics. Plagiarism and intellectual property rights must be thoroughly discussed throughout the curriculum.

    ReplyDelete
  43. This comment has been removed by the author.

    ReplyDelete
  44. Content KhelRaja presents the ultimate slot machine app for online gaming enthusiasts. Dive into a world of thrilling entertainment with the best online slot games for real money. Our platform offers a diverse selection of slots, from classic fruit machines to modern video slots, all designed for maximum enjoyment and big wins. With a user-friendly interface, secure transactions, and generous promotions, KhelRaja ensures a seamless and rewarding slot gaming experience. Whether you're new to slots or a seasoned player, join us to experience the pinnacle of online slot gaming. Try your luck and chase real money rewards with KhelRaja best slot machine app.

    ReplyDelete
  45. Users of HP printers frequently experience printer not printing issues. Tips For HP Printer Troubleshooting There are numerous potential causes of this problem, ranging from incorrect settings or drivers to problems with connectivity. You can attempt the following techniques if you're having trouble coming up with a good solution. They can assist you in resolving your HP printer's printing problems.

    ReplyDelete
  46. This post beautifully encapsulates the essence of our shared human journey, skillfully blending elements of introspection and illumination. Your words dance across the page with a grace that is both captivating and profound, inviting readers to embark on a voyage of self-discovery. I am particularly struck by your exploration of the intricate web of emotions that shape our lives, shedding light on the rich tapestry of human experience. Your perspective is both insightful and thought-provoking, and here I am going to india visa application sri lanka offering a fresh perspective on the complexities of existence. Thank you for sharing your wisdom—it serves as a guiding light for all who seek deeper understanding.

    ReplyDelete