fredag 2 juni 2017

More Code

Writing a blog is like sharing a private diary with the entire world, but whatever, here goes. I feel like I did too little progress yesterday. I already had previously made spaghetti code from a bad game engine I was working on earlier. So I re-wrote a little bit in that engine and made it so that it created text files with a 20x15 array grid of numbers. I intend to use these text files for generating the gameplay maps.

If you wonder how a "map" text file look like, here’s a picture:

1 means brick wall.
0 means empty space.
2 means ladder.

This is one example of a map that I now easily can produce with my game engine.
If you wonder what U,D,L,R means, it is like so that I plan to connect these maps to other maps so I can have one big map of maps as one level, the letters will indicate what neighboring map is up (U), down (D), left (L), right (R). I'm not entirely sure how I will decide to implement this in my final solution but this is how it looks like now.

When I have made games in the past, I have mostly used the Model-View-Controller pattern. But after reading a book giving tips of game design patterns by Bob Nystrom I noticed that he didn’t seem to use that pattern. I can attest that MVC simplifies a lot when making many type of games. But as I started to suspect, real game developers don't always use this pattern. In the book I noticed that Bob Nystrom, some guy who has worked with game development for 8 years didn’t mention MVC at all. Contrary, he showed code examples breaking the holy laws of MVC... So now I try to act like the professionals by not entirely using MVC in my game. I’m not sure if this is going to be beneficial in the long run but it already feels quite different. Sometimes for the good and sometimes for the worse.

The rationale behind not using MVC is that the logic in game is much higher coupled to what happens in the view. I guess this ought to be true in some cases. However, I have decided to cheat; I am not going to use MVC in my game, but I will pretend that I am using the pattern as much as possible. Unless I get to cases where I may need to break MVC in order to follow in Bobs footsteps, I will try not to. 

Inga kommentarer:

Skicka en kommentar