Search Unity

WIP - Flight Control style path drawing for iOS

Discussion in 'iOS and tvOS' started by JohnnyA, Oct 9, 2010.

  1. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    I've started work on a path drawing game and I was wondering if anyone would be interested in me releasing the code for the path calculation. It would be free if I get a mention in your games credits screen. Maybe with a small fee if you don't want to credit me :)

    Of course I have probably reinvented the wheel as I'm sure this has been done many a time, but ahh well, I had fun doing it.

    Youtube of current progress:

    http://www.youtube.com/watch?v=kNN69YCyNtU

    Implementation uses bezier interpolation (catmull rom wasn't smooth enough, haven't tried b-spline) and stores the interpolated values in an array. It "predicts" where your next control points will be, and each new control point only causes an update to the previous two line segments. It's reasonably performant (10 tiles at 30fps+ on a 2G touch with 15 smoothing steps), although I haven't really optimised it yet.

    Current impl allows you to vary space between control points, tile speed, path length, how many interpolation points and how "curvy" the lines are.
     
  2. ahloyan

    ahloyan

    Joined:
    Jan 3, 2009
    Posts:
    78
    its guys like you that make the unity community proud

    amen
    i would love to play around with something like that
     
  3. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    I'm interested in that piece of code, it's always interesting to see how others are doing this things :)
     
  4. Hesham

    Hesham

    Joined:
    May 29, 2008
    Posts:
    147
    I would actually wouldn't mind buying the code from you.
     
  5. snicholls

    snicholls

    Joined:
    Mar 19, 2009
    Posts:
    229
    Everything shouldnt be about money, communitys used to share alot more however everyone always thinks about the cash these days.
     
  6. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Hmm, as I said happy to give it away for free, just a one line credit would be nice ...

    EDIT: And to add to this... if people are interested I will clean up the code as well as add comments/etc to ensure the code is understandable and easily modifiable.
     
    Last edited: Oct 9, 2010
  7. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    Hi

    Very nice demonstration of path drawing and the square object moves along the path in a very smooth manner, ... well done. After watching the video I was wondering if you can if you can update the project and replace the square object with some other sprite that has a definite front end to it and have the object rotate as it goes around corners to always face the direction it's moving in.

    Cheers
     
  8. timsvw

    timsvw

    Joined:
    Aug 18, 2009
    Posts:
    42
    Wow! This is a really nice demo and I would also love the chance to play around with it. Thank you for being so open with your project.
     
  9. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    Its really awesome... if I need your code then how would you give it? I'll also include your name in the credits.

    You did a really nice job.
     
  10. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Looks like there is a bit of interest. Enough to motivate me to clean up code and add some more features/etc.

    It will probably be a few weeks away though; top priority is to get my project out (I know, I know, so selfish)!

    Thanks mate, I don't actually need to rotate for my game but I'll add that feature at some stage.
     
  11. KITT

    KITT

    Joined:
    Jul 17, 2009
    Posts:
    221
    That's pretty neat. Fair dinkum mate. Thanks for the share.
     
  12. bigdaddio

    bigdaddio

    Joined:
    May 18, 2009
    Posts:
    220
    I'd also be interested in this code, I a fairly new to unity and learning how people do things is a big plus.
     
  13. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    This looks great! I'd be interested in seeing the code too...
     
  14. impla007

    impla007

    Joined:
    Jan 30, 2010
    Posts:
    57
    YES, It would be great !!!
    Go Johnny Go !
     
  15. Hilm

    Hilm

    Joined:
    Nov 2, 2007
    Posts:
    338
    I'm interested... Would say you should also have an option to buy it and exclude the credits bit tho, as I persnally only put the studios name/ dont bother with named credits in our games at the moment, but would quite happily pay for this code if I had a game suited for it...
     
  16. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    interested as well
     
  17. iCOOLgeeks

    iCOOLgeeks

    Joined:
    Mar 22, 2009
    Posts:
    65
    I'm so excited to get a look at this code. Thanks for sharing with the community!
     
  18. domodes

    domodes

    Joined:
    May 18, 2009
    Posts:
    51
    I don't think it'll be a crime to sell this JohnnyA. Just refine the code more and charge a small fee.
     
  19. defjr

    defjr

    Joined:
    Apr 27, 2009
    Posts:
    436
    I want this.
     
  20. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Wow, this is cool. I will bookmark. And with the new asset store $5-10 wouldnt be a problem at all for this...
     
  21. Jean-Noel

    Jean-Noel

    Joined:
    Jun 3, 2010
    Posts:
    9
    OMG, this would save me sooooo much coding time and I am sure I could learn sooo much by just reading your code. Question, what version of Unity iPhone do I require since it looks like it uses GLLine and I think that is only in Pro or can I get away with iPhone Standard?
     
  22. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    I use Vectrosity to draw the lines, its fast and easy. Would only need to be a few lines replaced to use GL, and I will cover these when I release this as a package.

    That said the code is currently tied up in my game (particular the handling of the touch events which is centralised), and I need to go through a refactoring effort to pull the code out. I've refactored the bezier interpolation into a separate script but I need to do the same for a number of other bits and pieces.

    It's hard to get an accurate timeline for this, but it's probably 5-6 weeks away. Sorry for the delay :(

    - Johnny
     
    Last edited: Nov 17, 2010
  23. ANTA

    ANTA

    Guest

    Joined:
    Mar 13, 2010
    Posts:
    5
    look great!! Would you like to share your code? it my be posted as a standard on Unity's website!
     
  24. vinzzz

    vinzzz

    Joined:
    Dec 29, 2010
    Posts:
    1
    I have been searching for this for a long time for the app I'm working on and wondered if I could use it?
     
  25. JohnnyG

    JohnnyG

    Joined:
    Jan 5, 2011
    Posts:
    1
    Wow , JohnnyA- it's really nice peace of work. Is there any way I can look at the code how have you done it ? Actually I'm trying to implement this part in my project basing on bezier etc but it's not as nice as your example.

    Jan
     
  26. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Waiting for the source too ;)
    If needed, I can send a small fee for it
     
  27. schwertfisch

    schwertfisch

    Joined:
    Sep 7, 2010
    Posts:
    126
    Path drawing is actually a whole games category by itself. One could do hundreds of different games based almost entirely on the path drawing concept. Definitely interested and wouldn't mind paying for it, one should be paid for their work. ;-)
     
  28. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    is this still up? I saw no code posted or anything on the asset store
     
  29. hgbimonti

    hgbimonti

    Joined:
    Dec 31, 2008
    Posts:
    19
    I'd love to take a look at your code and do something using it. If I ever release something with it, your name will be there. Or, I can also pay for it if you prefer. Thanks a lot!
     
  30. fanstudio

    fanstudio

    Joined:
    Jan 25, 2011
    Posts:
    5
    Is this script still available? I'm interested in buying it!
     
  31. CodeMates

    CodeMates

    Joined:
    Dec 1, 2010
    Posts:
    3
    Hi, Can I still use get a copy of this script in exchange for credit mention?

    Thanks
     
  32. SilverApe

    SilverApe

    Joined:
    Nov 11, 2009
    Posts:
    6
    Hi, I am also very interrested so I hope you will release it soon :) Maybe you could give us an update?

    greetings,
    Aaron
     
    Last edited: Apr 5, 2011
  33. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Hi guys, I took a bit of a break, and am now focusing on finishing one of the games I have been working on which uses the script.

    I still plan to release this either as is for free(with credit), or tidied up and extended on the asset store for around $25.

    I can't see this being ready in the next 2-3 weeks, maybe early May... keep posting, the more people who post the morelikely I am to get my butt in to gear.

    Sorry about the looooong delay, real life has been getting in the way :(

    PS You can check out the work in progress at: http://www.youtube.com/watch?v=7d0ly-LSGJU
     
    Last edited: Apr 5, 2011
  34. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    To those who can't/dont want to wait the excellent Vectrocity library (available in the Asset Store) has a line drawing example that is literally only a few lines of code.
     
  35. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    It's not the line drawing stuff (in fact I use Vectrosity for the line drawing in the sample, although it can use GL), it's the bezier curves + input prediction + touch input + animation. Nothing that complex, but pulling it all together was a little work :)
     
  36. jeewanthasas

    jeewanthasas

    Joined:
    Sep 8, 2011
    Posts:
    13
    I'm developing a game in unity 3D using path drawing as the main input from the user. Nowadays I'm working on bazier curves already used 3 methods to draw the line including GL,Line rendering and Graphics following the link :

    http://www.everyday3d.com/blog/index.php/2010/03/15/3-ways-to-draw-3d-lines-in-unity3d/

    But I've selected the low level graphic library called GL for my development. It would be nice to have your script with/without your project file as It is more beneficial for me to add bezier curve algorithm into my code in a better way and..., you'll be there on my credit page as you mentioned at the beginning... or I would like to pay for your effort :)

    Please reply me ASAP...

    Thank you very much
    S.Jeewantha
     
    Last edited: Sep 9, 2011
  37. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    So interested in the code, would pay some $ for it or mention you in the game credit whichever is good for you.
     
  38. jeewanthasas

    jeewanthasas

    Joined:
    Sep 8, 2011
    Posts:
    13
    I'm developing a game in unity 3D using path drawing as the main input from the user. Nowadays I'm working on bazier curves already used 3 methods to draw the line including GL,Line rendering and Graphics following the link :

    http://www.everyday3d.com/blog/index.php/2010/03/15/3-ways-to-draw-3d-lines-in-unity3d/

    But I've selected the low level graphic library called GL for my development. It would be nice to have your script with/without your project file as It is more beneficial for me to add bezier curve algorithm into my code in a better way and..., you'll be there on my credit page as you mentioned at the beginning... or I would like to pay for your effort :)

    Please reply me ASAP...
     
  39. turnsy

    turnsy

    Joined:
    Dec 24, 2011
    Posts:
    6
    I know I'm obviously very late on this forum, but by any chance did end up getting this finished....? Definitely keen on your addon and would be happy to pay a little for it.
     
  40. jaxx0rr

    jaxx0rr

    Joined:
    Aug 25, 2013
    Posts:
    23
  41. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    Sorry to bump and ancient thread but I have been searching for months now for a hint or tutorial on how to produce a flight control type game but all I seem to find are dead posts where people never post any code or even hint at how its done, or I just get flight sim controls.
     
  42. Andrei-Muresanu

    Andrei-Muresanu

    Joined:
    Feb 12, 2016
    Posts:
    1
    I have the same problem have you found anything?
     
  43. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Super Necro! Nearly six years ago :)

    Due to using Vectrosity for drawing I decided not to release. Wasn't enough interest to motivate me to create a line drawing approach that worked on free (before free got all the pro features).

    If I could find the code I would paste it, but I'm two computers and a poor backup strategy removed from access.

    The approach was as follows:

    - Every time the finger moves a distance of X from the last control point add a new control point. The smaller X the smoother it is (it needed to be tweaked for perfomance back in 2010, but probably no need now).

    - The planes/dice/etc move smoothly from control point to control point (tween, lerp, however you want to move between two points). We call the piece between two control points a segment.

    - For line drawing an control point was predicted to appear in the average direction of the last two segments (i think the weighting was 2:1, if you have a small X from above you might need to tweak this to average over more segments).

    - The line is drawn with vectrosity, at the time vectrosity didn't support curves so we also calculated curves.

    - Cant remember how the fading was handled (did it even fade I can't remember).
     
    Last edited: Feb 12, 2016
    softwizz likes this.
  44. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
  45. Napstablook25

    Napstablook25

    Joined:
    Apr 15, 2017
    Posts:
    1
    I'd want to look at this script.