The Tequila Den

Combines the world of Tequila with Games.

Tag Archives: latenight

Bug squashing

So I thought I had the longest road figured out, but then came the errors. So I had re-insert all the logging code and try and narrow down the problem. I found out I was adding unnecessary spaces in my ‘lone ranger’ segments. I wasn’t splicing out the proper road in my collection therefore it tried to reference a dead road. Which leads to an error of course. I later found out, through more game testing, that I limited roads too much by opposing forces. Both cases have been fixed anyways.

So I’ve been working on something new. Don’t panic. It’s not an entirely new project. It is CCCCC related. It’s simply a map maker for the game. So far you start with a blank map and can place all the tiles on the map wherever you see fit. Of course you can’t save or load and it isn’t importable ready.

screenshot 2013.11.15 20.48.55.0546

Longest Road (EVER)

I think I actually got it. What a bitch.

It was a nightmare. I knew it wasn’t going to be easy, but when I first started planning for it, I was honestly stumped. I pieced together the eventual formula, but it took a lot of brain juice.

I’ll break it down. First off, I copy an array of all the roads the player has. Then from that array, I separate all the roads into single segments. What that means is that it is a list of roads that only have a single path. Of course these road segments could be longer when the roads have multiple branches and directions, but this is the simplest form. The roads are all accounted for in this instance. After this, I cycle back through all the segments matching them with other segments and creating new segments. This creates a list of all possible road paths (through all possible branches). This creates a longest road. Although, there’s a catch. Road length can be intercepted by opposing settlements, thus, there’s another check these completed segments must go through. I kept tabs on the ends of the roads throughout the process, so all I did now was cycle through the completed segments catching to see if an ‘enemy’ settlement was blocking, keeping track of the length. At the end, the longest length recorded and returned. Ta-da.

Clear sailing ahead!

Oh fuck, I forgot about ports again. Son of a …

Actually updated yesterday, but today is a new day.

Yesterday, if anyone has actually snooped around (which I don’t think anyone visits,) you would have noticed that I placed a couple of new screenshots in the CCCCC page. One of the images was one that I made simply as a debugging tool, just a few lines of simple code to place the numeric references I use on the map in their proper location. I use that as a means of creating certain algorithms in the game.

Now, however, I’ve been dealing with the longest road. This no doubly has been the biggest pain in my head. And ass. I’ve wasted countless sheets of paper trying to devise the best possible way to go about, but right now, to no avail. This kind of reminds me of doing Canasta’s AI and thought process. It reminds me that this is going to be a headache. Damn.

I’ve actually reached out to Google a few times but their methods don’t make a much of sense to me. They’re all geared towards crazy geek-Dom (I’m thinking C talk, methods). I do not comprehend any of that. I’m not sure how to do the methods they talk about in JavaScript, and honestly, I don’t want to look and learn either. (unless I unfortunately get to that point).

I’ve made lots of other bug fixes in the process. Everything else seems to be at par for now. We’ll see how this other ‘headache’ comes to be.

screenshot 2013.10.29 17.19.02.0328

screenshot 2013.10.30 18.37.51.0031

Cloudy Brain…

I think I’m getting older. The longer I work into the night sorting through code and trying to do “brain-teasing-tasks” I end up making minor mistakes. These mistakes are hard to decipher and take a long time to debug because in my head the code is correct and its (always) something wrong with the interpretation. But of course, I’m the one who is incorrect. I guess when it comes down to it I can’t add late at night.

Lesson learned: double check what you copy & paste from old code, usually the old shit is sometimes…. shit.

 

Fiddling…

I’ve spent the last day or so converting a lot of code to something cleaner and easier to maintain and add. Unfortunately I’m fearing I broke the bitch. I’m thinking its just simply the order in which I’m calling certain updates. I’m going to toy with the idea of adding in an existing hooklist (geek term for checklist), or I may be better off making one of my own. I’ll have to do some testing either way.

I couldn’t throw up the other pages lately, just been really busy with my buddy’s wedding which occurred Saturday, so I’m still recovering from a long week/weekend. I’ll be doing some work hopefully this week sometime.

Progresso?

I’ve been hammering away on Catan lately and I’ve finally accomplished some major steps. I once feared I had to hard-code a few things and manually enter in a lot of information. Thankfully however, I managed to squeeze out a nasty algorithm to do the work for me. To break it all down, you can choose a name, connect to a hosted game, receive the server generated board (randomly dispersed tiles), receive the numbered tiles (a late addition of having the 6’s & 8’s colored red), send/receive messages by pressing the ‘enter’ key to initiate and ‘enter’ again to send. All messages are colored coded to each player. You can now roll the dice to see who goes first, then starting with that player you can place your starting settlement with adjacent road. Continues til all players have placed their two settlements then the game starts. I’ll be working on distributing resources next.

Sorry no screens this time, maybe next time…. hopefully sooner than what, a month? Ooops.

Late Night Heroics…

Over the past couple of days I’ve worked on networking in Sphere. Needless to say, it’s been a big pain in the ass. I’m getting a bit better at it, but it’s definitely been a headache to say the least. I just really dislike how Sphere’s sockets are set up. It just seems to be repetitive to CreateByteArray’s then read back from them. I should just be able to send the information I want, and retrieve the information I want. Anyways…

I have got to the point where I run the server, it’ll wait til a client has made a connection, then it will transfer the board data from the server to the client. It’s kind of nifty at the moment. Unfortunately however, it doesn’t keep track of who is who, how many people are connected and well, anything really completely necessary. But hey, its a start. I’m exhausted and going to bed.