Ports are just names for now, but my intent was to allow for ports to 'favor' certain goods.Your IP address has been temporarily blocked due to a large number of HTTP requests. You can see the ports (yes, I diverted a bit from the old game), goods, and more. My store starts off with various constants that impact game play. Return Math.floor(Math.random() * (max - min)) + min //The maximum is exclusive and the minimum is inclusive Illegal=true means there is a chance it will be stolen Goods have a value range representing, generally, what they will sell for. For now ports just have names but I may add boosts later, like port "July", "August", "September", "October", "November", "December"] I'm going to break this up a bit instead of just pasting the entire thing. And since a random event could actually end the game for you, I've got some logic in there to move to the end view.įinally, let's take a look at the store. Normally this is done in one second, but if a random event happens I delay it to three seconds total so you have time to read what happened. The idea is that you enter this view but then move out automatically. The most interesting aspect of this is the setTimeout in created. if there was a special event, we need more time to read, and possibly end the game Let destinationIndex = this.$ ĭestinationIndex = this.$ You can see this in play in the layout for Game.vue. But if you want to buy something, I switch to another menu prompting you for an amount and good. So initially the state is - show the menu. My solution involved showing a menu based on the current 'state' of what you are doing. That "prompts for input" aspect is related to the keyboard. This can be one of - buying goods, selling goods, repairing damage, upgrading the ship, or moving to another port. But handling "special events" was definitely problematic. The core "turn to turn, buy, sell" etc logic wasn't too hard. This was - truly - the most difficult aspect of the entire game. First, I ask Vuex to consider random events.Each turn consists of the following logic. I think this particular aspect of Vue development is something that will change over the iteration of an application. I definitely think I have a few things in views that should not be there. As with my Lemonade Stand game, I spent a good amount of time thinking about what should go in my views versus what should go into the store. Finally there's a end of game route which shows your final stats. Next is a "travel" route which handles going from one port to another. Then the game route were most of the work is done. A "setup" route which just asks for your name. There's an home route which introduces you to the game. Taipan makes use of both Vue Router and Vuex. I'm not going to go over every single line, but rather talk about the more interesting bits (to me) at a high level. So before I get into the code, if you want to give it a try, you can play here:Īlright, so let's take a look at the code a bit. I didn't make everything keyboard accessible, but navigation from port to port can be done entirely by keyboard and while playing it felt like a really good setup. You can read about my work in that area here: Working with the Keyboard in your Vue App. I also tried to make use of the keyboard as much as possible. My game feels quite a bit more snappy and quick compared to the original which feeds into how I enjoyed playing it. That's pretty much it but there's a few other smaller mods as well. I also skipped making one of my goods illegal.To me this always felt like a distraction. I liked this aspect too and may eventually bring it back. I got rid of the 'shake down' aspect via Li Yuen.It's an interesting aspect, but it also slowed down the pace of the game when arriving at port. In my version, you can be attacked by pirates but they simply do damage and steal some goods. I liked the fact that it added risk to the game, but didn't like how it killed the pace. I hated the combat aspect of the game as it felt incredible slow. I didn't want an exact rebuild though and in my version I made a few changes. (Of course, once I found the money lender bug it became trivial to get rich.)Īs part of my basic "get more experience with Vue apps" goal this year, I decided to rebuild the game (to the best of my ability) using, of course, Vue.js. I'd play it for a few hours at night just to see how much money I could make. The game had basic combat, a money lender, and other details to make things interesting, but for me, my enjoyment came from pure grinding. You had a ship with storage capacity and would buy and sell goods across multiple ports. Taipan was a basic trade simulator based in the far east. I played many different games, but one of my favorite was Taipan!. As a young kid, I spent a hell of a lot of time on my Apple 2.
0 Comments
Leave a Reply. |