lördag 22 februari 2020

Connect 4 Forever

Okay so creating this Connect 4 game using SDL is taking way longer than I thought. However, it is starting to come together. I realize that my C# .DLL game logic file is not that flexible. What I want to do in the game is to point and click with the mouse to select pieces to drop. The DLL is quite adapted to accept input from the console, but it is possible to use it in a way that don't require the console. Using the console helps when testing out the code, but for exporting the functionality, it is not good to require any console input at all ever. I also realized that exporting the client/server functionality may be even more complicated. For these reasons, it may be possible that I just finish off the single player aspect or playing on the same computer aspect. As I have other things to achieve, and this board game may not be that useful honestly speaking.

torsdag 6 februari 2020

Slow Board Game Progress

After looking at Win2D for a bit, I realized that it's perhaps not for me. I would need to learn quite a bit about how the Win2D API works, and it seems to be a bit slow to compile. I felt that I either had the choice of taking the easy Unity route or doing something more radical. I really do not want to have a Unity splash logo for something as simple as a board game, like the one I am currently making, "connect four". I knew from earlier about SDL since I had made an entire platformer gaming using it. Therefore, I decided to take my server-client game in C# and transform it into a DLL file (easy actually). Then I created a C++ project and imported the DLL file, the bad thing about this approach is that I have a setting in Visual Studio called crt. Having crt enables garbage collection for the DLL and makes it easy to access internal C# methods and classes with C++. However, crt supposedly also makes the application less optimized in terms of performance. For board games or simple applications, I strongly think that no one will notice though. So far everything is going fine, it is taking longer creating everything as well as the UI from scratch, but I am having a lot of fun coding it. More fun than I think I would have with doing things the easy way with Unity. Also, I plan to use Lua to load UI elements from a text file. Whenever I make edits to the text-file while the app is running, I will try to make it update the window for me. This way, I will be able to make edits to the UI in real-time so that I do not have to re-compile the program every time I want to visualize the changes I make to the code.

måndag 3 februari 2020

Fast UI

Lately I have been finishing up the base code for my connect four game. The game logic along with a basic controller went really fast to complete. I am using C# to code this, and it's convenient to use. Perhaps it's not suitable for super-optimization like C++, but it's not often that anyone notice a difference for simple applications. I think C# is perfect for creating logic for board games. Although, the AI would benefit from being created separately with C++ and then linked via a DLL. My current AI only make random moves so there’s nothing to worry about there yet when it comes to performance. Creating a good AI can hog quite a bit of CPU resources. Anyways, the basics of the game is working. Also, I created a way to ping sweep a LAN (with some help from StackOverflow). I do that to retrieve all IPs that are easily available. These addresses are used to make it possible to easily find and play the game with others on the same network. The ability to manually connect to an IP might be added, but I think this will only benefit advanced users that are familiar with port forwarding. I did things a bit overly complicated by using UDP instead of TCP for internet connection. UDP is good to get used to if I plan to make real-time multiplayer games. Right now, most if not all important things work smoothly. The internet part could be fixed somewhat for handling special cases like loss of connection. The main thing that remains now is to add visuals. I could do a full-scale 3D app, but it would take some time doing it with C++, OpenGL and GLFW. Therefore, I did some research online and found an API called Win2D. Win2D is a free to use library that makes it simple to render 2D graphics and UI elements. I was first considering using Unity to quickly create 2D games, but I felt that Unity would be overkill for board games, and I also don't want to have to pay Unity money in the long run.

I haven't started using Win2D, but I will check it out. I think once I get a grasp of using it, I will quickly be able to create a standard UI that I can use for other upcoming games as well. Then, I will be able to produce maybe one board game per week and release them for free on the Microsoft Store. There already exist many board games on the MS store, but I hope to gain attention with my "FullRune" trademark and internet capabilities. Once I have become popular, I may be able to charge money for in-game items. At the very least this ought to boost my CV as a .NET C# developer. My favorite language is still C++ nonetheless.

fredag 31 januari 2020

Connect Four

The thing that I have been working on lately is a simple Connect Four game. The game logic works and was quite simple to implement using C#. I used the Model-View-Controller pattern when I created the logic. I have an idea which is to start making board games, rapidly, while also allowing players to compete against each other over LAN connections. If I create many of these board games in a way that ooze quality, a lot of people might just start downloading these. Presumably, the market for board games is rather big, but the competition still high. However, most free board games are of very low quality, so if I make things good, players may start searching for games specifically made by me. I guess the main goal of this project is to get a good foundation of network programming while gaining attention.

onsdag 29 januari 2020

Unreal Engine 4 & Future Plans

Someone told me online that I should check out Unreal Engine 4, as I have pretty much used Unity as a professional game engine. So, I did check it out, downloaded it and installed necessary files. I noted that I could not use the game engine properly on my laptop since it was too demanding. My laptop does not have a graphics card which probably is the biggest explanation to why. Anyways, it did work on my desktop computer. I set up some example programs and looked up an Unreal tutorial series on Udemy. There was a sale in January 2020 where all courses only cost 119 dollars instead of their normal prices. So, it was not really a big deal buying one. I did not follow all the videos completely, but I did notice some peculiarities. In Unreal Engine, you can apparently only have one animation per skeleton. Clearly, it would be much better if an animation could apply to any skeleton. This is a major issue, but I guess it's not much easier in other engines either. Unity has a technology they call Mecanim that allows the same animation to be used on different models. When I tried Mecanim, I did not get 100% desirable results.

I fast forwarded in the Unreal tutorial series. It appeared to me that at least 50% or more of the development process when using this engine involves setting up something called Blueprints. This is not programming, but instead a copy/paste process where you connect dots. While it could probably be used efficiently when creating games, it poses no intellectual challenge that I can appreciate. When you do everything from code, you get to solve puzzles in your head. Only connecting dots however quickly becomes very boring in my opinion, and it's not something that I am interested in spending a lot of time doing at all. Also, most of the tutorial heavily focused on technologies that are heavily coupled to the Unreal engine, for instance when creating multiplayer, you seem to heavily rely on existing functions only for the engine. This makes it very difficult to separate code logic from the engine itself or have detailed knowledge about how the network programming works. Maybe I haven't seen enough videos about this, but so far this is the overall impression that I got.

The dilemmas that I am considering as for today are what type of game I should try to make. While a 3D game is fully possible, it would require a lot of animations, and I am not interested in creating animations. It would be helpful to find an animator that works for free, but that is not a reasonable thought. I know that a character should be cosmetically customizable, because if it isn't there is little motivation to level up or use money in a game. By having upgrades games quickly becomes addicting. This is sort of what I want to achieve, make a game addicting.

Intuitively, I strongly believe that I perhaps should go back to creating 2D games, either completely from scratch or by using Unity where I get to do more coding.

torsdag 23 januari 2020

GunzGame: Delaying

It might happen that I put this project on ice. If not, there will probably be major changes and simplifications to how this game is made. The main issue right now is that the playable character would need quite a bit of animations. I am not a fan of creating animations, and have little interest in learning that skill right now. So the options that remain are to either find someone to make the animations for me or make things simpler. For instance, instead of allowing swords, I could start by just letting the player have a gun. I found a free Unity asset that may be interesting, but it requires me to update my current Unity version. Sadly, my computer disk space has been full for a long time. Will probably need to free it up a bit...

onsdag 22 januari 2020

Gambling in Games

A lot of games feature some element of randomness combined with betting. Examples being poker, roulette, loot crates (CS:GO) etc. Not that I would call poker or roulette real games. Or well, maybe card games can be seen as games, but roulette is just like the lottery. I do like card games, perhaps there should be more of them easily available for multiplayer online. I guess I could make a website app via Unity pretty easily, but the server would need to be hosted somewhere. I guess I could host it on my Raspberry PI now that I think of it. Card games are mostly turn-based and people don't notice if turn-based games lag at all. Apparently you can get some good ideas while you are writing. On the flip side, it would not bring in any money, but it would be a merit to have people play my games.

Should there be more gambling involved in games? GTA V had an update where they added a casino. Early on after this update, a lot of cheaters gathered millions or billions of GTA money from the casino since it was not made securely. I am not sure if they completely fixed that, but shortly after they also started banning people who were cheating using the casino. At least people have claimed to be banned. Unless you are cheating, there is not really much of a reason to gamble in GTA since you will just end up loosing money. Gambling could be done if you play against other players.

måndag 20 januari 2020

Game Review: Arcanists

What was Arcanists?

Arcanists was a 2D game similar to Worms and published by Jagex for their website FunOrb.com. It had a strong community going, despite lack of updates. It was possible to buy so called FunOrb membership that accessed certain locked features in the game. This features most importantly gave players advantages via new spells. I did not get these upgrades as I didn't feel it was worth to spend money on a monthly subscription for a game where a lot of people hack or DDoS.

If you know nothing about it, you had a single player unit. You also had a spell book. The spell book could contain a finite number of spells. These spells were used to attack enemies in combat. The game was a turn-based player-vs-player battle royale. If you fail to terminate the enemies, most maps would start exploding.

What could you do in Arcanists?

You had a 2D character that you could customize cosmetically. There were unlockable achievements. You could gain rank or loose rank or play unranked games. Ranked games were for paying members only. You could create a room and invite friends to play the game with you, or just invite random people.

Why did people play Arcanists?

A majority of the players had in some form or another had also played RuneScape. RuneScape is a very boring game, as everyone who has tried it knows. So, we RuneScapers had to fill our time doing something else. One day RuneScape started making advertisements for their new game platform at FunOrb and I just had to try it. Maybe partially because it contained a substring of my RuneScape username, "zORByt".

There was a "community", scoundrels from all over the world wrote all sorts of extremely stupid and offensive things 24/7. If a moderator entered it only got worse, as the language used was simply adapted to avoid reasons to get banned. That said, most moderators were "silver" moderators, and these do not have any admin rights. Their only superpower is that if they report a player, that player is much more likely to get punished than if the report were from a normal player. This of course assumes that a rule was broken. Some of the posts, did have comedic value. It may have helped that no one liked moderators.

When it comes to gaming, the game had replayability. Not in the form of levelling up, but in forms of having fun and learning to become a better player at the game. If you played against a person that was apparently bad at the game compared to yourself, you could use that as an opportunity to try out new risky strategies. When you take the possible spells that you can have, the possible spells the opponent can have, the world map, the players position on the map you get a combinatorial explosion of different possibilities. Just like in chess, except that this game had action that everyone can appreciate. If you did not feel like experimenting with new strategies, you could goof around by summoning implings that could be supercharged by arcane spells. After being supercharged, these could be moved similarly to the player to anywhere on the map and create huuuge explosions.

Caffeine & Productivity

I believe that caffeine does not help me be a more productive programmer. 90% of the time I find it hard to keep focused coding if I have had 60+ mg of caffeine the same day. Contradictory, I do feel like I can understand or learn things better when having caffeine. To sum up from these thoughts I should not have coffee on days that I spend developing but have coffee if I try to learn something complicated. To be fair, I think I could do fine not having caffeine ever, which is also how I have spent most of my life. Unless if you count the small fragments of caffeine that exists in coke, then I have been a caffeine consumer longer. As for the game that I'm working on, I have made some progress. I think that I will need to focus on taking as many shortcuts as possible. If I don't take shortcuts the game will never be finished, and it's as simple as that. Todays work will be spent on working on the state-machine for player actions. After that is finished, some simple animations when moving will be necessary to convince anyone that there actually have been any progress made. Furthermore, attacks with swords or gun(s) will be made possible. This will be apparent from having gunshot marks where bullets land.

lördag 18 januari 2020

GunzGame: Refactoring

It is now possible to move a player unit around. It's also possible to jump by pressing space. As one might expect, having different types of actions resulted in many nested if-statements. Therefore, I decided to refactor the code, so it uses the state-pattern. Walking and standing still are handled in a common state class called WalkingState. The merge is mainly due to standing still not really being worth handling in a separate class. Jumping or just flying in the air is handled in a class called JumpState. All state classes inherit some common abstract methods from an interface called PlayerState. One of the existing downsides of using the state-pattern is that it naturally produces duplicate code, even though one could go through big efforts to minimize it. In my opinion, these efforts are not worth the time. One extra, invisible, downside with the state-pattern is that it hides something horrible... it hides... GOTO calls. Example; WalkingState calls GOTO JumpState and JumpState calls GOTO WalkingState given certain conditions. If you have too many states, these GOTO calls will cause spaghetti code. Hence, it is quite important to not use the state-pattern too much.

The state that I plan to add for this game are the following: WalkState, JumpState, SpecialMoveState1, SpecialMoveState2, SwordAttackState1, SwordAttackState2, DeadState. All states can produce a DeadState, which happen when the player runs out of HP. I should really add a class that holds all player parameters as a next step in my game development process. Now that I have started creating a state machine I may as well create all the states. SpecialMoveState1 will only be possible while holding a gun and SpecialMoveState2 only possible while holding a sword.

fredag 17 januari 2020

GunzGame: Getting Started

I have set up an environment in Unity for the game that I am trying to make. The first thing that I have achieved, besides duplicate code, is to add a movable player with an accompanying camera. The plan is to have a third person view system. I will probably change the way that the camera moves in the Y-position. You see, I am moving it right now based on the mouse position and the screen size, but it will behave more uniformly across different computers with different screen sizes if I only use a mouse accelerometer instead. Even though a project always has the highest production rate in the beginning, I feel like it is possible for me to create a fully working game in Unity if I just continue coding stuff. There are a lot of potential "next steps" towards finishing the project. I really do not want to get to the pure art area, so I will mainly try to make things work. Also, I am making use of free assets from the Unity Asset store as much as possible. There is quite a lot of useful stuff there, to say the least. I will also include two videos in this post, one "funny" and one serious. In the funny we see the player rotate when you move the mouse.

torsdag 16 januari 2020


I would want to start out a game project using Unity, but there are some things I should figure out before I start. Similarly, for the same reason that you don't start building a house without planning. I am considering creating a player-vs-monster game, like GunZ. However, this would mainly be an offline game with the option to invite friends via LAN or port forwarding on a public IP. Luckily network is way easier to handle in C# than C++. Not that I have tons of experience with that. I suppose the first step to get a solid foundation for this game is to write down use-cases. These would be use-cases for human players by which the game should fulfill to be a proper game. Today I will probably do at least that, write down what possibilities the game should have. After that I could sketch up some UML-diagrams for the overall code design based on what the game design is to be. Making a 3D game in general requires some work. I believe the most boring part to me would be to design the game level worlds and unit visuals, not to mention the animations for all character movements. This can be done simple for starters, as they don't are necessary for the game to work in a logical sense. That said, it is highly desirable to have great art and great animations in a game that people will want to play.

onsdag 15 januari 2020

Game review: GunZ

GunZ no longer exists but was an online multiplayer shooter game. It had various game modes, such as player-vs-player or player-vs-monster. You could level up and buy weapons & armor. While the player-vs-player mode was fun in its own way, this blog post will focus on the player-vs-monster aspect of this forgotten game.

First off, I would recommend this game if it still existed, although it is quite old. The player vs monster mode was fun as it allowed you to get valuable items and level up. The best way to level up way probably from player vs player games, but I eventually found this other game mode simply more fun.

So, a group of players join a game and then waves of monsters appear. Each game is split into a set of levels with different maps and monsters. The last map(s) always ends with a final boss monster to kill. Once a game is done there is a chance of getting unique items or quest items. Quest items can be used to unlock new and more difficult maps. These harder maps require you to burn the quest items that can be found for some levels. Only one player can get a quest item when a game is over. It just so happens that sometimes these players won’t share the quest items even if they get them, which may cause some frustration. You see, some quest items are very rare. But also, these related maps are usually very difficult, so you will want to have high levelled and skilled players on your team. That, or a hacker on your team.

I found these games to have a high rate of replayability. Which is a bit silly since the AI was kind of simple. Most monsters just chase you around, while you yourself needs to keep in mind to always move. You can either shoot enemies or use a sword. A sword will save some bullets but using guns makes it less likely that you lose HP. The way that the players can move in the game makes it extra fun. Some moves, such as flying by using the sword close to walls was probably not intended to be a feature in the game, but it made it more fun. In total, they really did a good job in making the player character move in a fun and interactive manner. Perhaps the art-work also helped a lot with making the questing fun. The monsters and their surroundings just clicked with a Tomb-Raider style game. Being able to complete these levels with other people just made it all a great experience.

tisdag 14 januari 2020

Dungeons & Dragons 5e

I am not a D&D expert.

What is D&D? 
It appears to me that the game is played by a gang of people, at least 2 and about max 10. In the game, there is one "admin" that controls the world and tells a story by which all other players go through. The admin controls every single NPC. His job is to create events and make drama occur. He or she is also responsible for there being a purpose in the game. He must create all the visuals by which the players can walk around on. Each normal player defines their own character by doing several things. The most concrete things are for players to select a class and a race. There are a lot of races and classes. The main classes are barbarian, rogue, wizard, cleric, ranger, paladin, warlock, sorcerer, druid, fighter, bard. After that selection is finished each player must define a custom backstory for their character which can be pretty much anything. This backstory should define or explain at least partially how the character behaves in the game. After all, D&D is partially about role-playing. The players goal is not clearly defined, but it can be said that they go on an adventure akin to the Lord of The Rings, where Frodo has the goal of destroying a ring. It is seen as anti-social to backstab your fellow players for this reason. Anything is supposedly allowed however within the game. You basically only have to verbally describe your actions and the admin must allow them to happen. Karma is a thing though, actions have consequences in D&D, unlike in the real word.

What do you do in D&D?
You get into character. Adjust your voice to what your character is doing at the time. You can describe monotonously in 3rd person the actions you're about to do. If that is not the case, then it is only appropriate that you use some theater skills to emotionally change the voice as you interact with the world.

When an action is made, that you can do, you get to roll a dice which says how successful that action was. The possible actions for a character are (not) strictly decided by the skills you have chosen at the beginning of the game (or if you have levelled up enough). Based on that dice throw the DM (admin) will decide what happens next in the total story. I honestly don't know how or when a D&D ends, in a winning state. It is straight forward to visualize losing, all players simply die.

Do I recommend D&D?
If you know a bunch of D&D experts, you should at the very least try it. It's unlike any other game that exists. There are no rules and 100% freedom to do whatever you want. This could be implemented in a computer game, but it is hard to code something like that since free choices usually means that some players are going to cause bugs.

måndag 13 januari 2020

Clean Code

There is a book called Clean Code by Robert Martin. I have yet to read this book, even though I bought it. Instead, I have watched half (so far) of the video series related to the book. These videos ought to be available through his website cleancoders.com, but I can watch them for free via my school library, which is what I do.

These videos are some of the best that I have ever seen (YouTube included) about programming and practices. However, it gets awkward that he includes his family members into the videos. He mentions ways to make code more readable and thereby maintainable. He advocates for test driven development. All these tips are useful in some sense, but it's not like one must follow these practices or die, even if the videos give an impression of that. Yes - there is a shiny dagger coming up occasionally. Watching videos has always been a much more effective means for learning to me compared to books. I guess I just can't keep my concentration for very long if the subject is boring or written academically.

söndag 12 januari 2020

Game review: Thief Deadly Shadows

Thief: Deadly Shadows was a good game. It had challenge, fun & character. You are a thief that prefers not to fight and use stealth to sneak around and steal things. You can use money to buy upgrades, but the upgrades never make you invincible. By avoiding making players unbeatable, the challenge & fun remains throughout the game. That said, I never finished this game, but I'd believe that I made it to the last level. Why was it fun? I don't know exactly, but you had a lot of choices for how you were about to solve the problem of remaining undetected or sneak-attacking nearby guards. There are multiple weapons and tools to choose from. Also, there is the investigation aspect. Based on clues that you find from reading books etc. you should make conclusions about where treasures are hidden. However, for the most part, you are expected to just randomly search premises until you find and steal enough valuables. I like the fact that there is a tracker that tells you in percentage how much you have managed to steal in a level. This makes it clear if there is more stuff to search for or not. If that wasn't in the game, it would get quite arbitrary when estimating how well you have performed. The game may get spookier as you get further into the game, which is something to keep in mind.

torsdag 9 januari 2020

Unity Game idea

I have been considering starting working on a new type of game. I can choose between trying out making everything from scratch with C++ and GLFW, which is totally possible for a Windows game. However, I feel like I really want to speed-run a game. So, since I have quite a bit of experience with Unity from various school projects, I will probably want to use that. Now, I am having a hard time coming up with a game idea. Well, there is no issue with coming up with a "game idea", but I want an idea that I believe will be easy to make and also great. Intuitively, it feels like I am going to have text dialogs if I make a game. Text dialogs that will remind users of Ace Attorney or VA-11 Hall-A. Now, as for the game idea. I want the user to have a lot of freedom in making choices. In short, the game could be like Ace Attorney in that you have to investigate and deal with defending people in court. The main difference is that the player would walk around in 3D when investigating and be a corrupt lawyer that tries to prevent justice by forging evidence and other shady things. I believe it could be fun to let the player play as the bad guy instead of the hero. I suppose I will start out with getting a decent text UI going in Unity as a first step. Then I will create a level where a player can walk around and interact with objects by examining them. Perhaps for certain objects they can be examined by using the right mouse button to click and from there have more options. This is basically how RuneScape usd to handele interaction with game objects.

Advanced Topics Assignment

I had an assignment in school to create curves for a type of graph called Temporal Treemaps. I implemented my solution in a software called Inviwo, this is completely free and open source. I took some shortcuts when it came about to transferring data between so called modules. I did this by storing arrays of values in text files which I saved and loaded.

In short my solution to create graphs worked like the following: I found all points making up lines between sections of data. I used these lines to define one upper and one lower Bezier curve for each set of two triangles. This made it possible to discard unwanted fragments that were on the wrong side of these Bezier curves, in the frament shader. However, if I did this I would end up with white areas. The white areas was filled by drawing everything twice. First I drew everything with scaled triangles to cover up the white areas. Next, I drew normally sized triangles, to cover up for the ruffled cushion effects. My code for this solution is freely available on GitHub here: https://github.com/marcus1337/InviwoTemporalTreeMapsMOD

Before changes

Removing unwanted fragments

Scaling up triangles

Drawing twice to cover scaling