VS2015 and libtcod Part 1 – Installing all the necessary software

For this tutorial, I’m going to assume that you just spun up a fresh install of Windows and you don’t have your standard cache of programming software already installed. On top of that, for some reason, none of the bookmarks you generally use are working and your memory regarding software on the internet is completely gone.

-OR-

Like me, you just need a step-by-step guide to getting up and running. This will be written for a computer savy individual who may or may not  be a programmer or even familiar with these applications.

First things first, Microsoft has made a pretty cool move in the last year or so and made available for free the (In My Humble Opinion) best C++ IDE.

Visual Studio can be downloaded here or just google it.

Visual Studio Download

Click the purple link “Download Community Free”.

One that’s done downloading, go ahead and run it.

The most important part of the installation of VS2015 is that the forgot to include c++ as one of the default languages when the build the installer so if you use all the defaults, you don’t get it.

When you get to this screen:

Visual Studio Installation Question 1

Select “Custom” and hit “Next”.

Everyone’s different but here’s what I selected:

Visual Studio Installation Custom Options

I intend to use GitHub to host and share this project and if you want to keep changes to your project straight, I do would definitely recommend you do so as well.

Again, hit “Next”, and then “Install”.

At this point, it downloads and installs the options you’ve selected. The installation should take about as much time as it would take to attempt to break a world record. Here’s a link to get you started.

Once you’ve done that, come back and we’ll move on to the next piece. Ok, it’s not that bad but it does take over an hour.

Lukily we can continue onto the next step before the installation completes: Downloading the library.

“But Max…”, you might be saying. “Shouldn’t be building from source?”. To that I say… The code is here. See you in a bit.

libtcod was originally created as “the function library built for the Chronicles of Doryen.

The downloads page  can be found here. I grabbed a version labeled Windows/Visual Studio 2010 C/C++/python. Which we may need to adapt to Visual Studio 2015 but that should be too hard.

The base path for my project will be the folder C:\Projects, I recommend you do that same if you want the copy/pasting to work.

Extract your download to the folder C:\Projects\libtcod-1.5.1. I’ve kept the version number in the folder name because I may want to check out a different version of the library simultaneously.

At this point. Let’s flash forward in time and assume your installation  of Visual Studio is finished. Let’s fire it up and get a new project going.

Wait… first we have to talk about the account that needs created in order to access all your developer services. Don’t.

Look for a tiny link to skip past it.Skip Developer Services

The next thing it will ask for is your color theme. I picked Blue (the default). Again, to each his own.

The next step takes another longish while that just says “We’re preparing” for some such nonsense. Once it’s done, Let’s jump right in.

Make a new blank project by going to File -> New -> Project.

Here are the settings I used to create an empty blank project:

New Project Part 1

Let’s add our first file “main.cpp” by right-clicking on “Source Files in the Solution Explorer and selecting add -> new item.

Rename it to main.cpp

Copy the following text into the new window.

1
2
3
4
5
int main(void)
{
 
	return 0;
}

Run the code (F5 key) to be sure everything up to this point works.

if you get the following message; For God’s Sake click “Do not show this dialog again” before clicking Yes. It should take a few seconds to compile and link before it pops up a little window which will immediately close.

This is good.

Now let’s bring in the library.

In Solution explorer, right-click the project (In my case, Part1) and select properties.

Under Configuration Properties -> VC++ Directories append your library directory (C:\Projects\libtcod-1.5.1) to the following sections:

  • Include Directories: add the “include” folder
  • Library Directories: add the “lib” folder
  • Source Directories: add the “src” folder

Still under Configuration Properties, select Linker -> General and add the “lib” and the root folder of the library to Additional Library Directories. Then click OK.

Additional Library Directories

Also under Linker, select Input, and add “libtcod-VS.lib” to the Additional Dependencies row.

This is all that is necessary to compile and link the code. However, because the library is a dynamic library, it also needs to live in the same folder as the executable.

Copy the following files from the library folder into your Debug path (C:\Projects\Roguelike\Debug):

  • libtcod-VS.dll
  • SDL.dll
  • zlib1.dll
  • terminal.png

Additionally, the software requires the default font in the same location as the source files. So move the same “terminal.png” file to C:\Projects\Roguelike\Part1.

1
2
3
4
5
6
7
8
9
10
11
#include "libtcod.hpp"
 
int main(void)
{
	TCODConsole::initRoot(80,50, "VS2015 and libtcod tutorial");
	TCODConsole::root->printEx(40, 25, TCOD_BKGND_NONE, TCOD_CENTER, "Hello world");
	TCODConsole::flush();
	TCODConsole::waitForKeypress(true);
 
	return 0;
}

Running the new code (F5) should show you a screen like the following:

Hello World

If you don’t get that screen, I’d go back to where you added the library. Ensure you follow EVERY step correctly. Also check that you moved 4 files into the debug folder and the terminal.png to the source code folder.

That’s all for now, I’m going to go and make myself a game.

I’ll be following this tutorial starting on Step 5 with the First Program. I recommend you do the same.

Thanks for reading, feel free to comment, and let me know if you have any issues.

Libtcod with Visual Studio 2015 Community Edition

I decided a while back that I’d really like to make a video game.

Doing so is a great way to practice programming techniques that I don’t get to use in my real job.

At my brother’s suggestion, I agreed that we should make a Rougelike. For those not familiar with the term, take a quick read here and then come back. I’ll wait.

Did you read it…? Did you then crawl all over that site reading all the other articles before coming back? Good, you are my target audience.

So after reading around for a bit and not finding what I wanted, I decided to write a tutorial for using Visual Studio 2015 Community edition and libtocd (The Doryen Library) to make an ascii rogue like.

The  biggest issue I’ve run into is up to date docs and tutorials. Because of this, and since I need to do the work anyway, I’ll try to document my process as I go and correct the steps as I find them.

Keep  out on this blog and I’ll try to keep it updated as time allows.

Thanks and happy coding.

Home sweet home

Since I purchased Jarvis early 2014, I’ve had it sitting on the box it came in, on a shelf in my office.

image

Yesterday, I finally decided that enough was enough, took Eminem’s advice and began cleaning out my closet. The closet has been the planned home for the server but I never gave it the time it needed.

I wanted to use the existing shelf crossbars but had to remove the shelf to make room for the front of the server. I then mounted the 2U vertical rack I bought a year ago.

wpid-wp-1422943712364.jpeg

Everything looked good and the rack is rated for like 300 pounds.

I brought down the server because it needed to rotate from horizontal to vertical and I didn’t want to risk losing a drive.

wpid-wp-1422943854589.jpeg

Everything looks great good enough. I performed zero cable management because I ran out of time so I’ll get it next time.

For you eagle eyed readers out there, I did hang my little 8 port netgear switch up above the server. What you can’t see is that I did it using thumb tacks because I’m crafty 🙂

Die notepad, die

Oh notepad, you’ve been a good friend. You been with me since the beginning. You were my first HTML editor, my quick note taking app, and the go to place for editing .ini files in windows 98 to make games work.

Now though, it’s time for you to go.

I’ve chosen to replace the notepad application with notepad++ and it’s super easy.

If you aren’t familiar with notepad++, I recommend you take a look.

The executable can be found in three places

  • C:\Windows
  • C:\Windows\System32
  • C:\Windows\SysWOW64 (64-bit versions only, obviously)

I just went into the three folders, changed myself to the owner of the file, gave myself full permissions and blew them away. I then copied the notepad++ executable into the three locations and rename it from notepad++.exe to notepad.exe.

It also needed one of it’s support DLLs, SciLexer.dll, so I copied that in as well.

I’m interested to see how things will go. I’ll update this when I’ve had a chance to use the system this way for a while.

Windows 10 Review Part 2: First impressions

First impressions being what they are, I am neither blown away nor disappointed. Now, I’m going to start playing with it.

On the laptop I’m using, I installed the OS without a network cable plugged in. Because there was no connection to grab drivers for the wireless, it showed up in device manager as an unknown device. What did surprise me was as soon as I connected a network cable, it ran out and grabbed the drivers for the WiFi card, installed them and presented me with the “what do you want to connect to…” screen without me really doing anything. That was cool.

While that was going on, I was sitting over on the VM trying to figure out where Windows Update was since most everything is moved around. I haven’t really had any interaction with Windows 8 so maybe everything is in the same place and Win8 users would have no trouble finding stuff.

For the record, I had to click on the Start button (windows button, I don’t know what it’s called), click PC settings, Update and recovery, Windows Update… and we’re there.

The next thing I tried was a little file sharing. Here at work, our file server’s name is stability. I used Win+R to pop open the run dialog, typed ‘cmd’ to drop to a command line (which has a new font, looks more like a Linux terminal) and typed ping stability. Viola, Reply from stability.

So far so good.

Win+R again… \\stability… nope, odd

Win+R again… \\10.10.10.4… nope, network path not found? what?

Odd again

I should probably stop and mention that they’ve incorporated the “ribbon” that we first saw in Microsoft Office a couple of versions ago into Windows Explorer. So now you can pin things to the title bar like in office. That being said, the two items pinned by default were Properties (like Alt-Enter) and New Folder. That’s cool, note to self, you need to play with this more.

After farting around for a little bit, I stumbled onto the Network and Sharing center. First thing I noticed was that I was joined to a HomeGroup. Since I live in fear of things I don’t understand, I left the group.

Win+R again… \\10.10.10.4… Still no dice. *sniff* *sniff*, smells like a challenge to me.

Again, I’m going to stop and mention that I’ve restarted my VM a few times doing stuff and the login process takes what I feel like is way too long. The counterpoint to that though is, once the logon has been performed, there’s no delay while stuff loads. Maybe it’s just a new PC but it’s just on.

Also, command line has paste now. I now that doesn’t sounds as awesome as it should but it is. It’s pretty freaking awesome.

The start menu has changed pretty substantially as well, it uses the same “tile” concept as windows 8 and you can just start typing to begin a search. I was looking for networking and typed just that and there it was at the top of the search results. Also pretty cool.

So after digging around a bit the consensus is that Win10 and Samba aren’t really friendly to each other at this point but there’s talk about it being in one of the next few releases.

Guess I’ll table this issue until then.

That’s enough for me for today. In the next article, I’ll talk about whatever I stumble over next.

Windows 10 Review Part 1: Installation

I was handed a copy of the Windows 10 Technical Preview (build 9841 for those who care) and wanted to check it out. I had a spare laptop sitting around so I decided to put it on there. The laptop is a Dell Inspiron 9300 (yes I know, old). I also opted to install it in a VM so that I could do things like take screenshots and what not. A little added bonus, the laptop was 32-bit so I was forced to use that version on there but use the 64-bit on the VM.

Installation went off without a hitch, I blew away the existing partitions on the 100 Gb laptop hard drive and let windows do it’s thing. It took about 20 minutes but I didn’t time it so that’s a rough estimate.

Right away, it asked if I wanted to use the default settings or customize. I picked customize because that’s what I do and was presented with a number of screens asking all the usual questions like can we auto-update, is it cool to have the firewall on, all that. The last of in the line of questioning was a little bit odd. Windows was asking if it could use some identification information to track ads and recommendations. I said no but I’m thinking I might re-enable later.

Windows 10 Sharing Info

After that, and this only happened on the VM because it had a network connection, it asked me to login using my Microsoft Account. I obliged and it sent an email to my account with a confirmation code. Next, and again because I had a network connection, it asked if I wanted to connect my OneDrive. I opted to go ahead and do it since I had a feeling it would smoothly integrate.

That was the last of the questions and it went into the usual installing process of waiting while it setup the last few things while changing the text on the screen and morphing the background color across the spectrum.

Windows 10 installation

Well, that’s it for the installations steps, if you are following along, you might have a screen similar to this one:

Windows 10 Almost ready

In the next article, I’ll spend some time before hand using the OS and gathering some thoughts.

Configuring a frontend client for the Pi

I work at Crystalfontz America, Inc. and as such have access to all the latest and greatest hardware coming out of there.

As part of a push to get some exposure for our cool LCD displays, I was tasked with connecting one to a Raspberry Pi. Since I already had two at home running XBMC and was already familiar with the Pi. I thought this would be pretty quick.

I was however surprised at HOW quick it was. Apparently everything I wanted to do was already available and included (for the most part), it was faster and easier than I’d thought it would be.

What you are going to need:

What I like most about this process is the whole thing can be done by SSHing into the Pi, doing the configuration and then enabling it via the Pi’s configuration menu.

First thing I did was SSH into the Pi. I then installed lcdproc using apt-get. lcdproc is an independent software utility that we recommend pretty heavily to any Linux based customers.

sudo apt-get install lcdproc

I’m using a CFA735 but the process is mostly the same for any of the other Crystalfontz modules that I listed above.

I then did a ls -la /dev/tty* to get the device’s hardware address. A CFA735/CFA835 should show up as /dev/ttyACM* but the rest of the modules should show up as /dev/ttyUSB*.

I then edited the config file for LCDd

sudo pico /etc/LCDd.conf

The first thing to do is change the driver

Driver=CFontzPacket

Then, under [CFontzPacket], there are two settings to change

Model=635
Device=ttyACM0

With ttyACM0 being whatever device address you got from above. I’m choosing the 635 even though I’m using a 735 because the 735 and the 835 are both close enough in the command set that they don’t need their own configuration options, their command structure is purposely similar to the 635.

Then, restart the LCDd daemon and wait for XBMC to connect to it.

sudo service LCDd restart

Once the LCD shows the LCDproc is in control, jump over to the Pi and find the lcdproc add-on

Settings -> Add-ons -> Search -> lcdproc

The Add-on is called Services – XBMC LCDproc. Click that and click install. Once installed, reboot then pi (sudo shutdown -r now) with everything connected and it should pick it up once it’s booted.

You shouldn’t have to do anything else. It does take a minute for XMBC to connect but once it does, the LCD should show Clients: 1 (if it’s the only one) and then you are good to go.

See? Easier than you expected? It certainly was for me. The reason it’s so easy is because of the hardworking people at:

Without these fine people, this would have taken WAY too long.

Configuring Samba

I started installing samba from the repos like normal going on just memory and guessing alone which explains the waste of time.

sudo apt-get install samba

From the defaults, I edited the default config file /etc/samba/smbd.conf and made a few tweaks.

I set our workgoup appropriately:

workgroup = SUPERHEROES

I uncommented ‘usershare allow guests’ and set it to yes.

usershare allow guests = yes

I then moved the [homes] object (at the bottom of the file) including all of the parameters into a new folder: /etc/samba/shared.conf.

In that file, I uncommented the [homes] object

[homes]
 comment = Home Directories
 browseable = no
 read only = no

I also added a new single share that contains all the subfolders I wanted to share:

[Shared]
        comment = The Robergs' Shared Folder
        path = /data
        available = yes
        read only = no
        browseable = yes
        public = yes
        writable = yes
        guest ok = yes

I then added the following line to the end of the smb.conf

include = /etc/samba/shares.conf

I then issued a restart with:

sudo service smbd restart

to test it out, I navigated to \\jarvis\ from windows explorer and was presented with a nice empty window. Figuring that I’d done something wrong, I copied the other shares definitions from the old server, did another restart and to my surprise, they showed up. The only one still missing was the “homes” folder and that’s when I remembered, I hadn’t given any sort of user/pass while connecting so I was authenticating as a guest.

I’d previously had the P: Drive mapped to our homes folder on the server so I decided to disconnect that one and reconnect using the new server with new credentials making sure to specify the domain as jarvis. That didn’t work, though I could now see the “max” folder in the folder listing for Jarvis.

Viewing the logs, I saw an error from smbd/service.c saying “Can’t become connected user!” *facepalm, I forgot to setup the users in samba. 2 minutes of googling later:

sudo smbpasswd -a max

I refreshed the file explorer and viola, I could see and access all the files… or so I thought. Apparently, everything was read only. I checked and sure enough, I’d forgotten to change the default read only = yes to read only = no. Once that was fixed, samba was ready.

Jarvis and Plex Media Server

I decided to go with the name Jarvis for my new server after Holly suggested that we name all our hardware after super heroes. So the big server is Jarvis, our two Raspberry Pi are named Quicksilver and Scarlet Witch (get it? Twins). My new laptop is not named yet, I haven’t picked a new name for Optimus, and Holly hasn’t picked a name for her laptop yet but… oh well, it’s a good start.

So since the last post, I’ve installed Apache, Samba, and Plex Media server. Apache and Samba went off without a hitch but Plex was another story. After hunting around for a while, I finally remembered what I did last time to install Plex. There was a debian/ubuntu repository at one point but that was damaged or lost in some upgrade somewhere and it’s no longer relevant. Instead, according to everyone as I was googling around, the best way is to wget the most recent version from here and install it that way.

I basically followed these instructions, substituting for my version where appropriate.

  • wget https://downloads.plex.tv/plex-media-server/1.9.7.4460-a39b25852/plexmediaserver_1.9.7.4460-a39b25852_amd64.deb
  • sudo dpkg -i plexmediaserver_1.9.7.4460-a39b25852_amd64.deb

*EDIT*
I did have to re configure this a second time after a system update and forgot that I would need to go to

http://jarvis:32400/web/index.html#!/setup

to get the installer to recreate my libraries

That was it and Plex was up and running.

The next thing to do was configure Samba to match my previous setup.

Bad luck mixed with good

Here’s a recap of my progress so far.

When the new server arrived on Tuesday (2014-03-04), I was at home to meet the UPS guy since I’d taken the day off sick. I had been planning on it coming the next day so when UPS pulled up to the door, adrenaline started pumping and I got excited.

I opened the box but forgot to take pictures. (So much for my “unboxing”). I was glad to see that the seller had included two power cables as the server came with dual redundant power supplies and they both need plugged in. I was not quite so glad see that one of the provided cables was a right angle plug which couldn’t possibly fit… weird.

Once I’d swapped out the wrong cable for a correct one. I was ready to install the OS from my… oh that’s right, because I wasn’t planning on either a) being sick or b) the server showing up for another day, I’d forgotten to create an install disk. Oh, well 30 minutes later, ISO downloaded, disk created, OS installed. Hardware error. The front and back status light on the chassis were flashing red and throwing a number of errors, one of which was a PCIe error. Great, I got screwed. On top of all this, my adrenaline had worn off and I was crashing (remember I was sick). I decided to wrap it up for the day and just take it with me to work to play with it later.

On Monday, I took the server with me to work, opened it up, re-seated the PCIe cards, threw in my Ubuntu server disk and re-installed. I made sure this time that I’d selected the right filesystem (ext4) since it decided for me last time to install ext2 which was not what I wanted. Once it was done, there it sat until I had more time. I ended up taking it home Friday night (2014-03-14). It was basically a blank slate, the OS was about the only thing on there.. Next post, I’ll detail my installation progress and the steps I’m taking for the migration from Ironhide in the Autobots network to new my as of yet unnamed server on my new as of yet unnamed network.