A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: [F8] Build a Railway Track.

  1. #1
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911

    [F8] Build a Railway Track.

    I am trying hard to develop a game: "Build a Railway Track".
    The game idea is:
    -Assemble a railway track of any desired shape, rectangular, oval, etc. by dragging and dropping the rail segments.
    -Place the train engine, and compartments on this track.
    -Press the start button and the train should travel on this track continuously.
    I have completed the basic design, but I would like to know whether there are any online games to play, or any tutorials, on this topic.
    -Thanks in advance.
    <signature removed by admin>

  2. #2
    Senior Member AzraelKans's Avatar
    Join Date
    May 2002
    Location
    Hell... with frequent access to heaven ;)
    Posts
    409
    Not a bad idea, sounds neat.

    I think you should look for code/examples/tutorials on Pipe Dream (the game where you place tubes to guide water) is pretty much the same concept

    Anyway if you dont have that code yet, the pseudocode is pretty simple, you change a tile you open or close exits up down left right (it can actually be a single binary check value )

    when the train goes you check the beggining tile and see the exits (in this case all tiles should have a single exit) then check that tile and so forth.

    If theres no tile or theres no exit you lose.
    If you reach the end tile. you win.

  3. #3
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    That works for grid based, Azrael, but he did mention something about oval tracks. Curves are a bit trickier. My guess is it's going to be something with trig, math, and more numbers than I'd like to deal with. But it does sound like a neat idea.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  4. #4
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    this is a tilebased game where the player builds their own track. it's basically a tile editor combined with a game.
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  5. #5
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    nGFX has done a fair few of these games, and wrote this blog post explaining some things,

    http://blog.gamingyourway.com/PermaL...9430b48ad.aspx

    Hopefully he'll pop by this thread and be able to give a hand.

    Squize.

  6. #6
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    There are several classes around that make an object follow a drawn path. Here's one by Senocular that should help: Path Class

  7. #7
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    I have completed the basic program for a rectangular track similar to the one shown below. You can play it by clicking on the link given below.
    Please give your suggestions for improving the same.

    Play: Build your own railway track
    Last edited by Eager Beaver; 01-29-2008 at 02:08 PM.
    <signature removed by admin>

  8. #8
    Funkalicious TOdorus's Avatar
    Join Date
    Nov 2006
    Location
    Nijmegen, Netherlands
    Posts
    697
    I thought you wanted the interface to be drag & drop? That way you can create more than one track and some more interesting puzzles. For instance you can have multiple trains on multiple tracks at once. Having some prelayed track would make force you to come up with solutions to not make the trains crash etc.

    Adding railroad switches that would be triggered by trains running over a tile would allow even more interaction between multiple trains.

    Well... assuming you're going for a puzzle game here

  9. #9
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    @TOdorus
    Thanks, yes, what you have suggested is my ultimate goal. But then it requires a lot of coding, and a very high knowledge of AS2. Hope I can achieve it in due course, just now I have only a limited resource.
    <signature removed by admin>

  10. #10
    Funkalicious TOdorus's Avatar
    Join Date
    Nov 2006
    Location
    Nijmegen, Netherlands
    Posts
    697
    In that case you should really read tonypa's tilebased tutorials. They're excellent.

    Seconds I think you should download yourself a copy of the old dosgame Transport Tycoon from HotU. The interface isn't drag and drop, which may be less tedious when laying long lines of track. It also shows what kind of tracks you'd need to create some pretty complex systems.

    Just some suggestions to get you started. I myself ain't that much of a tilebased coder so I'm limited in the help I can offer on that topic. Your idea sounds nice, so do make a game out of it!

  11. #11
    Trainee coder Viza's Avatar
    Join Date
    Sep 2006
    Location
    Melbourne, Down under
    Posts
    513
    If you do decide to use tiles in a drag'n drop style engine, from memory NGFX goes into some detail about such a system in his post at gamingyourway.com...Or at least, I believe he addresses how to dynamically create the motion of the car/train in comlex turns (to follow the correct track).

    Good luck!

    Viza.

  12. #12
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    Thank you all guys.
    This job really sucks me.
    Negotiating curves is requiring trigonometry, and again the shape drawn for the movieclips don't match exactly the mathematical equations.
    <signature removed by admin>

  13. #13
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    If you follow the link to Senocular's path class, it has everything you need to make the train follow any path. You just need to change the method for creating the path it will follow. I'm pretty sure Sen also has a class to plot your curves, which will allow you to have smooth transition through curves using his path class.

    I personally think tile based is too limiting. In most tile based sims, you are limited to 8 motion vectors. I've been playing around with the idea of a RCT type game using perlinNoise to generate a heightmap. You would draw the tracks on the map, then use something like Senocular's path class to make the train follow it smoothly (a bit more challenging since you have to insure your train can make it over the hills where you draw it). Works great for 3rd person perspective views, but a first-person view is a bit more difficult due to the limitations of a voxel based flash engine. I'm hoping PV3D will give me the speed needed.

  14. #14
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    Quote Originally Posted by JerryScript
    If you follow the link to Senocular's path class, it has everything you need to make the train follow any path. You just need to change the method for creating the path it will follow. I'm pretty sure Sen also has a class to plot your curves, which will allow you to have smooth transition through curves using his path class.
    Thank you. I studied Senocular's path class and could not understand it fully.
    I think it's something to do with drawing lines and curves, something similar to line rider game.
    In my project I have only movieclips, fixed length straight rails (horizontal, and vertical), and curved rails (right up, and down, left up and down), which have to be assembled to make a continuous track.
    Anyhow I have downloaded Senocular's path class files, and try to use them in my project.
    <signature removed by admin>

  15. #15
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    EB, I hope you do not object, but I think I might try my hand at this as well. Oh and Jerry, I'm stealing your heightmap idea too. I've got some time to play around with flash, but not long enough to really progress anything. This doesn't seem to complicated so I thought I might play around with it.

    EB, the idea just seems to fun to pass up. I'll probably open source if/when I come up with anything. I just want to see if I can do it.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  16. #16
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    Quote Originally Posted by ImprisonedPride
    EB, I hope you do not object, but I think I might try my hand at this as well. Oh and Jerry, I'm stealing your heightmap idea too. I've got some time to play around with flash, but not long enough to really progress anything. This doesn't seem to complicated so I thought I might play around with it.
    EB, the idea just seems to fun to pass up. I'll probably open source if/when I come up with anything. I just want to see if I can do it.
    I can post you the FLA if you are serious of improving on it. The only condition is that you should post your work and send the FLA to me after you handle it. Till then I shall stop working on this project. Please send PM with your E-Mail address for sending the FLA.
    <signature removed by admin>

  17. #17
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    I slapped this together in about 20 minutes:

    I'm going to try to work the movement easier with prototypes and trig. Methinks it might be easier to do it that way when you start adding multiple cars.

    EB, I was just going to post the fla here. That ok with you? If you have MSN, you can message me there in the next few minutes.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  18. #18
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    Nice work. If you want you can post your FLA.
    Thank you.
    <signature removed by admin>

  19. #19
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    use the beizer luke, use the beizer
    lather yourself up with soap - soap arcade

  20. #20
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    beizer what now? How would you use the curve for that, or do you mean as part of sen's path class?
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center