Archive for the ‘The code of VGS’ Category

How to get the most out of your smartphone when it comes to gaming

Smartphone gaming is incredibly popular all around the world and smartphones themselves have become much more powerful with the ability to play much more complex games. You can play anything from a space shooter game with lots of graphics to online blackjack where every move could mean winning the jackpot or losing it all. So which phone will allow you to do the most when playing games?

If you are in Apple fan then fear not because the latest iPhone is still one of the best phones on the market for playing games as well as many other things. This is because, like every iPhone, they designed both the operating system and the phone to work together seamlessly to create a smooth experience that everybody can enjoy, including gamers.

Everyone knows that power is incredibly important when playing games as your phone needs to be able to render everything. Screen space is also incredibly important as you need to be able to see everything that is happening in the game in order to play the game. For this reason you might want to look at the Samsung Galaxy note 3 as it has a 5.7 inch screen which is larger than the Nexus five.

If you don’t want to splash out on a mega expensive phone then the Moto G is perfect. It has a modern design and has a strong battery life. The screen is 4.5 inches and you can even buy different shells for the phone to match whatever outfit you want to wear. With so many choices on the smartphone market it is definitely worth checking out which is best for all your needs.

Posted: April 20th, 2013
at 9:23am by walter

Categories: The code of VGS

Comments: No comments

Gaming on Spectrum

Most of today’s gamers don’t remember how gaming on ZX Spectrum looked like. That’s not really surprising, since most of them weren’t even born in those days. Those who do, remember it with with a sense of nostalgia and get all misty-eyed when someone mentions it.

Back then, in the early eighties, things were different. Not only hardware – the whole gaming philosophy was different. First off, you had to get all the equipment that was necessary: a TV set, preferably in color (yeah, I know it’s hard to imagine, but back then, black and white TV sets were still around), a tape player, because audio cassettes were used as a data storage device, a screwdriver for adjusting playback head, and, of course, a ZX Spectrum.

When you successfully connected all the components, in order to load a game, you had to type a “load” command, and play the tape. It would take about five minutes for a game to load – depending on how complex it was. Then, all you had to do is to figure out which buttons to use (since Spectrum’s keyboard had no arrow keys), and the fun could begin.


Troubles and Difficulties

This, of course, is just theory. In reality, things were a bit harder – as you know, audio cassettes lose some of the quality of the recording every time when they are duplicated, and because of that, games would often fail to load properly, which was very frustrating indeed. That’s when the screwdriver would come in handy, and if you were adept enough, a simple twist or two on the playback head would often save the day.


Beating the Odds

When I compare games that we play today with the ones we played on Spectrum, the greatest difference between them that comes into my mind is not the complexity of the graphics, the design, or the story – it’s that the games in those days were harder, much harder to beat. Today, it is common to assume that, when you start playing a game, you will finish it in a matter of hours.

On Spectrum – you really had to earn your victory, and when you managed to do so, it would be a day to remember. There were no saves, no cheats, no difficulty options – just you against the machine, in a battle that was far from fair. The odds were never even by far at your side, and  you had to win the entire battle in one attempt. Almost like in real life.

Today, there are very few Spectrums left that actually work, so younger generations will probably never know what Spectrum’s rubber keyboard feels like beneath the fingertips. But, not all is lost for those who seek to taste the adventure – luckily, there are plenty of websites that offer emulations of those very games, so they can enjoy them on their PC’s. For those seeking a more modern thrill, you can always try the amazing cosmik casino affiliation programs.

Posted: August 7th, 2012
at 7:39am by walter

Categories: The code of VGS

Comments: No comments

Take up that spare time – with fun

OK, you have some time on your hands. It’s not time you planned on, more like a snippet of time that is an inconvenience more than a luxury. You know the deal; you’re caught in a waiting room, an airport terminal or (oops) a boring meeting room. It’s almost like time you’d rather not have. But it’s there, so you deal with it. There are plenty of options, particularly if you have a mobile device and online access. You could surf over to The Gamer Access and check out all of the news and reviews of the latest games for your favorite platform. But there are of course other options, those involving online software platforms that offer something quick, easy and less time consuming than the PlayStation game you use at home.



A few clicks to fun

Yep, there are plenty of gaming options online, and many of them are seemingly tailored to that small bit of spare time you might have. Take the online casino, for instance. With your mobile device and internet access, you are just a few clicks (or taps) away from a few hands of poker or blackjack, a spin of a roulette wheel or a pull of a slots lever. You can even cash in, if you like. Just a little spare time is one of the reasons internet casinos are so popular. People can not only play them at home, but anywhere they have a tablet or smartphone and online access. Naturally casino gaming has been around for centuries, and for good reason. Casino games have held their popularity down through the years simply because they are such fun. After all, the notion of placing a wager on the next card, number, or roll of the dice has built entire cites (see Las Vegas). When casino gaming went outside of the traditional brick-and-mortar venue and into the online world, its popularity grew exponentially. Now millions of people play everywhere, and the online casino industry has become a multi-billion-dollar phenomenon that is growing every day.

Popularity breeds competition

With the growth in the popularity of online casino gaming has come hundreds of casino websites and big-time competition. Every casino looks for an edge, by offering lucrative bonuses, software that makes it easy for users of any device, and a variety of payment/withdrawal systems. These websites even provide tips and strategies for playing particular games. And many of the slots games take much the same interesting thematic approaches that games on your home-based console take. For a good example of how these games work, you can read more here. There are plenty of advantages to playing a casino game online. The time factor is one, and the cash-in factor is another – you might as well have a chance at a return on your game play. But the obvious advantage is the fun. Anyone who has sat in on a friendly game of poker knows this. In fact, the friend factor adds to the fun. How cool is it to be able to play a few hands with a friend from across town or on the other side of the globe? And getting a friend to play on your site can get even more in cash or points bonuses. Just read more here to get an idea of the features the sites offer.

About the only thing that has kept the online casino industry from getting a bigger piece of the cyber pie is the law. You see, legislatures haven’t quite caught up to the popularity of online gambling and have left us with a mish-mash of laws. Not that players seem concerned; few people are worried that the suits will appear because they’ve deposited 10 bucks to play a low-limit game. But websites have plenty of restrictions for people who don’t live in places where online gambling is legal and regulated. But most anyone can read more here to get info on who can play and who can’t. And nobody keeps a player from playing for free. Legal or not, online casinos provide a good option for filling in that spare time with a little fun.

Posted: February 16th, 2012
at 10:46am by walter

Categories: The code of VGS

Comments: No comments

AI problem with an elegant solution

Hi everyone, Vlad here!

I’m excited! It’s really nothing special but I had one of those eureka moments!

Here goes:

The problem

The current game has a number of mechanical hazards. To test the animations Marco designed I simply added a counter that would put the hazard on a waiting state and then run the animation. While the animation was running the hazard was on an attack state that checks if any actors are in the area it affects.

Easy enough but this had these problems:

1. In theory every hazard of the same type has the same loop. Game design wise suspension of disbelief fails.

2. In practice and since the game updates only part of the map what happens is that each hazard has its own loop but the level designer has no control over it.

3. To give a wider control to the level designer the game would need to update every hazard per frame… see the problem here?

The solution

What if most of the hazards had a central AI point? The first time we discussed something like this was when Marco and Pedro were working on Hajime. The objective was to have the AI army making better decisions considering the overall scenario instead of having each unit deciding the next move individually.

In this case we want that the most basic hazard behaviors to be the same regardless of being updated or not while maintaining the suspension of disbelief. The generic solution (we are considering having configurable groups and individual hazards still) is to have chained hazards based on their tile position.

I’m currently writing the class that will serve as the hazard commander. It is amazingly simple. The following code is almost pseudo-code and a very simple version of what I’m writing because there are several hazards and each has a different frame count.

public function update():void {
    // For each hazard
    if (frame == hazardTexture.collectionLength()) {
        chain = chain == maxChains ? 0 : chain + 1;
public function getFrameOf(id:int):int {
    if (id == chain) return frame
    else return 0;

The commander is updated each frame. The code is pretty simple, it just increments the frame (not just one counter but one for each hazard type) and if the animation has ended it restarts and increments a chain counter.

Each hazard has a place in the chain. If it is on a part of the map that is updated, it will ask the commander what frame it should have passing its chain id. Even if it has not been updated recently it will update perfectly in sync with the rest of the game.

For this to be pretty and make sense and allow several automatic behaviors we have to understand what chain id means.

private var id:int = (tileX + tileY % maxChains)

Ok, looks simple, what does this mean? The graphic below is a capture of the spreadsheet where I tested the formula. The top left number is maxChains and in each cell is the chain id of each tile.

So if we have several hazards of the same type in a row, they will act in order, both horizontally and vertically. If there are a lot tightly grouped the player will see a diagonal movement giving a sense of some automatism behind the hazards which is a nice add-on since it fits the game.

But that’s not all, we can use the exact same code commander and give the hazards a different way of using their id. For instance we can have a method that will give an attacking frame to odd and then even ids making more active zones of the the map.

Ok… that’s simple, what’s the Eureka all about?

To be honest this problem was haunting me for a couple of days. I knew I wanted a central decision point (not really a big AI thing but still…) for most non-manually configured hazard for performance and consistency reasons. Everything I thought of was too complicated. Then I thought about this simple chain and the only problem I really had was to have a formula that would allow  a consistent behavior, like horizontal, vertical and diagonal chains. That little id formula was the eureka moment because it is so simple, so elegant and solves one major problem.

Like Einstein said:

Make things as simple as possible, but not simpler

Posted: February 10th, 2012
at 12:04am by Vlad

Tagged with , , ,

Categories: Dev Journal: Danger Zone,The code of VGS

Comments: 1 comment

Performance vs Error Checking

Hi everyone, Vlad here!

Seems like on a thing versus some other thing rampage with Application Design vs Game Design shortly followed by this post. I guess that’s a good thing, it means there are challenges and doubts and that we need to research.

This post is also inspired by some books I’ve been reading lately and that I highly recommend: The Productive Programmer that was influenced by The Pragmatic Programmer.

Problem #1

We are writing code and there’s not such thing as writing code without bugs. Sometimes our oldest, most used code, that code that we trust each of our games with gets into a specific spot where a hidden bug appears and we spend hours and hours figuring out what’s happening.

Solution #1 is Problem #2

There are several solutions to this. Writing code that includes testing is in my opinion the best. The problem with this, game development wise and specifically in scripted languages such as AS3, is that this makes the code much slower. The solution was checking for inconsistencies and not performing operations instead of throwing errors and exceptions.

I ended up creating conditions for use. For instance our blit package uses three different types: the core, the object and the texture. The core keeps the state of the whole system, the object keeps the state of what and where to render and the texture keeps the state of BitmapData. If the object did not have a texture it would simply not render. Sounds pretty cool, right?

To be honest… wrong…

Problem #2.1

First problem was the times where the position had NaN value instead of a Number. This rarely happened but every time it did it was a huge headache to identify why and then track the source of the bug down. While this seems unrelated, the fact was the it looked like the texture did not exist. So I had to check if the texture was created, if it was passed, if it was there at all and the worst part was that if the texture was there as it should, where the hell was the problem?

Problem #2.2

Performance wise checking if there is a texture is absolutely dumb! 99% of the times there is a texture present. More, the object class has a visible variable. If the object does not have a texture why is it visible in the first place?

So while apparently I solved a problem by checking if the texture was present and not performing any blit operation if it wasn’t, the truth is that both performance wise (not that serious by the way, it’s just a if statement) and the unwanted problems it induced in the code backfired from time to time.

I spread this type of behavior through the code. While one if statement does not have a large impact in performance, a lot of checking piles up and I had a lot!

Solution #2

A short story and a riddle both taken from those books that explain my thoughts on the ‘final’ (we’ll see about that!) solution for these problems.

The first one was when one of the authors was hired as a consultant for a development project where the coders sent broken code to the version control system. What he did was to create a routine where the version control server would compile the code that was pushed. Every time the compilation didn’t work the server would send an email with the error. With the amount of mail with errors constantly piling up on mailboxes, one of the coders asked if there was a way of not getting that much email. The consultant replied: “Sure, don’t push code with errors!”

The riddle is… what code takes not time to be executed? The one that is not compiled.

So the solution is to write code that allows zero error tolerance while not compiling it. The way to achieve this is with conditional compilation which can be used in several way but these are the ones I believe the most useful is to use code blocks, like this:

private function someFunction():void {
    CONFIG::debug {
        // Development code
    CONFIG::release {
        // Final code
    // Both dev and final code

Inside the same function, different code is compiled depending on the current configuration. We can have several checks with exceptions and errors being thrown and then have a ‘don’t check at all’ version in the release configuration.

This is a two stage solution really. On one hand every time I do something stupid, I get errors so my code has to be perfectly implemented at least when it comes to our framework. On the other hand the same code that make me code as best as I can is also the code that does not run in the final version.


Posted: February 5th, 2012
at 12:55am by Vlad

Tagged with , , , , ,

Categories: Dev Journal: Danger Zone,The code of VGS

Comments: 4 comments

« Older Entries