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 / 2d racing Path

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 7th Jul 2015 10:49
Hi.

i want begin make a 2d racing game with app game kit 2 but I need know how can create Path on road for Cars?

Thanks.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 7th Jul 2015 11:34
I would use an array to store the coordinates of various "way points" round the track, and then get the cars to drive to each one in turn. As soon as a car gets close enough to a way point, then set it to head towards the next.

CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Jul 2015 11:51
I know what's coming next! Lol.

Good luck Behdadsoft. I can't help you as I need to crack on with my own developments now. My 2c: You should really be in a position to write your own code by now, or if not, then hire a programmer. Copying code from community members, buying in graphics and sound, and publishing the whole thing as your own just doesn't seem like cricket to me, but it appears to be working for you, so I wish you all the best and I hope you make a success out of it.

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Jul 2015 12:26
http://bfy.tw/gt4

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 7th Jul 2015 13:20
@BatVink

I don't ask how can make racing game. (already I made a 3d racing game with 3drad engine).

In unity or any GUI engines anyone can draw path or can find tutorial for make it. currently I working with AppGameKit and not unity.AGK is programming language and not engine(according to user says) and no have any tool for make draw path.

better is give a link for draw path without tool.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 7th Jul 2015 14:48
@Behdadsoft
long ago i had a good solution.
i had a grid at screen and each cell contains the direction to the track. so the car steering wheel turns with this information.
means it just need a array with a angle value.
with a cell size of 8x8 you can access the array by position/8
very easy.
each track have a different array.

AGK 108 (B)19 + AppGameKit (Steam) V2 Beta .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th Jul 2015 15:05
Or you can manually calculate a path based on a bunch of points and a Bezier curve. There are quite a few examples of using Bezier curves on the forums here. You just need to look them up. Here's one for ya (just search "Bezier" in the search bar): http://forum.thegamecreators.com/?m=forum_view&t=210460&b=41

Using AppGameKit V2 Tier 1
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Jul 2015 16:49
Just having an array of waypoints works pretty well:



Each way point is a hidden sphere, when the car collides with the sphere you tell the car to head to the next waypoint. The size of the sphere and the amount of spheres will determine how the cars react. When I tried this it was one of those rare moments where everything just worked better than I expected

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 7th Jul 2015 20:55 Edited at: 7th Jul 2015 20:57
screenshot.
because i am lazy i let the computer calculate the angle to the tracks. me using 4 point bezier one after another.



AGK 108 (B)19 + AppGameKit (Steam) V2 Beta .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Attachments

Login to view attachments
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 7th Jul 2015 21:18
Thanks all for help. but how can use bezier in game?? I'm confused.

seem make racing game in AppGameKit is very hard.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 7th Jul 2015 22:04
bezier is very easy,
it get 4 vectors (points), u give a value between 0 and 1 (0=begin 1=end)
and you get a result vector.
with a list of 4x points u have a track.



AGK 108 (B)19 + AppGameKit (Steam) V2 Beta .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th Jul 2015 22:07 Edited at: 7th Jul 2015 22:09
Quote: "seem make racing game in AppGameKit is very hard."

As opposed to what? Which engine have you used that made making this kind of thing easy? Could come in useful!

Playing games is easy. Making games, not so much...

Using AppGameKit V2 Tier 1
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 7th Jul 2015 22:57 Edited at: 7th Jul 2015 22:59
Quote: "As opposed to what? Which engine have you used that made making this kind of thing easy? Could come in useful! "


I made a racing game at 2 year ago with 3dRad Engine. it's free and Very easy to use, but Unfortunately about last year stop developing.

you can download it : http://3drad.com/

this is some picture of my project:















Game-editor is 2d game engine and very easy to use that have draw path tool for draw custom path.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Jul 2015 23:29
If you were so successful with 3D RAD, this is not a question you need to ask.

3D RAD isn't a programming environment. It's drag and drop, with popups to add your parameters. You select "Throttle" and "Brake" controls from drop downs, and enter max speed in an edit box.

Making a racing game in AppGameKit is no harder than any other environment of the same kind.

I have restrained from saying this for many weeks and months but...you need to make your own games, and stop plagiarising other peoples' code, piece by piece. "how can create Path on road for Cars?" is like asking how to lay the foundations of a house without picking up a shovel first.
The turning point for me was when CJB wrote 90% of a Flappy Bird Clone and you published it.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 8th Jul 2015 00:24 Edited at: 8th Jul 2015 00:38
Quote: "3D RAD isn't a programming environment"


if you install and work with it can see it's not drag and drop. for make select car and save-load date, get input name and ... I wrote more than 2000 line script.

Quote: "You select "Throttle" and "Brake" controls from drop downs, and enter max speed in an edit box."


this is simple features. for better control I disable them and wrote some scripts.

for AI control (Ahead or behind) and for show change car position I wrote script and ....



If you think them are drag and drop, you can show me.

Quote: "
I have restrained from saying this for many weeks and months but...you need to make your own games, and stop plagiarising other peoples' code, piece by piece. "how can create Path on road for Cars?" is like asking how to lay the foundations of a house without picking up a shovel first. "


Quote: "
Making a racing game in AppGameKit is no harder than any other environment of the same kind.
"


I say the same thing. so need more guide, because my method is not same in AppGameKit and should see example for more familiar with AGK. also AppGameKit is not game engine and my method is in game engine.

and I've repeated several times I don't ask anyone give me code,When I do not know about that topic.

Quote: "CJB wrote 90% of a Flappy Bird Clone and you published it."


What????

your mean is this topic??

http://forum.thegamecreators.com/?m=forum_view&t=214607&b=41

at first thank you CJB for all helps.

in above topic I used physics for jump in my game and CJB change it with none physic mode for exists bug in AGK. even with CJB code don't fix problem and I'm sure this bug is relate to AppGameKit because my game have only 5 clone sprite.

In this topic i ask "calculate between 2 pipe" for put my coin between pipes but everyone tell me use SetVirtualResolution instead of SetDisplayAspect and enyone don't give me any code, so I wrote it and not CJB.

http://forum.thegamecreators.com/?m=forum_view&t=212551&b=41

I wrote save and load data for score, not CJB.
I wrote Select characters, not CJB.
I wrote some effects in game (spirit,...), not CJB
I wrote clone mode with only 5 sprite, not CJB.
and ....

I don't know what you say CJB wrote 90% of flappy bird clone.

10 days after finish flappy dragons, I busy find lag problem in my code, finally I understand problem is relate to AppGameKit and not me. and you already know this problem is relate to AppGameKit and you never said anything to me.
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 8th Jul 2015 00:33
Quote: "I wrote more than 2000 line script."


Quote: "for better control I disable them and wrote some scripts.
"


Quote: "for show change car position I wrote script and .... "


Quote: "I wrote save and load data for score, not CJB.
I wrote Select characters, not CJB.
I wrote some effects in game (spirit,...), not CJB
I wrote clone mode with only 5 sprite, not CJB.
and ...."


I am not being funny but if you did all this and have done all your published games then you shouldn't have a problem with driving game in AGK.

There have also been some good suggestions on this thread about how to make the waypoints etc, have a bash first and then post code for help if you get stuck or problem.

Look forward to seeing your progress as driving game would be a good project.

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 8th Jul 2015 12:11
@Markus:
Your screenshot is very interesting.
I never through about this way, maybe because I never did a good racing game.

I assume you make the spline/bezier curve and then you calculate the angle/direction of the neighbors along the curve ...then the neighbors of the neighbors..and so on..
is that right?


Using AGKv2 Tier1
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Jul 2015 12:36 Edited at: 8th Jul 2015 12:37
@janbo
i believe i gone once through the x,y grid and find the shortest distance to the spline, then go a little bit forward in this spline
and use/save this angle/direction to it in my grid(xy array)

AGK 108 (B)19 + AppGameKit (Steam) V2 Beta .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Jul 2015 12:46
Markus there is a really good way to improve your racing line.

1. For each point on the spline, work out which side is less than 180 degrees in relation to the 2 points on each side.

2. Move the point a small amount "downwards" to increase the angle towards 180 degrees in relation to the 2 points on each side.

3. If you hit the side of the track, stop moving the point.

4. Keep going around the track multiple times until the result looks good. It might take a few "loops" around the track depending on the size of the change you make, and the complexity of the track.

In the end you will have a racing line that is much closer to a real one. It still won't be perfect but it will be much better. What this process does is pull the line to the insides of the bends, and straighten the line on the straight parts of the track.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Jul 2015 12:53 Edited at: 8th Jul 2015 12:54
Graphical explanation. Don't forget to pull the nodes/handles too or you will get some sharp bends.



Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Jul 2015 13:50
@batvink,
ahh, its not a racing line, it was more or less a slot car racer
with 2 tracks.
but i understand what you mean, it would make sense for a inner and outer track. it will result in more action

AGK 108 (B)19 + AppGameKit (Steam) V2 Beta .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Jul 2015 23:26
There are no lag problems in AGK. I run on all sorts of devices old and new with no lag whatsoever even with quite complex games. If you are experiencing such issues it is either your hardware or your software. Trust me I have pushed AppGameKit to the limit on dozens of devices dozens of times since it first came out.

Using AppGameKit V2 Tier 1
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 14th Jul 2015 06:26 Edited at: 14th Jul 2015 06:32
I am experimenting with a track myself using an array for the x y grid data.
Each section of my grid uses a 512x512 image for that sprite.
The track is made up of 256 sections, being a grid 16x16 sections.
The track seems huge and I have no lag issues yet... working on my mini-map system today.
Once I finish my collisions, then I will be ready for paths.
Not sure if I am doing anything right, but once I get a bit further along I will make a thread and be glad to share.
I'm afraid I am not much help at this point though, but there are nice racers already done in AppGameKit, so I venture forward knowing it is very doable in AGK.

Quote: "long ago i had a good solution.
i had a grid at screen and each cell contains the direction to the track. so the car steering wheel turns with this information.
means it just need a array with a angle value.
with a cell size of 8x8 you can access the array by position/8
very easy.
each track have a different array."

Yes, very similar to what I had in mind.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-11-16 18:13:10
Your offset time is: 2024-11-16 18:13:10