Author Topic: Trade Route Generator (Trying to make a merchant game)  (Read 1401 times)

So to test my Javascript knowledge I decided to try making a Trade Route Generator in JSFiddle. It took around 2 hours to make but I feel like it turned out really well. Refresh the page and it will be totally different:

http://jsfiddle.net/qg45n5bc/49/embedded/result/


If you are curious:
Quote
Miles long: Random (15-800)
Travel speed: Random (1-4)
Days long: Miles long divided by travel speed rounded down
Rations needed: Days long * 2.5 rounded down
Cargo Value: Random (1-4)
Payoff: Miles long * Cargo Value + 1-200 + %5 per 100 miles
Coins Per Mile: Payoff divided by Miles long

UPDATE:
I've begun expanding this into a survive-until-bankrupt game. It gives you a choice of trade routes and you can only go on the ones that you have enough rations for. You are only able to buy a certain number of rations per turn. I'm also making it so that the longer the trade route is, the more of a coin bonus it gets.

This means longer = better (sound familiar?) but you have to save up on rations to travel it.
« Last Edit: January 10, 2015, 01:46:41 PM by McZealot »

Quote
Days long: Days long divided by travel speed rounded down
EH?!



You should make each ration cost something, and subtract the total price of them from the payoff.

Trade Route Generator by Zealot

Path: The Bandit-filled Path
From: South Korea To: Rus Empire
Length: 66 Miles
Travel Speed: Normal (35 miles per day)
Days Long: 1
Rations needed: 2
Cargo Value: Valuable
Payoff: 219 Coins
This comes to a total of: 3.32 Coins per Mile

kinda hoping it was a solution to the traveling salesman problem cuz that stuff is cool

Trade Route Generator by Zealot

Path: The Mountain Path
From: America To: The Incan Empire
Length: 421 Miles
Travel Speed: Very Slow (15 miles per day)
Days Long: 28
Rations needed: 70
Cargo Value: Valuable
Payoff: 1267 Coins
This comes to a total of: 3.01 Coins per Mile

Increased the possible miles from 500 to 800. I fixed some of the names too.

My original plan was to make a game where you pick trade routes trying to make the most money. Maybe I'll update this later, but I spent way too long working on this for now.

kinda hoping it was a solution to the traveling salesman problem cuz that stuff is cool
but it's proven that traveling salesman is NP complete

totally rich

Path: The Golden Path
From: China To: The Incan Empire
Length: 112 Miles
Travel Speed: Fast (45 miles per day)
Days Long: 2
Rations needed: 5
Cargo Value: Cheap
Payoff: 285 Coins
This comes to a total of: 2.54 Coins per Mile

but it's proven that traveling salesman is NP complete
ya and

the routes should really affect the payoff
like, taking goods through the bandit path or snow path would be more dangerous and therefore be more costly to transport

Trade Route Generator by Zealot

Path: The Silky Path
From: Italy To: Mordor
Length: 533 Miles
Travel Speed: Fast (45 miles per day)
Days Long: 11
Rations needed: 27
Cargo Value: Valuable
Payoff: 1643 Coins
This comes to a total of: 3.08 Coins per Mile

"Path: The Snowy Path
From: South Africa To: The Incan Empire"

i'm sceptical about that naming job