Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Path Editor

Author
Message
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Dec 2017 09:04 Edited at: 12th Apr 2018 23:40
Path Editor



Clonkex Bezier include library


and an example of using it with the current Bezier curve moving around the mouse x y position
and with a bullet trail using the draw command when mouse is clicked
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Dec 2017 09:17 Edited at: 12th Apr 2018 23:36
The path editor has the option of moving via wavepoints or bezier
It works via saving a point calculated from the centre of the screen
ie a perfect sqaure would be -20,-20 20,-20 20,20 -20,20 xy locs
then you add the positions to the position you want it to rotate around



The bezier saved text file needs work as atm its saving every location not just for points
that may be needed for a circle and calculating in real time like it should
the following function is how it works.



I hope that clarifies for anyone that may be interested. Moving at waypoints may still be
very usefull as you could still point the craft at the enemy and move toward it gradually in
a formation attack i havent shown an example of that but im sure you can work that out
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Dec 2017 22:23
THINGS TO DO
============
1.Snap to grid option.
2.Allow placement outside of viewing window.
3.Recalculate Bezier Curves in realtime when wanting to use them in your own software.

fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 11th Dec 2017 22:57 Edited at: 11th Dec 2017 22:57
4. Make it work in 3D
Richard_6
7
Years of Service
User Offline
Joined: 3rd Feb 2017
Location:
Posted: 12th Dec 2017 01:55 Edited at: 12th Dec 2017 02:12
This looks amazing fubarpk! Thank you so much for sharing this!

I'm already exploring it. I have some questions if you don't mind:

1. I was able to run the project, create, save and load the paths. However, I can't find the arrayPath.txt or arrayBezier.txt in my project folder (I'm using mac).

2. Your example (Space Odyssey) is working well, but I found it a little complex as I won't need to move the whole path, just the sprite. If it's not to ask too much, would you have any simple example on how to read the file and make the sprite follow the saved path?

Thanks again!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Dec 2017 04:27 Edited at: 12th Apr 2018 23:35
Quote: "1. I was able to run the project, create, save and load the paths. However, I can't find the arrayPath.txt or arrayBezier.txt in my project folder (I'm using mac).
"

AGK uses another project directory for saving and loading files I personally like to search for it when I want to find it not sure how to do this on a mac or where it is sorry
Quote: "2. Your example (Space Odyssey) is working well, but I found it a little complex as I won't need to move the whole path, just the sprite. If it's not to ask too much, would you have any simple example on how to read the file and make the sprite follow the saved path? "
If you dont want to move the path around with the path command just call the movepath function or movebezie functionr with the same x,y values. which for example might be the centre of the screen which in my example would be 512,384 i made it changeable as its more versatile then. Also the speed variable with the movepath function call is relative to the ammount of pixels you may wish to move. Sorry its not very well documented there is still much work to do to it but as you asked i thought ide post what i had

you could remove this piece of code from the main loop


which would leave you with this


I added the other bit as it makes a nice bullet trail which so far ive only found usefull for a lazer style shooter
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Dec 2017 04:44
Quote: "4. Make it work in 3D "

That sure would be handy blinkok especially with beziers think I could do the grid made from plains lol
I haven't delved into 3d with AppGameKit yet but have with DBPRO and GDK in the past so who knows
but I welcome any changes or suggestions anyone wants to add and share
fubar
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Dec 2017 19:35
I have a snippet somewhere showing how to trace a bezier path at a constant speed.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Dec 2017 21:21
Quote: "I have a snippet somewhere showing how to trace a bezier path at a constant speed."


link please, this would be very useful!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Dec 2017 12:42 Edited at: 13th Dec 2017 12:53
I'll try to find it, but it was posted in someone else's thread. Maybe one of Clonkex's I think.

Ok, I found that easier than I expected.
https://forum.thegamecreators.com/thread/210460

It's not an ideal solution if you have large paths that change dynamically due to all the distance calculations. For an editor it'd be fine, but probably not for real-time use in game with a changing path. That being said, it's more of an approximation but it'll match exactly with the path you draw on screen due to how you'd have to draw it. Clonkex and I have both tried researching a more exact solution, I even asked about parameterizing an algorithm on gamedev but nobody had a solution.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 13th Dec 2017 16:48 Edited at: 12th Apr 2018 20:15
Phaelax I think you mean recording the overall distance that each point lies from the start. and storing the total length of the curve.
Then, taking the total distance and your stepping value in your changes to Clonkex's code. By my understanding

without changing Clonkex's include code that would leave my main code in path editor to look like this.



I'm thinking there must be a neater way to do so but I need to get my head around whats there now math aint my strong suit
fubar

Login to post a reply

Server time is: 2024-03-28 20:50:32
Your offset time is: 2024-03-28 20:50:32