The Tequila Den

Combines the world of Tequila with Games.

Tag Archives: catan

Just putting about…

I’m getting there.

Slowly as all hell. I’m not entirely sure at the moment what is really killing my motivation. I don’t know if it was the final couple weeks of striving to get Traders (CATAN) out or if I’m still in a bit of indecision mode. I’m trying to conquer that with my 30 in 30 challenge I proposed myself, but to actually open the editor is becoming a struggle some days. Things need to be perfect for me, I have a little bit of OCD… Another issue is that I’m not by any means a pixel artist. I’m getting better at it but it is SLOW going. Lastly I think the biggest issue or real, noticeable progress is that I’m thinking I’m worrying about the games’ systems and how they all tie together and I want to make it whole and proper.

So that’s it… I’m torn between super planning everything, and just saying fuck it and start coding, if I have to re-write chunks, I re-write chunks. So here it comes, I’m going today’s portion of the challenge. I’m doing a hybrid of the two. I’m going to sit down on paper and chew out the details and what system I need and what it will/can tie into. This way I know what needs to stand alone and what needs to be nested with other portions of the game.

Any-who, back to the challenge… I owe seven game related material.
– I made dynamite
– I made a sabre/sword but energized weapon
– I made a shovel
– Inventory/game menu will be very similar to the original Legend of Zelda, including the transition to it.
– The library you first enter in the game is initially empty except for one book.
– The only person left in the bar is drunk and passed out
– The library now has a map in the editor and the floor is being decided.

So there you have it, another week of decisions. Hopefully next update will include a bit of game structure in it. 14/30…. might just run a marathon now! Ha…

Advertisements

Release Party!

Holy crap I finished something.

I’m proud to announce that 1.0 of Traders is up for grabs, here.

Some information:
– unzip the folder to desired location on your computer.
– locate file “config.exe”, run it. I recommend “standard32.dll” as that’s what I’ve developed/tested with.
– open up “engine.exe” and select “Server-Traders”. This is the server portion of the game, only one player needs to run the server. Once the server is ran, it’ll display an Address for the clients to connect to.
– For each player they need to run the “Client-Traders”. Logins are mandatory, however, a new account is simply made by logging in with a unique username and password, it accepts the password as is and creates an account, next time you try to play a new game, the password will have to match to use that id.
– game may not work with anything but Windows XP, I don’t have anything else to test with, so use caution as it may not function correctly.

Rules are not included in with the game as it is a fan game of Catan.

I have not gotten permission to release this game or the creation of this game. This game is not for sale nor is it closed sourced. Enjoy at your own risk.

Finally got it…

At least, I think I do. I thought I had it all figured out before hand, but then a bug came out. A nasty little bastard that basically crippled the damn game.

Okay, that’s a bit extreme. The game is fine without it, but the problem was though you wouldn’t be credited with your feat unless you kept building and hopefully it picked the right set, sigh. Yup, longest road issues struck again.

I scoured the crap out of my code and found a slight oversight. My first “correct” stab at the process had all the roads tied together with it’s only possibility. Thus, if a player does place all 15 of their roads. The code would flip through each road and see if it can find it’s little soul-mate. So essentially what I thought I created was a set of road segments that could only go together. The problem was that once you see that particular set from the other end, it’s a cheating bastard. So what I thought I had wasn’t what I had at all. Re-write time.

I googled and lou-oogled (hot tub time machine, great movie,) around the web about how people have been implementing Catan’s longest road and really I have seen a lot of forum/blog posts about the situation. None of which I’ve been able to successfully implemented in Javascript. They did however spark my brain and come up with a valuable solution to the issue at hand. The biggest issue I had with the process was how do I loop through the same set of roads twice, without repeating myself and going through a loop I have no idea how to stop or how many times it’d have to iterate as the list of possibilities grew exponentially as the amount of roads were being added. God forbid the player built “trees” and “circles” out of their roads. Headaches ensued.

The solution to world hunger… err…. finding the Longest Road in Catan, pseudo-style.

Take all roads and toss them into an array by themselves.
//roads[x] = the entire chain, r1,r2,r3 ; roads[x][y] = road in roads[x] in pos. y, r1.

Keep track of the ends of each of these roads, represented by settlement spots (which I refer to as corners) in an array that correlates to the roads’ array.
//ends[x][y] = x is equal to the x in roads, y = is the ‘left’ & ‘right’ of the roads’ x.

Set maxMisses to the amount of roads and misses to zero, and make to false.
//this is the control to see if a new chain of roads were created.

while (misses < maxMisses) Loop through all of the player’s roads. Loop through all the chains that were made. If the current road in the loop isn’t in the current chain, proceed, Now, if the current road links to the current chain and it’s not already in that chain,
– Clone the current chain along with the ends of that chain.
– Add the current road to the cloned chain  and update the new ‘ends’ of the chain, add to the database of chains.
– set make to true. end the loop of the chains.

If the make is false, misses++, otherwise it’s set back to zero. end all loops… That will give you all the possible set of chains for the given player’s roads. It amounts to a bunch of roads, many of which are duplicate of themselves. This is because of the starting points of the roads; do remember that we clone each time we add a new road. They can easily be filtered out afterwards by seeing if the length is greater than 4 (Catan rules), you can eliminate more if you’ve stored the current longest road.

You can always comment / email me if you’ve got questions about my implementation or if you want to see some code. (Warning, I’m not a pro-scripter by any means and some stuff is kind of messy, and not exactly ‘efficient’.) Next time, how to see if the chain has been interrupted by an opposing settlement/city.