A coder's life

  • Archive
  • RSS
  • Ask me anything

Projects update

As I stated in a previous post, I’m working on a certain number of personal projects:

  • A webshop for my wife: the first non public release had been made so that she can try the backoffice (I highly recommend the constellation back office template).
  • a new CMS engine (which has an amazing template approach): for now this one has a low priority, because well, you need to set priorities and I only have a couple hours per day.
  • A Unity 3D game: actually, that would be more “a dozen games”: progress have slowed down due to other projects, but it still an active project.

I also reprioritized one and added another:

  • Finishing the client to make updates of my photo gallery more easy: the WPF client has ~65% of the features in already, but was disconnected from the website. It means that once the files was generated I had to manually upload them to the server. The next release should be connected to a WCF service to retrieve and send files, and add a few features that prevents me from posting more pictures. The UI is still ugly, but I’ll fix that when the features are done.
  • Fun stuff with Gadgeteer, and probably video tutorials. I actually shot the first 2 ones, but I’m not happy with the result, even if the content is good. That’s because I’d want to do it in french and in english, but then the voice over doesn’t seem good enough so far.
    • #csharp
    • #WPF
    • #Gadgeteer
  • 1 month ago
  • Permalink
  • Share
    Tweet

Gadgeteer

Just got my gadgeteer from GHI today. Tried this simple tutorial that was more insightful and accurate that the actual documentation, but otherwise I’m pretty happy with my purchase. Now I’ll need to find stuff to do with it !

    • #.net
    • #MicroFramework
    • #Gadgeteer
  • 1 month ago
  • Permalink
  • Share
    Tweet

First thoughts on Windows 8

When I saw the first time windows 8 I had some concern with it. The actual term I used (in french) is “le cul entre deux chaises” which translate loosely to “having his ass between two chairs” and the closest expression in english I came up with would be that it’s falling between two stools.

Because it fail its mission as a UI.

Now don’t get me wrong. I have a Windows Phone and I love metro. On one PC application I’m doing losely I even thought about doing it metro style, so I think that there’s a place for this kind of applications on the desktop.

Also, I think that metro will be amazing on any windows tablet.

(

Actually, my next tablet could be one under windows 8. So far I have an iPad first generation. I’m not a big Apple fan, but their products are awesome, but I feel constrained by their limitations. When Apple did the iPad 2, I didn’t felt the need to change mine (that I acquired only a couple of months before). I was pretty sure that I was going to take the iPad 3 the new iPad. But seriously Apple ? WTF ? “It’s a resolution ! We have a bigger screen, a different processor, and new version of apps”. If you guys were willing to confirm that when Steve Jobs died, Apple died, we got the message loud and clear now. RIP. The iPad 2 was somehow disapointing, the iPhone 4GS a big joke, and he new iPad seems just there to give a chance to Android and Microsoft to sell tablets for a while.

)

But Windows 8 on a desktop suffers a lots of flaws :

  • Starting on the Metro interface could be a good idea for the average user. But a lot of power users or companies will feel that it’s a big lose of time as their first click will be to launch the desktop
  • Removing the start button. Come on guys, I’ve never been the ultimate fan of the button and the menu, but we’ve been using that for ages, and now you remove it ? To force us to get back to the metro, to switch back to the desktop ? Are you nuts ?
  • Metro interface don’t work with “small” displays. Just stupid.
  • Two version of IE ? Really ? Why would I even want a mobile version of IE on my desktop (I’m not even entering the discussion of “why would I want to use IE at all on purpose). On a range of 1 to 10 of idiot decision, I’d set it to somewhere near 12.
  • Changing the settings of mobile IE (the start page for exemple) ? Never found where you do it. Never found any settings for IE mobile actually (something pretty easy to do in WP)
  • The new way to switch between application seems actually a good idea (on the first hours of use) even if sometime it comes in the way of other buttons.

It also had a lot of good ideas but for now I’m really not convinced by it. When Windows 7 was available to preorder, I did it without an hesitation (I even took the ultimate version). For W8, I’m not even sure that I will ever take it for a desktop. Unless there’s a way to disable the metro interface or make it optional in the first place. I’m happy with the tiles of my phone, it’s even a great idea, but on my desktop I don’t care.

  • 2 months ago
  • Permalink
  • Share
    Tweet

Turn based system

On the turn based game I’m making with Unity3D, it’s probably how the various part are supposed to communicate one with the other or how to handle the flow of the game :

  • A new game starts, the map is displayed
  • Deployement phase:
    1. The position of the base is choosed by the player
    2. Then the eventual buildings he has around that base
    3. Then the vehicules around those buildings.
  • Movement Phase
  • Attack Phase
  • End of turn
  • Next player starts at the deployement phase

Every phase has specific GUI, interaction, possibilities and so on. Also, for the deployement phase, the first two (base and buildings) are only done once, in the first turn of each player.

Oh and did I forgot to mention that I want to support hot seat as well as remote play ?

The first try at this was really ugly. I mean really really really really really really really ugly.

Then I tried to produce code as clean as I produce on an average work day. And I broke my teeth on some of the constraints that Unity 3D has.

So right now, I’m trying to overcome those constraints while keeping a code as clean as possible. I’m feeling that I’m onto something and will elaborate more on that in a future post.

    • #Unity 3D
    • #Turn Based
    • #Strategy
  • 2 months ago
  • 1
  • Permalink
  • Share
    Tweet

Training follow up

So, after thinking a bit about it, I finally ended up doign the first part of the training as a big “code together” session (see previous post). It look like it was a good session, everybody seemed to enjoy it.

I had set up a small scenario, stating that I was commissioned to do a module that does really basic timesheet reporting, but as I had suffered a recent head trauma, I was not able to code anymore, and they needed to finish what I started. I was only there to type what they would dictate me. Then, once the first version was done, we would have 3 minor upgrades of the module to add new functionality.

I had a solution set up, with a class library where they would do the code, and a simple website that would consume that library. They were free to change anything in my solution if they felt it was needed.

I told them that it was just a way for me to create an exemple that they will all understand, which was a blatant lie as the solution had already a few Object misconception that would lead to ulterior pain when dealing with the module evolutions. I also had to trick them into leading them to make the wrong decision a few time (based on previous experiences they had).

The fun thing is that they actually spotted a few, but decided not to correct them because of the time it would take. They choosed to be Lazy<Developer> (insert drumroll here). Which was perfect (in a sense) because I had the next part introduction basicaly stating that it doesn’t matter how awesome your coding skills are, if you’re lazy, you’re not a good developer.

Also, they did even better that I was hoping for, as they managed to do the last part, which I planned initialy to only oversee.

The next session is thursday and we will take the solution back and see how we should have improved it over time, instead of letting it rot.

    • #csharp
    • #work
    • #training
    • #SOLID
    • #OOP
  • 2 months ago
  • Permalink
  • Share
    Tweet

Trainings

At work, our team of developers come from various backgrounds (c++ to flash). A few learned to code at school while others learned by themselves. We use two languages : action script and C#. As the technical expert for .net, my work also entails trainings for them. So far I’ve been doing on the average one training per month on various .net topics, but the more I looked at their code, I realized that I needed to take a step back and do a big training on the fundamentals of OOP. 

It will be at least a 3 part training and the first one mainly covers SOLID (with a few digressions). For the Dependency Inversion part, I as preparing a demo application to show them how DI helps to make it evolve, even if directions we could not forsee at the beginning.

To make it even more speakful, I started coding it like they probably would (I’m basicaly copy/pasting and adapting chunks of their current projects). At first that was painful, because the more I added, the more I was looking at how unmaintenable that would be, and how painful the evolution would be. And then at some point, it started to get fun, because I started to add sneaky SOLID violations  everywhere I could. I’m planning to use that as a “fun quizz” and ask them to find all they can for the next training, and the one that found the most (minus errors) will win a little something fun. 

But now, I’m even starting to wonder if the first part should not be a big “coding together session” to let them make those mistakes, instead of supposing they would. It would even help mitigating the errors across the whole team and avoiding that someone feels blamed or ashamed by an idea (which is not the point). 

    • #Csharp
    • #SOLID
    • #OOP
    • #Training
    • #Work
  • 2 months ago
  • Permalink
  • Share
    Tweet

Friday we were talking with coworkers about our extra professional projects. The discussion was going on and on, and at some point I said something like “what makes me laugh is those young kids who never coded in their life and the first game they want to do is a MMORPG”.

One of the guys at the table said “actually, that’s how I learned to code, trying to do a MMO”.

It made me realized that I got old. Physically, sure, but intellectually too. I forgot how it was to be young(er, I’m not that old), and start doing things without asking questions like “am I able to do it” or “will I have the time”. And the more I thought about it, the more I realized that trying to code a MMO would have been something I could have tried a few years ago.

So now I’m trying to keep that in mind and keep the “let’s do it” spirit around.

  • 2 months ago
  • Permalink
  • Share
    Tweet
Funny how I don’t like javascript but really like JSON.
  • 3 months ago
  • Permalink
  • Share
    Tweet

Hex tile map generation

For the game, I want to be able to generate random maps worth playing. Many games offer that feature and it seems kind of natural, but when you start thinking about how to do it, you start realizing that it’s anything but trivial.

I’ve been looking on the net if I someone came up with something worth trying and it seems that Amit has already been doing most of the work for me. I’ll just need to figure a way to convert the generated map to something more hexagonal, or simply start with hex tiles instead of Voronoi polygons.

  • 3 months ago
  • Permalink
  • Share
    Tweet

Hex tiles A* pathfinding

Didn’t had a lot of time to get on with the game this week but between yesterday night and this morning, I managed to have the basic skeleton of the pathfinding working. If you’re looking to implement your own, you should have a link at Polyalamanac’s tutorial which cover the whole logic of it, and also check Amit’s numerous posts on the topic.

The theory behind it is quite simple really, but I found that the implementation is a bit less immediate to do. Anyway, here is (in pseudo code) what mine looks like:

void SolvePathfinding()
{
	var Open = new List();
	var Close = new List();

	// initialize your nodes here
	var startNode = GetStartingNode();
	var endNode = GetEndingNode();
	
	// add the starting node to the open list
	Open.Add(starNode);
	
	startNode.G = ComputeH(startNode, endNode);
	startNode.H = 0;
	startNode.F = startNode.G + startNode.H;
	
	// we continue while we have still nodes in the open list
	while(Open.Any())
	{
		// take the first lowest node of the open list
		var n = FindLowestFNode(Open);
		// and move it to the closed list
		Open.Remove(n);
		Close.Add(n);
		
		// if n == endNode, we found a path
		if(n == endNode) { return; }
		
		// look into each neighbours 
		// we suppose here that the neighbours have been set already
		foreach (var n1 in n.Neighbours)
		{
			// Parent will help you find the proper path
			n1.Parent = n;
			// compute the H, G, F values, from the current neighbour to the end node
			n1.H = ComputeH(n1, endNode);
			// note that you have to add the previous G value. It will help the pathfinding
			// figure if a tile's cost is lower from an other direction
			n1.G = n.G + ComputeG();
			n1.F = n1.G + n1.H;
			
			// if the current neighbour is in the open list, let's check if this one is a
			// better one
			if(Open.Contains(n1))
			{
				var n1Open = Open.FirstOrDefault ();
				if(n1Open.F <= n1.F)
				{
					continue;
				
				}
			}
			
			// if the current neighbour is in the close list, let's check if this one is a
			// better one
			if(Close.Contains(n1))
			{
				var n1Close = Close.FirstOrDefault ();
				if(n1Close.F <= n1.F)
				{
					continue;
				
				}
			}
			
			// if we're here, it means that this neighbour is the best one
			Open.Remove(n1);
			Close.Remove(n1);
			
			Open.Add(n1);
		}
	}
}

class Node
{
	public int F;
	public int G;
	public int H;
	public Node Parent;
	public List Neighbours = new List();

}

It took me some time to realize that this algorithm was not linear : the last best node we found in the neighbours will not necesseraly be the next node we look into. Also, note that F, G, H are not permanent values for a given pathfinding.

They can evolve and change every iteration, if it allows a better path : 

In this exemple, we are going from {2,1} to {0,3}. At the beginning {1,1} and {2,2} have equal potential so, on the second iteration the first one (my tiles are looked in a clockwise fashion, starting at the lower left side) selected is {1,1}. But on the third iteration, the system realised that {2,2} was the next best tile and that it didn’t need anymore to get through {1,1}.

I’ll have to run some more tests to make sure that everything works perfectly, especially if for some reasons the path through {2,2} ends up a bad solution, the correct path through {1,1} is properly restored. But for now, it will be enough to proceed to the next phase, having the turn based system and units moving.

    • #Astar
    • #Pathfinding
    • #Unity3D
    • #csharp
  • 3 months ago
  • 2
  • Permalink
  • Share
    Tweet
← Newer • Older →
Page 1 of 3

About

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr