Coder Social home page Coder Social logo

antoniovazquezaraujo / letrain Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 104.28 MB

The letter train simulator. Java version

License: Apache License 2.0

Java 99.81% ANTLR 0.19%
ascii ascii-game game java simulator terminal trains video-game video-games

letrain's Introduction

Contributors Forks Stargazers Issues MIT License

     __       ______           _
    / /   ___/_  __/________ _(_)___
   / /   / _ \/ / / ___/ __ `/ / __ \
  / /___/  __/ / / /  / /_/ / / / / /
 /_____/\___/_/ /_/   \__,_/_/_/ /_/
      The Letter Train Simulator           
  (C) 2006-2023 Antonio Vazquez Araujo 

LeTrain

Letrain is a train simulator made for the ascii terminal
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

LeTrain is a train simulator that can be played on any ascii terminal. It consists of creating tracks and stations along a virtually infinite map, creating trains and earning money by carrying passengers between them. It will be more profitable the farther apart they are.

**Warning This is a preliminary version. There are still many things that are pending. At the moment it works but one day it will be much better than it is now.

LeTrain map zoomed out

(back to top)

Built With

(back to top)

Getting Started

Prerequisites

  • Java JDK 17
  • Apache Maven

Installation

To install it

  • Clone it
    git clone https://github.com/antoniovazquezaraujo/letrain.git
  • Install it
     mvn clean install
  • Run it
     java -jar target/JLeTrain-<version>-jar-with-dependencies.jar

(back to top)

Usage

Ground, Water and Rock

This is the general appearance of LeTrain. On the map, randomly generated for each game, you can see water areas in blue, mountain areas in orange and the dark area which is normal ground. Building tracks across normal ground is fast and cheap, however, creating bridges to cross lakes or drilling tunnels to cross mountains is slow and expensive.

At the bottom you can see the menu, where the different game modes are selected, which will allow us to create tracks, build wagons and locomotives, turnouts, traffic lights and programmable sensors.

Each option is activated with the letter that appears in a different color, for example, to enter "drive" mode use the "d" key.

To create tracks on the map just select the "rails" mode and move with the cursor. Holding down the shift key will generate tracks and with control you can delete them. Turnouts and crossovers are created automatically.

Once we have tracks, we just have to go to "trains" mode, which will allow us to create wagons (any lower case letter) and locomotives (any upper case letter). To exit this mode you need to press Enter.

Creating tracks

Linking and unlinking

When creating wagons and locomotives they do not form a train, they are unlinked. To create a train you need to have the locomotive next to them and select "link" and then choose the direction to look for wagons. Then, with the space bar you will link all the wagons that are together. That will be a train. To unlink wagons, select "unlink", select the direction and move forward or backward to the wagon where you want to split. Then use the space bar Link and unlink

Infinite map

If you leave the page with the cursor, you will see that the map continues. There is no limit but memory.

If you find that the cursor is moving too slowly, you can type any number before using it, and each step will be added to that number of steps. For example, if you type 30, each time you press the advance key, 31 steps will be advanced, the default step plus the other 30. (If you are a Vim user (cheers Bram, wherever you are) you will be familiar with this kind of quantifier). To return to de default quantifier, just use the space bar.

Alt text

Programmable sensors

On any rail you can install a sensor if you want things to happen when a train passes over it, e.g. change a turnout, decelerate the train, change the state of a traffic light, etc. LeTrain's mini programming language is super simple, you won't have to learn almost anything. Alt text

Saving the status

You can save the LeTrain status in a file at any time. You can also save the sensor programming in another file. The latter is a simple plain text file, which you can edit with your favorite editor or with the basic LeTrain editor. Alt text

Zoom

You can use the console zoom keys to see more or less scenery when you need it. They are usually assigned to ctrl-+ and ctrl--. You can also use the PgUp and PgDown keys to move up and down pages or ctrl+PgUp or ctrl+PgDown to move across pages horizontally. It is easy to get lost, to go back just switch to "drive" mode and select with the arrows the next or previous locomotive. The same with crossovers, stations, sensors, etc. You can also select objects by their number, just type the number and the object will be selected.

Zoom

Train crash

In effect: if two trains approach each other at a speed greater than 1, a catastrophe will occur. You will lose the money you have spent to create them. The money is the number at the bottom right of the menu. It decreases when trains move, and when tracks are built. It increases when trains pick up passengers at stations. Alt text

For more examples, please refer to the Documentation

(back to top)

Roadmap

There are many things to do, but for the moment it works.

  • Add sound
  • Add freight trains
  • Add cities
  • Add missions
  • Improve gameplay
  • Improve menu
  • User manual
  • Much more

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Antonio Vazquez Araujo

Twitter/X - @avaraujo

GMail - [email protected]

Project Link: https://github.com/antoniovazquezaraujo/letrain

(back to top)

letrain's People

Contributors

antoniovazquezaraujo avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

letrain's Issues

Create freight trains

Now we have only passenger wagons and only passenger stations.
It can be interesting to create freight wagons, with different types of cargo and diferent type of stations.

Create cities

We have only 3 levels in the map: ground, water and rock. To add cities we need a second pass in the Perlin noise generator, to create it inside the ground parts only.
This can be interesting to create missions or to rise the prices of tickets between two far cities.

Add sound

The sound is the most important element to create inmersion.
Can be done but we need hight quality sounds of different machines, at different speeds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.