Review: The Complete Software Developer’s Career Guide by John Sonmez

Screen Shot 2018-02-17 at 12.05.03

My impression reading this book (actually listening to it, since it was an audiobook) was: this book is an extended version of “Soft Skills: The Software Developer’s Life Manual”, Sonmez’s first book. If you don’t know John Sonmez let me give you a brief introduction about him: he is a software developer who decided to take his life to a new level. Long story short, he started as a programmer, then created a blog about programming and soft skills for programmers (https://simpleprogrammer.com), and developed as consultant, public speaker and now as an entrepreneur in the “soft skills for programmers” education business.

If you are a software engineer or a wannabe this is the book for you. It starts talking about how to become a software developer and how to get a job. Then it talks about what you need to know as a software developer from a technology perspective and later how to work as a developer (soft skills) and how to advance you career and the options you have. This is the perfect book if you don’t know what to do next.

Most professional developers already have a grasp about what technologies are available, what they need to learn technically and what paths for development there are. But this book goes beyond that, it goes over topics where most geeks don’t think about: how to dress, sell your ideas, deal with prejudice, create a reputation and much more. It doesn’t go that much deeper though, but enough to sparkle ideas and make you think, research more about it and apply it as you see fit.

For instance, he talks about job offers negotiation. Once you have received a job offer how do you negotiate to take the best out of it. Oh boy, if I had read this before my last job offer, my life would definitely be different by now.

This book is all about growth. Even if you are not an software developer you still can learn so much with it. One of the reasons I’m writing this review is precisely because the author emphasizes the importance of having a blog. Although I still haven’t found my niche, I realized I listen to about 1 or 2 audiobooks per week, and they have been helping me tremendously. If I just write about them I might help other people too. Therefore, this blog now has a new purpose: help people discover books that will help them. OK… this post has been going sideways now, but all this is just to explain one of the impacts this book has had on me. If you want to know other benefits that blogging provides you, read the book! šŸ˜‰

If you think the book may help you, buy it here:

The Complete Software Developer’s Career Guide: How to Learn Your Next Programming Language, Ace Your Programming Interview, and Land The Coding Job Of Your Dreams

Gustavo Carvalho

Dota 2 Bot Scripting API – Hello World!

SinceĀ the launch of Dota 2 version 7.00 (a few weeks ago) became possible to write custom bot using an official API provided by Valve. The problem is: the documentation is really bad. AFAIKĀ the only official information is thisĀ wiki pageĀ and the sub-forum on dev.dota2.com (but the community is growing strongly in reddit.com/r/dota2AI/). I’m not complaining though. They probably had to choose between launch the API with bad documentation or launch it later and I’m happy they launched it now. šŸ™‚

Okay! So, the first thing you need to know is that all files you are going to create haveĀ to be on folderĀ game/dota/scripts/vscripts/bots. Since I’m using a Mac, my complete path isĀ /Users/Gustavo/Library/Application Support/Steam/SteamApps/common/dota 2 beta/game/dota/scripts/vscripts/botsĀ but I believe on Windows it should be onĀ Program Files/SteamĀ or similar. On theĀ vscripts folder you will have a folder namedĀ bots_example but not one namedĀ bots, thenĀ just create it and add the following file (hero_selection.lua):

-- hero_selection.lua

-------------------------------------------------------------------------

function Think()

    if ( GetTeam() == TEAM_RADIANT ) then
        print( "selecting radiant" );
        SelectHero( 0, "npc_dota_hero_pudge" );
        SelectHero( 1, "npc_dota_hero_axe" );
        SelectHero( 2, "npc_dota_hero_bane" );
        SelectHero( 3, "npc_dota_hero_bloodseeker" );
        SelectHero( 4, "npc_dota_hero_crystal_maiden" );
    elseif ( GetTeam() == TEAM_DIRE ) then
        print( "selecting dire" );
        SelectHero( 5, "npc_dota_hero_drow_ranger" );
        SelectHero( 6, "npc_dota_hero_earthshaker" );
        SelectHero( 7, "npc_dota_hero_juggernaut" );
        SelectHero( 8, "npc_dota_hero_mirana" );
        SelectHero( 9, "npc_dota_hero_nevermore" );
    end

end

-------------------------------------------------------------------------

If you are new to Lua scripting language I recommend this quick tutorial. As you can imagine, this file will be used for heroes selection. This one is pretty simple. It just picks the very same team every time. It will even pick your (not bot) hero. In this file you can create complex logics to pick counters and heroes that works good with others, but for now this is enough. Let’s see if everything is fine so far? To test it just open your Dota 2 game, go to Play Dota -> Create Lobby and then Edit on Lobby Settings. Make sure your Server Location is set to Local Host, fill empty slots with bots is marked and both Radiant Bots and Dire bots are set to Local dev script:

screen-shot-2016-12-30-at-21-04-17

Start the game and all heroes should be selected automatically. You can try to change the name of the picks or remove the SelectHero(0… so you can handpick your hero (supposing you are playing on first slot in radiant). Now, someone might ask: “Wait a minute! If my bots folder has only the script to pick the heroes, how can it be that they are playing by themself even though I haven’t a script to tell them what to do?” Well, in fact you don’t have scripts for anyĀ custom behavior, therefore, on their absence, all bots fallback to a default implementation.

Now you can run your own scripts, let’s start to actually modify the behavior of the bots.Ā You can create custom behaviors in 2 ways: by completely taking control over bots individuallyĀ or by overriding specific behaviors and/or decision-making to be used by the default system. In the former you are responsible for each and every action of the bot but in the latter you can override just some parts and leave the default behavior for everything else. Since I’m starting to learn, I decided to begin by taking over control of a specific but and just move him around to make sure I get familiar with syntax, some functions and etc.

In order to completely control a bot, you just need to have a file namedĀ bot_NAME.lua with a function Think(). For my bot, all I did was to make him run in circles around the fountain. Here is the code:

-- bot_axe.lua

--------------------------------------------------------------------------------

local fountainLocation = Vector(-5923.0, -5337.0, 384.0);
local fountainRadius = 400.0;

--------------------------------------------------------------------------------

function Think()

	local npcBot = GetBot();

	local angle = math.rad(math.fmod(npcBot:GetFacing()+30, 360)); -- Calculate next position's angle
	local newLocation = Vector(fountainLocation.x+fountainRadius*math.cos(angle), fountainLocation.y+fountainRadius*math.sin(angle), fountainLocation.z);
	npcBot:Action_MoveToLocation(newLocation);
	DebugDrawLine(fountainLocation, newLocation, 255, 0, 0);

end

--------------------------------------------------------------------------------

I won’t go through all the math here but basically what this code does is: at every frame, it gets a reference for the current bot (GetBot), calculate the angle with origin in the fountain for the next location based on what angle the bot is facing (local angle), calculate the location he should go (local newLocation) and then gives the action to move (npcBot:Action_MoveToLocation(newLocation)). Since the bot will walk around the fountain, he will always change his angle and thus the location he needs to go. I also draw a debug line to visually see where is the next location the bot is trying to go. But be aware, as you move your camera the debug line moves in a weird way that I don’t understand yet.

Run your custom game and Axe should be running non-stop around the Radiant’s Fountain. And that is it for now. You can find these files on my repository. Next, I will try to make a new bot playable (maybe Pudge…?)