<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rapid Game Builder</title>
	<atom:link href="https://rapidgamebuilder.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://rapidgamebuilder.com</link>
	<description>...don&#039;t waste time, get started!</description>
	<lastBuildDate>Wed, 20 Jul 2011 15:17:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">18180782</site>	<item>
		<title>A Dash of Game Development – 10. Game Objects.</title>
		<link>https://rapidgamebuilder.com/2011/07/game-objects/</link>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Wed, 20 Jul 2011 15:13:34 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[game building]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[game entities]]></category>
		<category><![CDATA[game objects]]></category>
		<category><![CDATA[game system]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=479</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2011/07/game-objects/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.What are game objects? Simply put, they are the entities that make up your game. A character in a game, a tree which is a part of the game landscape, buildings, [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2011/07/game-objects/">A Dash of Game Development – 10. Game Objects.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2011/07/game-objects/">https://rapidgamebuilder.com/2011/07/game-objects/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">What are <em>game objects</em>? Simply put, they are the entities that make up your game. A character in a game, a tree which is a part of the game landscape, buildings, walls, sprites, menus, the HUD, platforms, NPCs  and mostly everything that you see within a game are all examples of game objects. It would be fair to say that everything and anything you observe within a game is a, or is a part of a game object. But what about things that you can&#8217;t see? What about sound sources within a game that produce sound? The sound coming off a running stream, or off a exploding mine, or off a moving car &#8212; can they also be modeled as game objects? Yes indeed they can be. In fact there are also game objects that you can&#8217;t see or hear &#8212; for example, a trigger that makes a land-mine go off, or a proximity-switch that opens a door when your character stand near it &#8212; are are all examples of game objects. If we look at our previous examples, the sprites that we used for our simulations could be considered as game objects. In simple terms a game object is an entity within a game that takes part, directly or indirectly, in the process of the game simulation. A game object could (but not always) have <em>behavior</em> and <em>properties</em> modeled into it to fulfill a specific purpose within the <em>game world</em>. Game objects can and do directly interact and participate in the gameplay. An example of interactive game objects could be enemy NPCs that attack your character while he/she is completing a quest. Such objects directly interact with the gameplay. Other game objects may not interact at all with the gameplay, but are there to serve some other purpose. Game objects like trees, shrubs, grass that litter a vast game landscape may not be direct participants in a game, but are there to serve a different purpose &#8212; that of creating a believable landscape within a game.</p>
<p style="text-align: justify;">Having understood what game objects are, let&#8217;s see how we can add game objects to our framework. At a very basic level, most game engines have some sort of a top level <em>GameObject</em> class. They may be called different things &#8212; &#8220;GameEntity&#8221;, &#8220;Actors&#8221;, &#8220;CoreObject&#8221; or some other name you could think of, but mostly they serve the same purpose. A <em>GameObject </em>class or interface is usually an abstraction for the most basic object related functions. There are many ways you could model such game objects. The simplest that one can think of is obviously a class design based on <em>inheritance</em>. In an inheritance based design, you have an interface or a base class called GameObject and all your specialized game objects classes derive from this base class/interface, each adding it&#8217;s own specialized functionality. This is the traditional way of designing a game object class &#8212; and many game engines still use this method. However this design has a several issues. A game can have tens if not hundreds of types of classes, and there are situations when an inheritance based approach quickly becomes complicated and unmanageable. There are often situations where the characteristics of two distinctly separate game objects overlap even though they are hierarchically dissimilar. Considerer two GameObjects, a Bird and a SpaceShip &#8212; both can fly, but based on your design the two could be modeled differently. At the very least you may have to duplicate parts of the flying code for both objects and maybe other pieces of code that are directly or indirectly related to flying.</p>
<p style="text-align: justify;">There are also instances where objects can&#8217;t be correctly classified via an inheritance based approach because many game objects just can&#8217;t be classified in a rigid inheritance hierarchy. Consider a situation where an object can be classified as two different types of objects &#8212; for example, you make all the Buildings in your game as static indestructible objects. You do this by creating a class called <em>Building</em> which derives from the class <em>IndestructibleObject</em>.  However later in your game you may want one of the building to blow up. To solve this you would either have to make changes to your <em>Building </em>class so that it has the ability to destruct and blow up &#8212; or you will have to create a new class called <em>DestructibleBuilding</em>. There are problems with both scenarios. Making the <em>Building </em>class destructible will mean all your buildings will be destructible &#8212; which may not be what you wanted in the first place. The second and the more plausible option is to create a derived class called <em>DestructibleBuilding</em> and derive it from a <em>DestructibleObject</em> to make it destructible. However even with this approach you will find that there are problems. A destructible building may be 99% similar to all other buildings, but since you made a new class and derived it from a <em>DestructibleObject</em>, you will have to duplicate most of the code used in the original <em>Building</em> class. Duplicating code is just not the right way to go &#8212; is it? Well, some would argue that you could use multiple inheritance &#8212; derive the <em>DestructibleBuilding </em>from both the <em>Building</em> and <em>DestructibleObject</em> classes. Well, the original <em>Building</em> class is a <em>IndestructibleObject</em> and since an inheritance relationship is a &#8220;is a&#8221; relationship, a <em>DestructibleBuilding</em> can&#8217;t be both a <em>DestructibleObject</em> and an <em>IndestructibleObject</em> &#8212; that&#8217;s just plain absurd, not to mention that it may also cause a &#8220;<em><a title="Diamond of death problem." href="http://en.wikipedia.org/wiki/Diamond_problem" target="_blank">diamond of death</a></em>&#8221; in your hierarchy. If you are making such choices in your design, it&#8217;s time to pause and introspect, because this is a classic case of &#8220;shooting yourself in the foot&#8221;.</p>
<figure id="attachment_541" aria-describedby="caption-attachment-541" style="width: 450px" class="wp-caption aligncenter"><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/05/inheritance.jpg"><img fetchpriority="high" decoding="async" class="size-full wp-image-541" title="Problems with Inheritance" src="https://rapidgamebuilder.com/wp-content/uploads/2011/05/inheritance.jpg" alt="Problems with Inheritance" width="450" height="400" srcset="https://rapidgamebuilder.com/wp-content/uploads/2011/05/inheritance.jpg 450w, https://rapidgamebuilder.com/wp-content/uploads/2011/05/inheritance-300x266.jpg 300w" sizes="(max-width: 450px) 100vw, 450px" /></a><figcaption id="caption-attachment-541" class="wp-caption-text">10.1 Problems with Inheritance</figcaption></figure>
<p style="text-align: justify;">As you can see inheritance makes object design rigid. There are situations when this is desired, however in the case of our game objects this might not be the ideal solution. So what other alternatives do we have besides an obvious inheritance approach? The other way of approaching the game object problem is via <em>composition</em>. Instead of having separate classes for each kind of game object, we have a single <em>GameObject</em> class and build our game objects by giving them <em>properties</em> and defining <em>behavior</em>. This will allow us more flexibility since object properties and behaviors are decoupled from the class implementation. Taking the previous example, any <em>Building</em> in the game just becomes an <em>instance</em> of class <em>GameObject</em> instead of a separate class derived from <em>GameObject</em>. Since we are not modeling <em>behaviors</em> or <em>properties</em> via class inheritance, there will be no class called <em>DestructibleObject</em>, since <em>Destructible</em> is now a <em>property</em> and needs to be modeled separately. Properties have no direct dependency with the GameObject class. A GameObject is associated with property class via a more loose <em>&#8220;has a&#8221;</em> relationship. For a <em>Building</em> that we intend to make destructible we simply assign it a property called <em>Destructible</em>. In fact, once created the <em>Destructible</em> property can be assigned to any game object. So is the case with any other property that we create. Fig. 10.2 shows this more clearly.</p>
<figure id="attachment_573" aria-describedby="caption-attachment-573" style="width: 402px" class="wp-caption aligncenter"><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/07/composition.jpg"><img decoding="async" class="size-full wp-image-573" title="10.2 GameObject and Properties composition" src="https://rapidgamebuilder.com/wp-content/uploads/2011/07/composition.jpg" alt="10.2 GameObject and Properties composition" width="402" height="232" srcset="https://rapidgamebuilder.com/wp-content/uploads/2011/07/composition.jpg 402w, https://rapidgamebuilder.com/wp-content/uploads/2011/07/composition-300x173.jpg 300w" sizes="(max-width: 402px) 100vw, 402px" /></a><figcaption id="caption-attachment-573" class="wp-caption-text">10.2 GameObject and Properties composition</figcaption></figure>
<p style="text-align: justify;">Properties by themselves only define a <em>GameObject</em>. They are used to create an object, but they by themselves don&#8217;t do anything. In our example, the <em>Destructible</em> property doesn&#8217;t make the <em>Building</em> explode. It only tells anyone who is interested &#8212; <em>&#8220;yes, this Building <strong>can</strong> explode&#8221;</em>. We will obviously need to have something that will <strong>make</strong> the <em>Building</em> explode when it sees the <em>Destructible</em> property &#8212; and when the <strong>time is right</strong>, for example &#8212; a missile hitting the building. That&#8217;s were <em>behaviors</em> and <em>conditions</em> come in. We will talk about <em>behavior</em> and <em>conditions</em> in more detail in a separate chapter where we will see how to model behaviors and combine them to give us the desired behavior for an object. For now we will focus on GameObject creation. It&#8217;s easier to just think of an object as a <em>instance</em> of a <em>GameObject</em> with a collection of <em>Properties</em>. This may appear confusing at first, but later you will see the benefits of this approach.</p>
<p style="text-align: justify;">We covered quite a bit of theory in this chapter, but it was necessary in light of things to come. We will end this chapter here and look at game object creation in the next.</p>The post <a href="https://rapidgamebuilder.com/2011/07/game-objects/">A Dash of Game Development – 10. Game Objects.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">479</post-id>	</item>
		<item>
		<title>A Dash of Game Development – 9. Archives and Resource Groups.</title>
		<link>https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/</link>
					<comments>https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/#comments</comments>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Tue, 15 Feb 2011 19:21:51 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[archives]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[event system]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[resource groups]]></category>
		<category><![CDATA[resource management]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=439</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.In this chapter we take the basic resource management framework we built in the last chapter and add a few more things to it. We will refine our code and [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/">A Dash of Game Development – 9. Archives and Resource Groups.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/">https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">In this chapter we take the basic resource management framework we built in the last chapter and add a few more things to it. We will refine our code and make the framework more generic so we can read resources from archives and allow loading of resources via resource groups. (This will allow us to make our framework more data-driven in later chapters.) Let&#8217;s first begin by looking at what an archive is and where it fits in our framework. In it&#8217;s simplest form, an archive is a collection of files. In our case the files are resource files that are loaded and shared between game entities. If you consider our directory structure, the <em>res</em> folder could be considered as an archive since it contains all our resource files. Most games will often pack such files into single file called an <em>archive file</em>, or sometimes into a set of separate archive files for each kind of resource (images, sounds, etc). Archive files are not to be confused with simple binary files. Archive files maintain a directory structure and also contain metadata along with other information, and can (optionally) store data in a compressed format. You may have come across the terms <em>&#8220;zip archive&#8221;</em> or <em>&#8220;rar archive&#8221;</em> &#8212; they are in fact compressed archives.</p>
<p style="text-align: justify;">We will first start off with our uncompressed res folder as an archive and build archive support into our framework. At the same time however, we will keep our design flexible enough to add support for compressed archives. So, let&#8217;s see how you can create a basic archive class.</p>
<pre class="brush: python; title: ; notranslate">
class Archive():
    '''Manages the loading of the resources from a archive.'''

    def __init__(self,  archivePath):
        '''Creates an archive object. Note the archive is not loaded or created.'''
        self.path = archivePath

    def Load(self):
        '''Loads the archive.'''

    def Unload(self):
        '''Unloads the archive'''

    def Open(self, fileName, mode='r'):
        '''Opens the archive file for access. The function returns a file type object.'''

    def GetSize(self, fileName):
        '''Returns the size in bytes of the file inside the archive.'''
</pre>
<p style="text-align: justify;">The <em>Load</em> function loads an archive. In case of a folder this function will probably do nothing except check for the existence of the archive path. For compressed/single file archives, this function will load the archive file. The Open function opens a file inside the archive and returns a Python file type object. You can read the contents of the file inside the archive via this object. If you recollect from the previous chapter, our ResourceManager&#8217;s LoadResource function should call the Open function of the archive since that is the place where resource loading takes place. For our <em>FolderArchive</em> the code should be &#8212;</p>
<pre class="brush: python; title: ; notranslate">
class FolderArchive(Archive):
    '''Manages the loading of the resources from the disk drive folder.'''

    def Load(self):
        '''Loads the archive.'''
        if os.path.exists(self.path) == False:
            return False

    def Open(self, fileName, mode='rb'):
        '''Opens the archive file for access. The function returns a file type object.'''
        f = open(self.path + fileName, mode)
        return f

    def GetSize(self, fileName):
        ''' Returns the size in bytes of the file inside the archive.'''
        return os.path.getsize(self.path + fileName)
</pre>
<p style="text-align: justify;">Pointing the <em>FolderArchive</em> class to the res folder allows the class to load the files under that folder. However we still would have to use a relative path to our resource if we wanted to load our files. If you recollect, we used relative file paths in the previous chapter for our resources. I find that kinda unintuitive. Imagine names like &#8216;../res/images/squares.png&#8217; everywhere in your code. That&#8217;s just doesn&#8217;t look right. An ideal solution would be to defer the relative paths to the resource system. Once initiated with the correct path, you are free to use the resource names directly within your code. Well that&#8217;s pretty easy to do &#8212; we just have add a small function to our <em>ResourceManager</em> code &#8211;</p>
<pre class="brush: python; title: ; notranslate">
def SetSubPath(self, archivePath):
    '''Sets a path (folder) inside the archive realtive to the archive root where
    the manager searches for resources.'''
    self.__archivePath = archivePath
</pre>
<p style="text-align: justify;">Our archive already points to the res folder, so the relative path (subpath) of the manager will be &#8216;images/&#8217;. The code for both the archive and the manager should look something like this &#8211;</p>
<pre class="brush: python; title: ; notranslate">
# create a FolderArchive pointing it to our resources.
archive = FolderArchive('../res/')

# create a resource manager for images.
self.imgResMan = ImageResouceManager()

# set the sub-path where our images are located relative the the archive.
self.imgResMan.SetSubPath('images/')
</pre>
<p style="text-align: justify;">This should allow us to point our resource manager to the correct folder and directly use resources using their resource names. This however, doesn&#8217;t solve the problem with resource loading. In the previous chapter we passed a list of resources to the <em>Cache</em> function of the <em>ImageResource</em> manager, and we did that  in the <em>Init</em> function of the <em>GameManager</em>. That&#8217;s not quite the correct way. Games require hundreds of resources and you can&#8217;t possibly pollute the <em>GameManager</em> class with names of all the resources required. In fact in trying to solve one problem we created another &#8212; that of resource loading.</p>
<p style="text-align: justify;">What we need to do is allow each sprite class to request the resources it needs and then make the ResourceManager cache all the requested resources. To do that, we introduce a new class called <em>ResourceGroup</em>. A <em>ResourceGroup,</em> as it&#8217;s names suggests, is a set of resources names that are passed to the <em>ResourceManager&#8217;s</em> <em>Cache</em> function. At it&#8217;s heart is a <em><a href="http://docs.python.org/library/stdtypes.html#set">set</a></em> (unordered list of unique names), which contains the resource names that we want the <em>ResourceManager</em> to cache. The flow goes something like this &#8212; after the creation of each sprite, the <em>GameManager</em> allows each of the sprites to request the resources it needs by appending their names to the resource group. The resources are cached by the ResourceManager and  after doing that, the Create function of the each individual sprite is called. The <em>ResourceGroup</em> code is something like this &#8212;</p>
<pre class="brush: python; title: ; notranslate">
class ResourceGroup():
    '''This class is used to tell the ResourceManager which batches of
    resources need to be cached.'''

    def __init__(self, archive, name=''):
        '''Construct a resource group with a name.'''
        self.archive = archive
        self.resourceNames = set()
        self.name = name

    def __iadd__(self, resource):
        '''Adds a resource to the group.'''
        self.resourceNames.add(resource)
        return self

    def __isub__(self, resource):
        '''Removes a resource from the group.'''
        self.resourceNames.remove(resource)
        return self

    def Clear(self):
        '''Removes all the resources from the group.'''
        self.resourceNames&#x5B;:] = &#x5B;]
</pre>
<p style="text-align: justify;">The flow for the <em>Init</em> function of the GameManager is &#8212;</p>
<pre class="brush: python; title: ; notranslate">
def Init(self):
    ....
    ....
    # create a FolderArchive pointing it to our resources.
    archive = resmgr.FolderArchive('../res/')

    # create a resource manager for images.
    self.imgResMan = resmgr.ImageResouceManager()

    # create a resource group for images
    imgResGroup = resmgr.ResourceGroup(archive)

    # create our sprites.
    self.sprites = &#x5B;]
    self.sprites.append(gamesprites.SquareSprite());
    ....

    # load the archive.
    archive.Load()

    # set the sub-path where our images are located relative the the archive.
    self.imgResMan.SetSubPath('images/')

    for sprite in self.sprites :
        # call Setup on our sprites and pass the resource group to the sprites
        # allowing them to request their resources.
        sprite.Setup(imgResGroup)

    # cache the requested image resources.
    self.imgResMan.Cache(imgResGroup)

    for sprite in self.sprites :
        # call Create on our sprites.
        sprite.Create(self.imgResMan)
        # attach the draw handler to our drawEvent.
</pre>
<p style="text-align: justify;">I have added  a Setup function  to the sprite class and where the name of the resource is appended.</p>
<pre class="brush: python; title: ; notranslate">
class SquareSprite(GameSprite):

    def Setup(self, resGroup):
        resGroup += 'squares.png'

    def Create(self,mgr):
        img = mgr&#x5B;'squares.png']
        self.sprite = sf.Sprite(img)
        self.sprite.SetPosition(100.0, 10.0)
</pre>
<p style="text-align: justify;">The entire flow of the resource system can seem a bit complicated and that&#8217;s why I have included a sequence diagram of the process I explained above. (Click on the fig to enlarge.)</p>
<figure id="attachment_448" aria-describedby="caption-attachment-448" style="width: 480px" class="wp-caption aligncenter"><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/02/resframework.jpg"><img decoding="async" class="size-full wp-image-448     " title="fig 9.1" src="https://rapidgamebuilder.com/wp-content/uploads/2011/02/resframework.jpg" alt="Sequence diagram for the Resource Framework." width="480" height="478" srcset="https://rapidgamebuilder.com/wp-content/uploads/2011/02/resframework.jpg 686w, https://rapidgamebuilder.com/wp-content/uploads/2011/02/resframework-150x150.jpg 150w, https://rapidgamebuilder.com/wp-content/uploads/2011/02/resframework-300x298.jpg 300w" sizes="(max-width: 480px) 100vw, 480px" /></a><figcaption id="caption-attachment-448" class="wp-caption-text">9.1 Resource Framework Sequence Diagram.</figcaption></figure>
<p style="text-align: justify;">If you find this a bit confusing at a first read, step through the code via a debugger and try and see what happens where. You can try loading additional images and adding a few other sprites just to get the hang of things. If you look at the code for this chapter, I have made subtle changes to included exceptions to correctly handle error conditions. That&#8217;s in accordance with standard Python practices. I hope there will no trouble understanding the use of exceptions and what role they play within our framework. I have also added support for a compressed zip archive (<em>ZipArchive</em>), which is a drop in replacement for our <em>FolderArchive</em>. You can experiment with that too.</p>
<p style="text-align: justify;">We have now our resource system in place. We will be using this system in all our later chapters. In the next chapter we take a look a something which everyone has been patiently waiting for &#8212; Game Entities and Objects. From then on, we will build upon this framework and go on to advanced topics like transformations, collisions, graphs, render passes, collections, GUIs and finally put all of this into a small working game.</p>
<h3>Downloads</h3>
<ul>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/02/dash_ch9.zip">dash_ch9.zip</a></li>
</ul>The post <a href="https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/">A Dash of Game Development – 9. Archives and Resource Groups.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
					<wfw:commentRss>https://rapidgamebuilder.com/2011/02/archives-and-resource-groups/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">439</post-id>	</item>
		<item>
		<title>A Dash of Game Development – 8. Resource Management.</title>
		<link>https://rapidgamebuilder.com/2011/02/resource-management/</link>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Mon, 07 Feb 2011 05:58:32 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[event system]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[image loading]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jpeg]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[resource management]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[textures]]></category>
		<category><![CDATA[texturing]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=363</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2011/02/resource-management/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.In the last chapter we used and shared an image resource between sprites, now we will see how we manage shared resources within our framework. It&#8217;s easy to manage a [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2011/02/resource-management/">A Dash of Game Development – 8. Resource Management.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2011/02/resource-management/">https://rapidgamebuilder.com/2011/02/resource-management/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">In the last chapter we used and shared an image resource between sprites, now we will see how we manage shared resources within our framework. It&#8217;s easy to manage a shared resource when you have a single image and handful of sprites using the same image. However, games have a lot of images and even more sprites sharing those images. A lot of entities load and use sprites all over the place, and a naive way to load and use them like we did in the previous chapter would lead to a chaos in our code. Keeping track of  shared resources would become a nightmare. Besides, images aren&#8217;t the only resources a game has. There are sounds, music, scripts, particle effects, shaders and a game can have even more resource categories, all of which are usually shared. Wouldn&#8217;t it be great if we could some how defer the management of resources to an automated class in our framework? A class that keeps track of the resources loaded and disallows multiple loads of the same resource would be an ideal solution. Well, lets see how that can be done.</p>
<p style="text-align: justify;">Wait! Before we jump into the code, let&#8217;s first understand how resources in our game project will be <em>organized</em>. Understanding the organization is crutial to understand resource management. Almost always all game resources are  The topmost folder of our project is the <em>game</em> folder, which currently has 3 child folders <em>doc</em>, <em>res</em> and <em>src</em>. The <em>src</em> folder holds our source code, the <em>doc</em> holds the documents and the <em>res</em> folder holds the resources. All our resources are currently placed int the <em>res</em> folder under the main <em>game</em> folder (fig 8.1). Each folder can have sub-folders which further facilitate categorization and organization. In our case the <em>res</em> folder will have child folders for each category of resources (<em>images</em>, <em>sounds</em>, <em>partfx</em>, etc). We will refer to this structure all throughout this chapter. Most games will have a similar organization structure <a href="#[1] dash_ch8">[1]</a>.</p>
<p style="text-align: justify;">
<figure id="attachment_404" aria-describedby="caption-attachment-404" style="width: 160px" class="wp-caption aligncenter"><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/02/dash_ch8_fig8.1.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-404" title="fig 8.1" src="https://rapidgamebuilder.com/wp-content/uploads/2011/02/dash_ch8_fig8.1.jpg" alt="Organization" width="160" height="152" /></a><figcaption id="caption-attachment-404" class="wp-caption-text">8.1 Organization.</figcaption></figure>
<p style="text-align: justify;">So, now let&#8217;s look at the code &#8211;</p>
<pre class="brush: python; title: ; notranslate">
class ResourceManager():
    '''Does the resource management for the game.'''

    def __init__(self):
        '''Constructor for the Resource Manager.'''
        self.__resources = dict()

    def Cache(self, resourceList):
        '''Loads all the resources into the manager.'''

    def Purge(self):
        '''Deletes and removes all the resources from the manager.'''

    def __getitem__(self, resourceName):
        '''Returns an image from archive. If an image is not loaded, it throws and exeption.'''
        return self.__resources&#x5B;resourceName]
</pre>
<p style="text-align: justify;">Central to the resource management is a class we will call the <em>ResourceManager</em>. It&#8217;s the base class for several resource managers we will eventually write. At it&#8217;s heart is a dictionary (<em>__resources</em>) for resources, which is an associative array of <em>resource names as keys</em> and actual <em>resource objects as values</em>. The resources can be accessed directly using resource names via the [] (__getitem__) operator. The resource manager has 2 other functions &#8212; the <em>Cache</em> function which caches all the resources into the manager by loading them from a <em>resourceList</em>, and the <em>Purge</em> function which deletes all the resources loaded by the manager. We will have different resource managers for different resources as we go along, so to make the Cache function more generic we add another function to the manager code to load resources and call it inside the Cache function.</p>
<pre class="brush: python; title: ; notranslate">
    def Cache(self, resourceList):
        '''Loads all the resources from the list into the manager.'''
        for resourceName in resourceList:
            res = self.LoadResource(resourceName)
            if res != None:
                self.__resources&#x5B;resourceName] = res

    def LoadResource(self, resourceName):
        '''Loads a resource. (Implemented in child classes)'''
        pass
</pre>
<p style="text-align: justify;">Our ResourceManager template is ready. Since we are already familiar with image resources, we will first begin with the <em>ImageResourceManager</em> &#8212; which manages image resources. Let&#8217;s see how it&#8217;s  LoadResource function will look like.</p>
<pre class="brush: python; title: ; notranslate">
class ImageResouceManager(ResourceManager):
    '''Manages Image resources.'''

    def LoadResource(self, resourceName):
        '''Loads an image.'''
        img = sf.Image()
        img.LoadFromFile(resourceName)
        return img
</pre>
<p style="text-align: justify;">If you recall, this is the same code we used to load our images in the previous chapter &#8212; and that&#8217;s about it! The way to use the manager is simple.</p>
<pre class="brush: python; title: ; notranslate">
def Init(self):
....
    # create a resource manager for images.
    self.imgResMan = ImageResouceManager()

    # cache our image resources.
    self.imgResMan.Cache(&#x5B;'../res/images/squares.png', '../res/images/crate.jpg'])
...
#later in our code
    image = self.imgResMan&#x5B;'../res/images/squares.png']
</pre>
<p style="text-align: justify;">The code above creates the manager and caches the images in it. To access the images, you can simply call the [] operator on the manager and pass it the resource name. To further illustrate how the resource manager is used, I have created a file called <a href="https://rapidgamebuilder.com/wp-content/uploads/2011/02/gamesprites.py">gamesprites.py</a> found in the zip file below. In the file you have a few sprite objects. The <em>Create</em> function of the sprites should give you a clear idea on how the resource manager will be used in our game. The <em>Init</em> function of the <em>GameManager</em> creates the <em>ImageResourceManager </em>and caches the resources in it. It then passes the manager to the Create function of each individual sprite object where it is used by the sprites to create themselves. The <em>OnDraw</em> functions of the sprites are connected to the <em>drawEvent</em> which is fired from <em>DrawEntities</em> function of <em>GameManager</em>. The manager is finally used to <em>Purge</em> the resources loaded and is itself destroyed in the <em>Cleanup</em> function thus freeing the resources.</p>
<p style="text-align: justify;">We have created and used our first resource manager. Resource management can be a complicated topic in game engines and it&#8217;s important to understand how resources are managed within any kind of game framework. I would say it&#8217;s one of the most important things for advanced games that use gigabytes of resources, especially on memory limited environments like game consoles. For now, I have purposefully kept our resource manager simple. We want to understand the  function of the resource manager and not overly complicate it right from the word go. In the next chapter we will extend the resource manager to handle archives and resource groups.</p>
<p style="text-align: justify;">The last thing we will touch upon in this chapter is the logging system. A logging system is crucial for any game. It&#8217;s can be the only savior when things go wrong and the debugger isn&#8217;t available &#8212; for example, when your game crashes on the player&#8217;s machine. Without logging there is no real way to troubleshoot in such situations. We must therefore, have a logging system for our framework. Since Python already has a logging system built-in, we use the same for our game. I will not be explaining the logging system since it&#8217;s already clearly explained in the <a href="http://docs.python.org/library/logging.html#module-logging">Python documentation (15.7)</a>. The logging system can be found in the log.py file.</p>
<h3>Downloads:</h3>
<ul>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/02/dash_ch8.zip">dash_ch8.zip</a></li>
</ul>
<p style="text-align: justify;"><small><em><a name="[1] dash_ch8"></a></em><em>[1] When a team work on a software project, the organization structure of a project is generally closely tied with some kind of a </em><em><a href="http://en.wikipedia.org/wiki/Revision_control">version control system</a></em><em>. This allows multiple people to work within the project and facilitates project management.</em></small></p>The post <a href="https://rapidgamebuilder.com/2011/02/resource-management/">A Dash of Game Development – 8. Resource Management.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">363</post-id>	</item>
		<item>
		<title>A Dash of Game Development – 7. Images, Sprites and Textures.</title>
		<link>https://rapidgamebuilder.com/2011/01/images-sprites-and-textures/</link>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Fri, 14 Jan 2011 10:30:12 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[image formats]]></category>
		<category><![CDATA[image loading]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jpeg]]></category>
		<category><![CDATA[jpg]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[textures]]></category>
		<category><![CDATA[texturing]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=299</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2011/01/images-sprites-and-textures/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.We will be looking at a bit of theory again in this chapter. First let&#8217;s start with images. An image is often used interchangeably with the terms picture and bitmap. If you [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2011/01/images-sprites-and-textures/">A Dash of Game Development – 7. Images, Sprites and Textures.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2011/01/images-sprites-and-textures/">https://rapidgamebuilder.com/2011/01/images-sprites-and-textures/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">We will be looking at a bit of theory again in this chapter. First let&#8217;s start with <em>images</em>. An image is often used interchangeably with the terms picture and bitmap. If you recall, we talked about bitmaps in <a href="https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/">chapter 4</a> &#8212; where we understood what a bitmap was. Images are usually stored on a storage medium in an <em>Image File</em>. An image file has image data which is stored in a standardized format called <em>image format</em>. An image format is a specification that defines how image data should be arranged and  formatted so that it can be universally read. In in our case it&#8217;s SFML that reads all the images. It&#8217;s tempting to think images as bitmaps, however not all image formats store data in pixels. Some formats store data in <a href="http://en.wikipedia.org/wiki/Vector_graphics">vector graphics</a> format. We won&#8217;t be getting into vector graphics images in this series since it&#8217;s out of scope for a simple python based game like ours. All the images we will be using will have raster graphics i.e. pixel data &#8212; but it&#8217;s important to understand the difference and stop thinking images as only bitmaps <a href="#[1]">[1]</a>. For the remainder of this chapter I will only talk about raster graphic images, i.e. bitmap image formats.</p>
<p style="text-align: justify;">Along with storing data, an image format also specifies how the image data is <em>compressed</em>. If you go through the specs of most formats, you will see that they usually have compressed data. That brings us to the question, why should an image be compressed? That&#8217;s because without compression an image file would become huge very quickly <a href="#[2]">[2]</a>.  A true color image having a alpha channel requires 4 bytes per pixel. So the size of a relatively small image of 1024 by 1024 pixels would become 1024 x 1024 x 4 = 4,194,304 bytes or 4 MB. With compression applied, this size can be brought down significantly. Smaller files are faster to read off the disk and easier to transfer and maintain. But does compression degrade the image data? The answer is &#8212; it depends on what image format you use. There are two types of image compression algorithms that are in use, there are  the <em>lossy compression</em> algorithms and the <em>lossless compression</em> algorithms. Lossy compression algorithms produce significantly smaller image files at the cost of some decrease in image quality, whereas lossless compressions preserve the quality of the image but produce image files that are a a bit larger than lossy algorithms, but still smaller than uncompressed images. The <a href="http://en.wikipedia.org/wiki/JPEG">JPEG family</a> (.jpg, .jpeg, etc) file formats use lossy  compression algorithms whereas the <a href="http://en.wikipedia.org/wiki/Portable_Network_Graphics">PNG format</a> is a lossless image format. Since our game will be a standalone single player game, we will mostly use the PNG format. The PNG format gives a pretty decent compression ratio and allows us to maintain our images in lossless quality. The image format is also a free image format and is supported by SFML.</p>
<p style="text-align: justify;">That was a bit of a long lesson we went through there so now let&#8217;s try and see how we handle images in our game. Images are resources &#8212; remember resources from <a href="https://rapidgamebuilder.com/2010/12/basic-outline/">chapter 3</a>? Since they are external files, they need to be loaded before we can use them inside our game. SFML takes care of loading images for us and is quite simple to do. We will be using the file squares.png shown in 7.1. The file is a 128 pixels x 128 pixels in size.</p>
<figure id="attachment_324" aria-describedby="caption-attachment-324" style="width: 128px" class="wp-caption aligncenter"><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/01/squares.png"><img loading="lazy" decoding="async" class="size-full wp-image-324  " title="squares" src="https://rapidgamebuilder.com/wp-content/uploads/2011/01/squares.png" alt="squares" width="128" height="128" /></a><figcaption id="caption-attachment-324" class="wp-caption-text">7.1 The squares.png image</figcaption></figure>
<p>The code for loading the file is.</p>
<pre class="brush: python; title: ; notranslate">
img = sf.Image()
img.LoadFromFile('squares.png')
</pre>
<p style="text-align: justify;">That was easy, but wait, how do we display our image? Well, as I said above, an image is a resource and we must map our resource to a drawable entity before it can be displayed in our view. In SFML terms a drawable entity having an image is called <em>Sprite</em>. In classical game development terms a sprite is usually a 2 dimensional image or an animation which forms a part of the game screen. Several small sprites are integrated, often seamlessly within a game to build a game world. A sprite is a drawable entity, that is often, but not always rectangular. In SFML it&#8217;s very easy to create and draw a sprite. Let&#8217;s see how it&#8217;s done using the image we loaded above.</p>
<pre class="brush: python; title: ; notranslate">
squaresSprite = sf.Sprite(img)
...
...
#In our game loop
    window.Draw(squaresSprite)
...
...
</pre>
<p style="text-align: justify;">The above code will display the entire squares.png in our view. But what if we want only part of our image? Say for instance &#8212; what if we wanted only the red square? Can we get a part of our image into a sprite? Yes we can. It can be done by setting a sub-rectangle in our sprite. Let&#8217;s look at the following piece of code &#8211;</p>
<pre class="brush: python; title: ; notranslate">
redSprite = sf.Sprite(img)
redSprite.SetSubRect(sf.IntRect(65, 0, 128, 64))
</pre>
<p style="text-align: justify;">What  does this code do? It sets the co-ordinates of the internal rectangle of the sprite to use only a portion of our image while drawing. Just like we have co-ordinates for the Screen and our View (as we saw in <a href="https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/">chapter4</a>), our images can also be addressed with the help of co-ordinates &#8212; and just like our screen and view our images also have co-ordinate axes. In our code the SetSubRect sets the sub-rectangle to left (x1) = 65pixels, top (y1) = 0 pixels, right (x2) = 128 pixels and bottom (y2) = 64 pixels, which represents the red portion of our image.</p>
<figure id="attachment_327" aria-describedby="caption-attachment-327" style="width: 228px" class="wp-caption aligncenter"><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/01/texxture_coordinates.png"><img loading="lazy" decoding="async" class="size-full wp-image-327   " title="Image co-ordinates" src="https://rapidgamebuilder.com/wp-content/uploads/2011/01/texxture_coordinates.png" alt="Image co-ordinates " width="228" height="228" srcset="https://rapidgamebuilder.com/wp-content/uploads/2011/01/texxture_coordinates.png 228w, https://rapidgamebuilder.com/wp-content/uploads/2011/01/texxture_coordinates-150x150.png 150w" sizes="auto, (max-width: 228px) 100vw, 228px" /></a><figcaption id="caption-attachment-327" class="wp-caption-text">7.2 Image co-ordinates.</figcaption></figure>
<p style="text-align: justify;">There is one question you might ask &#8212; Why was a sf.Image() needed? Wouldn&#8217;t it have been easy just to load the entire image into a sprite and then draw it? Why do we need an intermediate resource? That&#8217;s because, resources are shared. What would happen if we wanted to use 4 sprites that use the same image? Say if we wanted yellow, red, blue and green sprites. We would have had to load the image 4 times, once for each sprite. A terrible waste of memory. Instead of that we load the image only once and create multiple sprites using sub-rects from the same image. When images are loaded, they have to be decompressed and loaded as bitmaps &#8212; and we saw how large raw bitmaps can be. It would be unwise for us to load the image 4 more times for 4 other sprites that use the same image. Instead we share the image between sprites.</p>
<pre class="brush: python; title: ; notranslate">
yellowSprite = sf.Sprite(img)
yellowSprite.SetSubRect(sf.IntRect(0, 0, 64, 64))

redSprite = sf.Sprite(img)
redSprite.SetSubRect(sf.IntRect(65, 0, 128, 64))

blueSprite = sf.Sprite(img)
blueSprite.SetSubRect(sf.IntRect(65, 65, 128, 128))

greenSprite = sf.Sprite(img)
greenSprite.SetSubRect(sf.IntRect(0, 65, 64, 128))
</pre>
<p style="text-align: justify;">This is how resource sharing takes place. Always strive to share resources between game entities. If you have a lot of small sprites, it&#8217;s always wise to bunch them up together in one image. There are two advantages to that &#8212; a) You will need less image loads (which will be fast) and also require less memory &#8212; and b) Graphics rendering hardware is optimized for drawing large batches of entities. When there are a lot of sprites that use the same image, the drawing can be bunched up into one large batch and drawn in a single instance. That increases rendering speed. We will see this later in chapters related to optimizations. Also remember to try and keep the width and height of your image as a power of 2 (16, 32, 64, 128, 256,&#8230;). Sometimes graphics hardware can&#8217;t support non power of two (NPOT) images. In that case SFML will increase the internal storage size for your image and make it a power of 2, thus wasting space. We used a 128 x 128 pixel image, that is a power of two so no problems there. However, what would have happened if the image was 130 x 130 pixels and if NPOT wasn&#8217;t supported? The internal texture where the image data would be loaded would have been scaled to 256 x 256 pixels to accommodate the 130 x 130 pixel image.</p>
<p style="text-align: justify;">With that it&#8217;s time to introduce another term, and that term is <em>Texture</em>. In a graphics pipeline a texture is a bitmap (or series of bitmaps),  that can be <em>mapped</em> to an object like a triangle. Mapping a texture to an object is called <em>texture mapping</em>. SFML doesn&#8217;t use or expose the term texture or texture mapping in it&#8217;s APIs directly (, though it internally does use textures). Instead it just uses the term Image (sf.Image) and gives us a mapped object like a Sprite (sf.Sprite). However, texture and texture mapping are accepted and used terms in graphics. The correct term for image co-ordinates that we saw earlier is actually <em>texture co-ordinates</em>. You will see these terms used very frequently when dealing with graphics. We won&#8217;t be getting into the depths of textures in this series since it&#8217;s out of scope for a small 2D game like ours. However you will see me use the word texture, texture mapping and texture co-ordinates in later chapters.</p>
<p style="text-align: justify;">In the next chapter we will see how we manage and automate the loading and sharing of images in our framework.</p>
<h3>Downloads</h3>
<ul>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/01/dash_ch7.zip">dash_ch7.zip</a></li>
</ul>
<p style="text-align: justify;"><small><em><a name="[1]"></a></em><em>[1] &#8211; Vector Graphic formats are very often used by artists and content creators to create game related art. Usually intricate and detailed art is created in a vector graphics format and then exported or incorporated into the game pipeline by converting into a raster graphics format. The other place where vector graphics formats are used directly is in flash based games &#8212; where most of time the images are vector graphics based.</em></small></p>
<p style="text-align: justify;"><small><em><a name="[2]"></a>[2] &#8211; Uncompressed images are very large. Consider a digital image taken by a 12 Mega-pixel camera. Each pixel without transparency in true color is 3 bytes. So the image taken by the camera would become &#8211; 12,000,000 x 3 = 36,000,000 bytes i.e. 36Mb. Now consider that you have an 8 Gb card in your camera. So if the image data were to remain uncompressed, you could at the most have 8000/36 = 222.22 or 222 images on your card. In reality because your camera compresses the image file to a .jpg format, you can fit 10 times that amount.</em></small></p>The post <a href="https://rapidgamebuilder.com/2011/01/images-sprites-and-textures/">A Dash of Game Development – 7. Images, Sprites and Textures.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">299</post-id>	</item>
		<item>
		<title>A Dash of Game Development – 6. The Event System.</title>
		<link>https://rapidgamebuilder.com/2011/01/the-event-system/</link>
					<comments>https://rapidgamebuilder.com/2011/01/the-event-system/#comments</comments>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Fri, 07 Jan 2011 10:42:39 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[event system]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=252</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2011/01/the-event-system/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.Now that we have our game framework in object oriented format, it&#8217;s time to extend it further so that we can add game entities, load resources and run our game [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2011/01/the-event-system/">A Dash of Game Development – 6. The Event System.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2011/01/the-event-system/">https://rapidgamebuilder.com/2011/01/the-event-system/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">Now that we have our game framework in object oriented format, it&#8217;s time to extend it further so that we can add game entities, load resources and run our game simulations via the framework. Let&#8217;s begin by looking at what all needs to be added to our basic game framework. Remember, I am not going to post the entire code from now on. You can refer previous chapters to find out what each function does, or you can refer the full source code posted at the end of this chapter.</p>
<p style="text-align: justify;">In <a href="https://rapidgamebuilder.com/2010/12/basic-outline/">chapter 3</a> we briefly talked about <em>Events</em> and <em>Actions.</em> In this chapter we will integrate an event system within our framework. Our entire framework will be event based, so it&#8217;s better to get into this now and make it the backbone of our framework. We will call it &#8212; well, the <em>Event System</em>. A note I would like to add here is &#8212; there are many ways to model a event system each having it&#8217;s advantages and disadvantages. We will be using a rather simple but a popular python event system which is easy and concise to implement. The code is as follows &#8211;</p>
<pre class="brush: python; title: ; notranslate">
class Event():
    '''The Event class.'''

    def __init__(self):
        '''Create a list of handlers.'''
        self.handlers = &#x5B;]

    def __iadd__(self, handler):
        '''Adds a handler to the list of handlers.'''
        self.handlers.append(handler)
        return self

    def __isub__(self, handler):
        '''Removes a handler to the list of handlers.'''
        self.handlers.remove(handler)
        return self

    def Fire(self, *args, **keywargs):
        '''Calls all the handlers associated with this event.'''
        for handler in self.handlers:
            handler(*args, **keywargs)

    def ClearObjectHandlers(self, obj):
        '''Clears the handlers for a particular object.'''
        for handler in self.handlers:
            if handler.im_self == obj:
                self -= handler

    def ClearAllHandlers(self) :
        '''Clears all the handlers currently associated with the Event.'''
        self.handlers&#x5B;:] = &#x5B;]
</pre>
<p style="text-align: justify;">As you can see it&#8217;s not too complicated.  An event is modeled as a class that maintains a list of <em>event handlers</em> which it invokes one by one when  <em>fired</em>. The  __iadd__ and __isub__ are overloaded arithmetic operators += and -= that append and remove event handlers to the event handler list. The usage of the class will become clear when we look at an example. Let&#8217;s take a scenario from an epic space battle and model two simple classes, one that fires events and other that responds to those events.</p>
<pre class="brush: python; title: ; notranslate">
class Captain():

    def __init__(self):
        self.ArmWeapons = Event()
        self.FireWeapons = Event()

class StarShip():

    def __init__(self, name, captain):
        self.name = name

        # bind the captain's events to event handlers
        captain.ArmWeapons += self.OnArmWeapons
        captain.FireWeapons += self.OnFireWeapons

    def OnArmWeapons(self):
        print self.name + ' : \&quot;Phasers armed and ready.\&quot;'

    def OnFireWeapons(self):
        print self.name + ': \&quot;Firing Phasers.\&quot;'
</pre>
<p style="text-align: justify;">Here we have two classes <em>Captain</em> and <em>StarShip</em>. The Captain is the <em>controller</em> of the StarShip and it&#8217;s but obvious that the ship respond to his events. The Captain has two events &#8212; <em>ArmWeapons</em> and <em>FireWeapons,</em> which are connected to the ship&#8217;s event handlers <em>OnArmWeapons</em> and <em>OnFireWeapons</em> respectively in the StarShip&#8217;s constructor. Let&#8217;s check further how the Captain can <em>invoke</em> the StarShip&#8217;s event handlers.</p>
<pre class="brush: python; title: ; notranslate">
if __name__ == '__main__':
    Picard = Captain()

    # let's make Picard the captain of the Enterprise
    Enterprise = StarShip('Enterprise', captain=Picard)

    print '\&quot;This is Picard, the captain of the Enterprise. Prepare for battle.\&quot;'
    Picard.ArmWeapons.Fire()
    print '\&quot;This is Picard. Fire at will.\&quot;'
    Picard.FireWeapons.Fire()

</pre>
<p>The output of the above code is &#8211;</p>
<pre class="brush: plain; title: ; notranslate">
&quot;This is Picard, the captain of the Enterprise. Prepare for battle.&quot;
Enterprise : &quot;Phasers armed and ready.&quot;
&quot;This is Picard. Fire at will.&quot;
Enterprise: &quot;Firing Phasers.&quot;

</pre>
<p style="text-align: justify;">As you can see we have 2 objects <em>Picard</em> and <em>Enterprise</em>. The <em>Picard</em> object is an instance of the class Captain and the <em>Enterprise</em> object is an instance of the class StarShip. We passed the Picard object as a captain in the Enterprise&#8217;s constructor. The event handlers of the StarShip Enterprise were bound to the events of Captain Picard there. When Picard fired the events, the event handlers of Enterprise were invoked.</p>
<p style="text-align: justify;">It&#8217;s important that you understand the association of the two objects and how the two object communicated via events. Such inter-object communication via events  will be the basis of our game. This is one way interaction, but objects can also communicated both ways via events.</p>
<p style="text-align: justify;">But what happens if Picard takes charge of more than one ship? Will the same event system work in that case? Well, only one way to find out &#8211;</p>
<pre class="brush: python; title: ; notranslate">
    # Ok, now let's make Picard the commander of 4 more ships
    Voyager = StarShip('Voyager', Picard)
    Defiant = StarShip('Defiant', Picard)
    Excalibur = StarShip('Excalibur', Picard)
    Challenger = StarShip('Challenger', Picard)

    print '\&quot;This is Picard, the captain of the Enterprise. I am taking command of all the ships. Prepare for battle.\&quot;'
    Picard.ArmWeapons.Fire()
    print '\&quot;This is Picard. All ships fire at will.\&quot;'
    Picard.FireWeapons.Fire()

</pre>
<p>&#8230; and the output is</p>
<pre class="brush: plain; title: ; notranslate">
&quot;This is Picard, the captain of the Enterprise. I am taking command of all the ships. Prepare for battle.&quot;
Enterprise : &quot;Phasers armed and ready.&quot;
Voyager : &quot;Phasers armed and ready.&quot;
Defiant : &quot;Phasers armed and ready.&quot;
Excalibur : &quot;Phasers armed and ready.&quot;
Challenger : &quot;Phasers armed and ready.&quot;
&quot;This is Picard. All ships fire at will.&quot;
Enterprise: &quot;Firing Phasers.&quot;
Voyager: &quot;Firing Phasers.&quot;
Defiant: &quot;Firing Phasers.&quot;
Excalibur: &quot;Firing Phasers.&quot;
Challenger: &quot;Firing Phasers.&quot;

</pre>
<p style="text-align: justify;">We made Picard the captain of 4 more ships (along with the Enterprise) and all the ships correctly responded to his Events. The event was fired only once, but all the event handlers were invoked. So our event system seems to correctly invoke more than one handlers connected to an event. Fine, let&#8217;s move on and integrate it with our framework.</p>
<p style="text-align: justify;">Since we will be working with a lot of events throughout our game, I chose to create a separate file event.py and put the event code in it. It&#8217;s exactly the same code that we wrote for the <em>Event</em> class earlier in the chapter. Along with this there are some changes that need to be made to our <em>GameManager</em> class. As you may recall SFML gives us windows and system events. Unfortunately SFML events are not compatible with our event system out-of-the-box. We need to translate those SFML events into our events &#8212; and that will be our first task. First we create the events themselves &#8211;</p>
<pre class="brush: python; title: ; notranslate">
    def Init(self):
        ...
        ...
        self.closeEvent = event.Event()
        self.resizedEvent = event.Event()
        self.lostFocusEvent = event.Event()
        self.gainedFocusEvent = event.Event()
        self.textEnteredEvent = event.Event()
        self.keyPressedEvent = event.Event()
        self.keyReleasedEvent = event.Event()
        self.mouseWheelEvent = event.Event()
        self.mouseLButtonDownEvent = event.Event()
        self.mouseRButtonDownEvent = event.Event()
        self.mouseMButtonDownEvent = event.Event()
        self.mouseLButtonUpEvent = event.Event()
        self.mouseRButtonUpEvent = event.Event()
        self.mouseMButtonUpEvent = event.Event()
        self.mouseMoveEvent = event.Event()
        self.mouseEnteredEvent = event.Event()
        self.mouseLeaveEvent = event.Event()
        self.joyButtonPressedEvent = event.Event()
        self.joyButtonReleasedEvent = event.Event()
        self.joyMovedEvent = event.Event()
        ...
        ...
</pre>
<p style="text-align: justify;">This is done in the Init() function of the <em>GameManager</em>. Now any game object that wants to receive events can add it&#8217;s handlers to these events of the GameManager. But, when do these events fire? They are fired when SFML gives us an event. We do the translation in the function <em>TranslateSFMLEvents</em>, which is the first thing called inside the <em>game loop</em>. The code for that is something like this &#8211;</p>
<pre class="brush: python; title: ; notranslate">
def TranslateSFMLEvents(self):
'''Translates the SFML events to Game Events.'''
sfmlEvent = sf.Event()
while self.window.GetEvent(sfmlEvent):
    if sfmlEvent.Type == sf.Event.Closed:
        self.closeEvent.Fire()
    elif sfmlEvent.Type == sf.Event.Resized:
        self.resizedEvent.Fire(sfmlEvent.Size.Width, sfmlEvent.Size.Height)
    elif sfmlEvent.Type == sf.Event.LostFocus:
        self.lostFocusEvent.Fire()
     ...
     ...
     ...
</pre>
<p style="text-align: justify;">(The entire code is available at the bottom of the chapter.)</p>
<p style="text-align: justify;">If you observe closely, you will see that for some events the <em>Fire</em> function takes arguments. Well the fact is that events are used to communicate information and for some events there is sometimes the need to pass arguments. For example, for the Resize event, new width and height is passed as an argument to the function Fire. Correspondingly every handler attached to that event Resize will receive width and height as arguments. Most events that we will be using and creating, will have arguments in the Fire function. That&#8217;s just an easy way to communicate instead of cryptic callbacks.</p>
<p style="text-align: justify;">We have a long list of events in the Init function of our GameManager. Most of these events will be used later on but for now let&#8217;s use the closeEvent to close our window. So our original code for closing the window turns event based into something like this.</p>
<pre class="brush: python; title: ; notranslate">
    def Init(self):
        ...
        ...
        ...
       self.closeEvent += self.OnClose
       ....

   def OnClose(self):
       self.running = False
</pre>
<p style="text-align: justify;">That&#8217;s about it in this chapter. We will be using this event system even with things like Rendering and Updates later on. For now you can fiddle around with the SFML events and see how each of those events are invoked. In our code the GameManager simply prints out the event and it&#8217;s arguments.</p>
<h3>Downloads</h3>
<ul>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/01/dash_ch6.zip">dash_ch6.zip</a></li>
</ul>The post <a href="https://rapidgamebuilder.com/2011/01/the-event-system/">A Dash of Game Development – 6. The Event System.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
					<wfw:commentRss>https://rapidgamebuilder.com/2011/01/the-event-system/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">252</post-id>	</item>
		<item>
		<title>A Dash of Game Development – 5. Going Object Oriented.</title>
		<link>https://rapidgamebuilder.com/2011/01/going-object-oriented/</link>
					<comments>https://rapidgamebuilder.com/2011/01/going-object-oriented/#comments</comments>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Sat, 01 Jan 2011 20:45:38 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=214</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2011/01/going-object-oriented/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.In the previous chapters we finished with the basic outline of a game. However, this simple outline isn&#8217;t going to take us too far when it comes to building a [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2011/01/going-object-oriented/">A Dash of Game Development – 5. Going Object Oriented.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2011/01/going-object-oriented/">https://rapidgamebuilder.com/2011/01/going-object-oriented/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">In the previous chapters we finished with the basic outline of a game. However, this simple outline isn&#8217;t going to take us too far when it comes to building a complex interactive game. It&#8217;s time we added structure to this outline so that we can build it into something that we can actually use to create our game.</p>
<p style="text-align: justify;">For the sake of reference let me copy paste the outline of the game we have from the previous chapter.</p>
<pre class="brush: plain; title: ; notranslate">
InitializeGame

while Running :
        CheckForUserInput
        BuildEventQueue
        if Required.Event in EventQueue :
               TakeAction

        UpdateGameEntities
        ClearTheView
        DrawEntities
        DisplayTheBitmap

CleanupAndClose
</pre>
<p>Most of our pseudo code can be written in the form of discrete functions. To make the out line more OOP friendly, let&#8217;s group the functions into a class. We will call this class a <em>GameManager</em>, since it obviously manages the game. We will add more game management functions to it as we progress, but for now let&#8217;s focus on what we know. I hope you have a good handle on Python, because I am assuming at least a basic understanding of Python and OOP.</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

from PySFML import sf

class GameManager():

    def Init(self):
        '''Initiates the game and it's resources. All resource'''
        '''loading can be done here'''
        self.window = sf.RenderWindow(sf.VideoMode(800, 600), &quot;Rapid Game Framework&quot;)
        self.running = True
        return True

    def GameLoop(self):
        '''Starts the Game Loop'''
        while self.running:

            # Get the close event
            event = sf.Event()
            while self.window.GetEvent(event):
                if event.Type == sf.Event.Closed:
                    self.running = False

            # Update the game entities
            self.UpdateEntities()

            # Clear the screen.
            self.window.Clear()

            # Draw all entities.
            self.DrawEntities()

            # Display the contents of the bitmap.
            self.window.Display()

        return True

    def Shutdown(self):
        '''Calls Cleanup function and closes the window and exits the game.'''

        # Clean up.
        self.Cleanup()

        # Close our window.
        self.window.Close()
        return True

    def UpdateEntities(self) :
        '''Updates all the game entities'''

    def DrawEntities(self) :
        '''Draws all the game entities.'''

    def Cleanup(self) :
        '''Clean up by freeing all entities'''

if __name__ == '__main__':
    mgr = GameManager()
    if mgr.Init() :
        mgr.GameLoop()
    mgr.Shutdown()
</pre>
<p style="text-align: justify;">The <em>GameManager</em> is a class that has all the functions from our outline. If you have been following the previous tutorials the function and their names must be self explanatory. The <em>__main__</em> function of out code creates, initiates, runs the <em>GameManager</em> and finally closes and cleans up the game. That was pretty simple, wasn&#8217;t it? The only addition to the above outline was the <em>Shutdown</em> function. I&#8217;ll get into it in more detail in the later chapters, but for now let&#8217;s just think of it as the last step in our game close process.</p>
<p style="text-align: justify;">The current outline does very little except open and close a window. We will expand it in later chapters. As an exercise you can try adding the scrolling text we had from the previous chapters to this outline. It should be pretty easy.</p>
<p style="text-align: justify;">As you can well see, the code is getting longer. As we continue, the code will get even longer and span across multiple files. Thus henceforth, for brevity, I will be posting only code snippets in posts and mention only function and class names. Be sure you understand the outline and the code mentioned here. We will be using the same function names and the <em>GameManger</em> class from here on. You can always find the entire code for all the examples at the bottom of each chapter.</p>
<h3>Downloads</h3>
<ul>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/01/outline.py">outline.py</a></li>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2011/01/scrollingtext.py">scrollingtext.py</a></li>
</ul>The post <a href="https://rapidgamebuilder.com/2011/01/going-object-oriented/">A Dash of Game Development – 5. Going Object Oriented.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
					<wfw:commentRss>https://rapidgamebuilder.com/2011/01/going-object-oriented/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">214</post-id>	</item>
		<item>
		<title>A Dash of Game Development – 4. Display and Co-ordinate System.</title>
		<link>https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/</link>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Thu, 16 Dec 2010 06:50:42 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=165</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.The previous chapter dealt with the general outline of a game and we saw a basic flow of how a game works. We will slowly add more to that but [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/">A Dash of Game Development – 4. Display and Co-ordinate System.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/">https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">The previous chapter dealt with the general outline of a game and we saw a basic flow of how a game works. We will slowly add more to that but before we move on, a little bit of theory has be looked into. The reason I want to get into this now, is because as a game developer you ought to have an understanding of display and co-ordinates. We will be using terms and phrases introduced here in later chapters quite frequently.</p>
<p style="text-align: justify;">Graphics are almost always displayed on any display device via a <em>bitmap</em> also called as a <em>raster graphics image</em>. The bitmap is the more frequently used term of the two and is sometimes interchangeably used with the term <em>image</em>. At it&#8217;s very core a bitmap is a data structure having a rectangular grid of color points called <em>pixels</em>. A <em>pixel</em> is the smallest addressable bitmap element, i.e. it is the smallest unit of a bitmap that can be controlled. Every pixel in a bitmap has its own address. The address of the pixel corresponds to it&#8217;s co-ordinates inside the bitmap. You can think of a pixel as the tiniest dot inside a bitmap and a bitmap as several rows of these tiny dots (pixels). The image seen on your computer screen is also a bitmap and the computer draws/refreshes it several times a sec (60, 75, 100) depending on the refresh rate of your monitor.</p>
<p style="text-align: justify;">Since the image displayed your computer screen is in fact a bitmap, most of the the time it is just addressed as a &#8216;Screen&#8217; instead of a screen bitmap &#8212; and that is exactly why the &#8216;Screen&#8217; dimensions are given in pixels. So if your monitor has the dimensions of 1024 x 768, it means that internally there is a bitmap somewhere of the size 1024  pixels (columns) by 768 pixels (rows) where all the drawing takes place. (Who does the drawing, how the drawing takes place and where the bitmap resides is something we will come to later, but that shouldn&#8217;t concern us right now.) Screen dimensions are known as resolutions and because of hardware limitations, monitors can&#8217;t (as of writing this) support any arbitrary resolution. There is usually a fixed set of screen resolutions a monitor can support. We will come to that in later chapters when we discuss portability issues.</p>
<p style="text-align: justify;">Now that we know what bitmaps are, and that a screen is one large bitmap, lets look at the components of the screen that also have bitmaps. Yes, they are the individual windows. Think of it this way, every individual window on the screen has it&#8217;s own bitmap. While refreshing the screen, the system GUI draws all the individual window bitmaps (or parts that are visible), composites them into the screen bitmap and displays the bitmap on the monitor. This is probably a very simplistic view of a very complicated flow. The thing that concerns us is the window&#8217;s bitmap. That&#8217;s where our game contents are drawn and just like the screen, our window&#8217;s bitmap is associated with the view contents of the window. We will call this as our <em>game view</em> or simply as <em>&#8216;View&#8217;</em>.</p>
<p style="text-align: justify;">The <em>view</em> just like our <em>screen</em>, corresponds to a bitmap and it&#8217;s dimensions are also given in pixels. In our example (<a href="https://rapidgamebuilder.com/wp-content/uploads/2010/12/first.py">first.py</a>) we create a RenderWindow and give it a video mode of 800 x 600, which tells SFML  to create a View of size of 800 x 600 pixels. The View that is created has it&#8217;s origin on the top left corner, i.e. The pixel(0,0) represents the topmost and the leftmost pixel of the view. The rows and columns of the view are considered as axes of the view, with the x-axis representing the the columns and y-axis representing the rows of the pixels. We will call them co-ordinate axes.</p>
<figure id="attachment_175" aria-describedby="caption-attachment-175" style="width: 300px" class="wp-caption aligncenter"><a href="https://rapidgamebuilder.com/wp-content/uploads/2010/12/screen.png"><img loading="lazy" decoding="async" class="size-full wp-image-175 " title="View and Co-ordinate axes" src="https://rapidgamebuilder.com/wp-content/uploads/2010/12/screen.png" alt="View and Co-ordinate axes" width="300" height="235" /></a><figcaption id="caption-attachment-175" class="wp-caption-text">View and Co-ordinate axes.</figcaption></figure>
<p style="text-align: justify;">To draw anything on the view you need to tell SFML the location and that is done using co-ordinates. Let&#8217;s return back to our code and see how we do our drawing. The functions we are going to discuss are the ones highlighted below.</p>
<pre class="brush: python; highlight: [22,23,24,25,28,29,30]; title: ; notranslate">
#!/usr/bin/python

from PySFML import sf

# Initialize the game components.
window = sf.RenderWindow(sf.VideoMode(800, 600), &quot;Our First Animation&quot;)
text = sf.String(&quot;I am a priece of Scrolling Text&quot;)
x = 0.0
y = 30.0
running = True

# Start our Game Loop
while running:

    # Get the input from the player as an event
    event = sf.Event()
    while window.GetEvent(event):
        if event.Type == sf.Event.Closed:
            running = False

    # Update the position of our text.
    x = x + 0.3
    if x &gt; 800.0 :
        x = -400.0
    text.SetPosition(x,y)

    # Draw the text.
    window.Clear()
    window.Draw(text)
    window.Display()

# Close the window and end the application.
window.Close()
</pre>
<p style="text-align: justify;">What do the lines 22 to 25 do? Since we now understand the co-ordinate system, it&#8217;s  pretty easy to follow. The code simply sets the position of the text to be displayed (in pixels). For every iteration the x co-ordinate is updated. When the x co-ordinate becomes larger than 800, i.e. goes off the screen, we set the x co-ordinate to -400 so the text snaps back and appears to be scrolling.</p>
<p style="text-align: justify;">Then we take a look at that the drawing code (lines 28-30). It&#8217;s now not difficult to understand what is going on there as well. First, we simply ask the window to clear the View &#8212; then we ask it to draw the text, and finally we ask the window to display the bitmap. But why are there 3 functions? Lets first look at the function Draw(). Draw seems to be self explanatory &#8212; yes, it does draw the text. However, Draw itself doesn&#8217;t show anything on the view. If you were to comment out the line window.Display() (line 30),  you will not see anything at all. Why? Because the <em>draw</em> happens on a bitmap internally but the bitmap itself isn&#8217;t shown. The function Display() is the one that <em>flips/swaps</em> the bitmap so that it can be displayed. The function Clear() (line 28) clears the contents of the bitmap before drawing anything. If you were to comment out Clear(), you will see the previous contents along with the new contents. Later on we will get into more details about buffer swapping and things like double buffering. For now let&#8217;s keep things a bit more simple.</p>
<p style="text-align: justify;">Why is <em>Display</em> a separate function from <em>Draw</em>? That&#8217;s because a game can have a lot of entities that need to be drawn per frame. Swapping a bitmap is a slow process and ideally should only take place once per iteration of the loop. When there are a lot of entities, you would call a draw on each one before calling Display() only once after all the entities have finished drawing.</p>
<p style="text-align: justify;">With that information, it&#8217;s time to extend the outline of our game to include the draw functions.</p>
<pre class="brush: plain; highlight: [10,12]; title: ; notranslate">
InitializeGame

while Running :
        CheckForUserInput
        BuildEventQueue
        if Required.Event in EventQueue :
               TakeAction

        UpdateGameEntities
        ClearTheView
        DrawEntities
        DisplayTheBitmap

CleanupAndClose
</pre>
<p style="text-align: justify;">We have finished with our outline. In the next chapter we look at putting this in an object oriented framework.</p>The post <a href="https://rapidgamebuilder.com/2010/12/display-and-coordinate-system/">A Dash of Game Development – 4. Display and Co-ordinate System.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">165</post-id>	</item>
		<item>
		<title>A Dash of Game Development &#8211; 3. Basic Outline and Our First Animation.</title>
		<link>https://rapidgamebuilder.com/2010/12/basic-outline/</link>
					<comments>https://rapidgamebuilder.com/2010/12/basic-outline/#comments</comments>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Sun, 12 Dec 2010 08:52:28 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=97</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2010/12/basic-outline/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.I hope your tool chain is all setup right. In that case we move along and actually write some code. We will use the same code from the earlier chapter [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2010/12/basic-outline/">A Dash of Game Development – 3. Basic Outline and Our First Animation.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2010/12/basic-outline/">https://rapidgamebuilder.com/2010/12/basic-outline/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">I hope your tool chain is all setup right. In that case we move along and actually write some code. We will use the same code from the earlier chapter and add more things to it as we go along. The code does very little as yet, but our short piece of code (first.py) has some important and core concepts that are central to most games. More complex games are built around these basic core concepts.</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

from PySFML import sf

# Initialize the game components.
window = sf.RenderWindow(sf.VideoMode(800, 600), &quot;Test Application&quot;)
text = sf.String(&quot;Hello Game Development&quot;)
running = True

# Start our Game Loop
while running:

    # Get the input from the player as an event.
    event = sf.Event()
    while window.GetEvent(event):
        if event.Type == sf.Event.Closed:
            # The player wants to quit the game.
            running = False

    window.Clear()
    window.Draw(text)
    window.Display()
window.Close()
</pre>
<h4>Game Loop:</h4>
<p style="text-align: justify;">The first and foremost term to introduce is the game loop. A game loop is just a fancy name given to a looping control flow statement which runs continuously until a boolean condition remains True. In our case the game loop is a <em>while</em> loop and the boolean condition is simply the variable <em>&#8216;running&#8217;</em>. The loop runs as long as <em>running</em> remains True. When <em>running</em> is set to False, the loop exits, effectively ending the game.  As you must has guessed the game loop is where the game action actually takes place. It&#8217;s where the shots are fired, enemies are killed swords are slashed and magic is unleashed!</p>
<h4>Input:</h4>
<p style="text-align: justify;">An Input typically occurs when the player/s wants to interact with the game and do so via a input device. An example of an input-device is a keyboard but there are other fancier input devices like Joysticks, Keypads and many more.</p>
<h4>Event:</h4>
<p style="text-align: justify;">Events are what makes a game interactive. An event is not to be confused with input. An input can cause an event, however events are not limited to input alone. There are other instances which can generate events. For instance, in-game interactions between game elements can also generate events. An event can be external or internal is origin. A player pressing a key on a keyboard is an example of an externally generated event. A mine going off because an NPC tripped it&#8217;s fuse wire is an internally generated event.</p>
<h4>Action:</h4>
<p style="text-align: justify;">Actions can occur in response to events. For example &#8212; If the player <em>pushes the arrow key</em> (event), the in-game player character <em>moves forward</em> (action). Here the player pressing the arrow key generates an event, which executes the <em>move forward</em> action. It is not necessary though that every event generate an action. Sometimes events may generate no action at all and are completely ignored. For instance, a player pressing a key that is not mapped to any action will discard that event and simply not create any action.</p>
<h4>Resource:</h4>
<p style="text-align: justify;">Any data or file required by the game to run and simulate the game is generally called a resource. Images, sound files, data files are all examples of resources. A resource is usually not a piece of code, though it&#8217;s not a hard and fast rule. Many games use scripts which may also be considered as a resource. A game can have a large number of resources. A large game can have resources that are several Gigabytes and that number increases with every generation.</p>
<p style="text-align: justify;">Before we proceed further, lets look at our code (first.py) and see where all these new terms fit in. The program begins with the creation of a window. This is where the game contents will be drawn. PySFML takes care of the nitty-grittys of creating the window and isolates us from unnecessary platform specific issues. After that the <em>&#8216;text&#8217;</em> and <em>&#8216;running&#8217;</em> are created and initialized. The point to note here is, line numbers 6-8 in the code serve as an <em>initiation routine</em> for our game. Most games have, and sometimes can have a lengthy initiation process. The initiation process of the game is also the place where the resources of a game that are on the disk get loaded. Reading from the disk or any storage medium is always a slow process and it&#8217;s because of this, games usually initialize and load resources before the game loop starts. The &#8216;Loading&#8230;&#8217; screen seen just before the start of a game is where the initiation and loading of resources take place. For very big games where the data per level is in several Megabytes, resource loading can take place on a per level basis.</p>
<p style="text-align: justify;">Coming back to our code &#8212; The Game Loop begins on line 11 and the very first thing we do is check for user input. Again, PySFML abstracts away the input checking code internally and goes a step further by directly building an event queue. All we have to do is check if an event that we are interested in, is in the queue. That is exactly what we do on line 16. We check if the player tried to exit the game by closing the window. If he did, we set <em>running</em> to False. That&#8217;s our <em>action</em> in response to an <em>event</em>. The next few lines of code draw the text on the screen, and we will come to drawing and what those 3 statements do in later chapters. For now take my word for it. Also, remember the game loop runs continuously till the player decides to quit, so the things explained in this paragraph happen repeatedly while the loops runs.</p>
<p style="text-align: justify;">The code in first.py displays a text, but that isn&#8217;t what a game is about. A game is usually about moving things, smashing, shooting, colliding. Our current code is no fun! So lets move on then! Yes, we will get to shooting, colliding, smashing later on, but for now lets keep things a bit more simple (for the sake of learning). Lets make the text move, or should I say scroll. Look at the code below. Lets call it (anim.py)</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

from PySFML import sf

# Initialize the game components.
window = sf.RenderWindow(sf.VideoMode(800, 600), &quot;Our First Animation&quot;)
text = sf.String(&quot;I am a priece of Scrolling Text&quot;)
x = 0.0
y = 30.0
running = True

# Start our Game Loop
while running:

    # Get the input from the player as an event
    event = sf.Event()
    while window.GetEvent(event):
        if event.Type == sf.Event.Closed:
            running = False

    # Update the position of our text.
    x = x + 0.3
    if x &gt; 800.0 :
        x = -400.0
    text.SetPosition(x,y)

    # Draw the text.
    window.Clear()
    window.Draw(text)
    window.Display()

# Close the window and end the application.
window.Close()
</pre>
<p style="text-align: justify;">If you run the code above, you will see a scrolling piece of text instead of a static one, and that brings us to the last thing that we introduce in this chapter. The <em>update routine</em>. The update routine updates the game elements. In our case it updates the position of the text, but update is not specific to entity or element position. Our small little update routine starts at line 22 and does nothing but change the position of the text on the screen. However, an entity or an element within a game can update a lot of things including it&#8217;s position, state, behavior in an <em>update</em> (as we will see in later chapters).</p>
<p style="text-align: justify;">Well there you have it! Our small little animation! Now, lets go over the things we have understood from our small animation and build an outline of our game &#8212; We start off with <em>Initiation</em>, then we move on and begin our <em>Game Loop</em>. In the loop the first thing we do is check for <em>User Input</em>. PySFML saves us the trouble and gives us <em>Events</em> directly. If there is a quit event, we take the appropriate <em>Action</em> and set our loop state to quit. If not, we <em>Update</em> the position of our text, <em>Draw</em> the text and loop back again to test for user input.</p>
<p style="text-align: justify;">So our outline will be something like this:</p>
<pre class="brush: plain; title: ; notranslate">
InitializeGame

while Running :
        CheckForUserInput
        BuildEventQueue
        if Required.Event in EventQueue :
               TakeAction

        UpdateGameEntities
        DrawEntities
CleanupAndClose
</pre>
<p style="text-align: justify;">There you go. You have now understood the basic layout of a computer game. Yes, most games even the AAA ones follow this simple outline.</p>
<p style="text-align: justify;">In the following chapters we will start diving into more complex programming constructs like OOP. We will take this simple framework and make it an Object Oriented one. It will eventually allow us to add more complexity, richer interactivity, more game elements and far more than just one line of scrolling text.</p>
<p style="text-align: justify;"><em>Note: Games needn&#8217;t be modeled using events and actions, but it is often easier and more intuitive to do so. Some games use polling instead of events. Polling is where the game-engine polls inputs instead of receiving events from them. While this works with input, in-game interactions are often cumbersome to design using polling. Whichever way you look at it, (polling or events) it&#8217;s still pretty much the same thing.</em></p>
<h3>Downloads</h3>
<ol>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2010/12/anim.py">anim.py</a></li>
</ol>The post <a href="https://rapidgamebuilder.com/2010/12/basic-outline/">A Dash of Game Development – 3. Basic Outline and Our First Animation.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
					<wfw:commentRss>https://rapidgamebuilder.com/2010/12/basic-outline/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">97</post-id>	</item>
		<item>
		<title>A Dash of Game Development – 2. Installation and Setting up.</title>
		<link>https://rapidgamebuilder.com/2010/12/installation-and-setting-up/</link>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Mon, 06 Dec 2010 12:55:54 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=72</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2010/12/installation-and-setting-up/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.In the previous chapter we had a brief introduction of the tool-chain we will be using. Now it&#8217;s time to set it up for the game we will be developing. [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2010/12/installation-and-setting-up/">A Dash of Game Development – 2. Installation and Setting up.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2010/12/installation-and-setting-up/">https://rapidgamebuilder.com/2010/12/installation-and-setting-up/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">In the <a href="https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/">previous chapter</a> we had a brief introduction of the tool-chain we will be using. Now it&#8217;s time to set it up for the game we will be developing. So lets begin by first downloading the individual components.</p>
<p>Python (version 2.7): <a href="http://www.python.org/download/">http://www.python.org/download/<br />
</a>PySFML (version 1.6): <a href="http://www.sfml-dev.org/download.php">http://www.sfml-dev.org/download.php<br />
</a>PyOpenGL (3.0.1): <a href="http://pypi.python.org/pypi/PyOpenGL">http://pypi.python.org/pypi/PyOpenGL</a></p>
<p>Optionally you can also install <a href="http://www.gimp.org/">GIMP</a>, <a href="http://www.getpaint.net/">Paint.NET</a> and <a href="http://notepad-plus-plus.org/">Notepad++</a>.</p>
<p style="text-align: justify;">Windows users will generally only need a one click installer, which most of the packages do provide. Most Linux distros will have Python bundled with distribution. If you have a 2.x version, there is no real need to install a separate version.</p>
<p style="text-align: justify;">Installing PySFML for Windows is just as easy. For Linux and Mac users you need to either download the binaries provided or build SFML (C++) and then <a href="http://www.sfml-dev.org/tutorials/1.6/start-python.php">build the Python bindings</a>.</p>
<p style="text-align: justify;">After doing all that, it&#8217;s time to test if our setup works.  Open your favorite  text editor and type in the following code:</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

from PySFML import sf

window = sf.RenderWindow(sf.VideoMode(800, 600), &quot;Test Application&quot;)

text = sf.String(&quot;Hello Game Development&quot;)

running = True
while running:
    event = sf.Event()
    while window.GetEvent(event):
        if event.Type == sf.Event.Closed:
            running = False

    window.Clear()
    window.Draw(text)
    window.Display()
window.Close()
</pre>
<p style="text-align: justify;">Save the file as &#8216;first.py&#8217; in some folder. Open a command prompt navigate to the folder where the file was saved and type in:</p>
<pre class="brush: plain; light: true; title: ; notranslate">python first.py</pre>
<p style="text-align: justify;">If you can see a window with the words &#8220;Hello Game Development&#8221; like the one below your installation and setup is correct.</p>
<figure id="attachment_82" aria-describedby="caption-attachment-82" style="width: 320px" class="wp-caption alignnone"><a href="https://rapidgamebuilder.com/wp-content/uploads/2010/12/first.jpeg"><img loading="lazy" decoding="async" class="size-full wp-image-82" title="Our first program." src="https://rapidgamebuilder.com/wp-content/uploads/2010/12/first.jpeg" alt="Our first program." width="320" height="251" srcset="https://rapidgamebuilder.com/wp-content/uploads/2010/12/first.jpeg 320w, https://rapidgamebuilder.com/wp-content/uploads/2010/12/first-300x235.jpg 300w" sizes="auto, (max-width: 320px) 100vw, 320px" /></a><figcaption id="caption-attachment-82" class="wp-caption-text">Our first program.</figcaption></figure>
<p style="text-align: justify;">Don&#8217;t worry if you don&#8217;t understand anything in the code we will get to it later.</p>
<h3>Downloads :</h3>
<ol>
<li><a href="https://rapidgamebuilder.com/wp-content/uploads/2010/12/first.py">first.py</a></li>
</ol>
<p style="text-align: left;">The post <a href="https://rapidgamebuilder.com/2010/12/installation-and-setting-up/">A Dash of Game Development – 2. Installation and Setting up.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">72</post-id>	</item>
		<item>
		<title>A Dash of Game Development &#8211; 1. Introduction and Getting Started.</title>
		<link>https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/</link>
					<comments>https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/#comments</comments>
		
		<dc:creator><![CDATA[Susheel Raut]]></dc:creator>
		<pubDate>Sun, 05 Dec 2010 13:43:15 +0000</pubDate>
				<category><![CDATA[A Dash of Game Development]]></category>
		<category><![CDATA[Get started]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SFML]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">http://www.rapidgamebuilder.com/?p=29</guid>

					<description><![CDATA[<p>Visit the original article at https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/. Find this and a series of articles at Rapid Game Builder. Copyright © 2026 3D Logic Software. All rights reserved.This is the first in the series of chapters that should get you started with game development. But before we begin, let me go over some mandatory introductions and how [&#8230;]</p>
The post <a href="https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/">A Dash of Game Development – 1. Introduction and Getting Started.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></description>
										<content:encoded><![CDATA[Visit the original article at <a href="https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/">https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/</a>. Find this and a series of articles at <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>. Copyright © 2026 <a href="http://www.3dlogicsoftware.com/">3D Logic Software</a>. All rights reserved.<br /><p style="text-align: justify;">This is the first in the series of chapters that should get you started with game development. But before we begin, let me go over some mandatory introductions and how the following chapters will be organized. This is the first chapter and it focuses on what you need to know and what you can do without while following these tutorials. It also tells you the tool-chain you will be using to create a game explained in the coming chapters.</p>
<p style="text-align: justify;">Though the following chapters are beginner chapters, they are not meant to teach programming. If you don&#8217;t have any experience with programming, I am sorry this is <strong>not</strong> the place to start. It is recommended that you at the very least have some understanding of programming. An advanced level of programming knowledge is not required. If you are not a programmer (yet), don&#8217;t worry, this is a good time to start. It&#8217;s not all that difficult. You can begin with some simple introductory material like the <a href="http://en.wikibooks.org/wiki/Non-Programmer's_Tutorial_for_Python_2.6">Non-Programmer&#8217;s Tutorial for Python</a> or <a href="http://diveintopython.org/">Dive Into Python</a> then come back here and continue.</p>
<p style="text-align: justify;">The initial tutorials use <a href="http://www.python.org/">Python</a> to introduce game development concepts. No, we won&#8217;t begin with languages like C or C++ and there is a good reason for that. Python is easier to understand than C and C++. It will get you into game development faster, allowing you to learn the<em> process of game development</em> rather than fight with language intricacies and unfriendly syntax. C++ will be introduced later and we will briefly discuss how to leverage the power of  C++ and how you can blend scripting languages like <a href="http://www.lua.org/">Lua</a> and Python with C++ to get the desired performance out of your game.</p>
<p style="text-align: justify;">All chapters follow a hands-on approach to game development. It is recommended that you write code as you go along with the reading. We will be developing a full game, albeit a small one &#8212; enough to make you understand what a game is all about. It should help you understand how modules of a game interact and what is it you need to do to write your own game, fast and simple. We will not be using a game engine per say, but we will be using <a href="http://www.sfml-dev.org/">SFML</a> which stands for <em>Simple and Fast Multimedia Library</em>. It is a platform independent abstraction layer for graphics, input, audio and networking modules. The initial chapters use python bindings for SFML.</p>
<p style="text-align: justify;">Later chapters also talk about art and art creation. Again, I am not going to go into details of art creation for games. I hope you take some time and familiarize yourself with either <a href="http://www.gimp.org/">GIMP</a> or <a href="http://www.getpaint.net/">Paint.NET</a> if you want to create custom art. You can use the art from these tutorials just fine and that should be more than enough to get you through. Learning how to create game art is not really necessary for these tutorials.</p>
<p style="text-align: justify;">There is no need for fancy IDEs or text editors. For Windows users I would recommend <a href="http://notepad-plus-plus.org/">Notepad++</a> but your simple notepad, vim, emacs or whatever will do just fine. Most of the code presented will be cross-platform compatible and should run on systems where the libraries and tool-chain mentioned is available. Getting the code to work on Win32, Linux, Mac OS shouldn&#8217;t be a problem.</p>
<h4><strong>Tool-Chain:</strong></h4>
<ul>
<li>Text Editor. (<a href="http://notepad-plus-plus.org/">Notepad++</a>, vim, emacs, etc.)</li>
<li><a href="http://www.python.org/">Python</a> 2.7.</li>
<li><a href="http://www.sfml-dev.org/download.php">PySFML</a>.</li>
<li><a href="http://pyopengl.sourceforge.net/">PyOpenGL</a>. (Python OpenGL bindings used in later chapters.)</li>
<li>Image Editor. (<a href="http://www.gimp.org/">GIMP</a>, <a href="http://www.getpaint.net/">Paint.NET</a>, etc.)</li>
</ul>
<p style="text-align: justify;">More libraries and tools will be added to the tool-chain as we progress. For the initial few chapters, this is all you are going to need.</p>
<p style="text-align: justify;"><span style="font-size: small;"><em>(A note on Python 3.x. As of writing this tutorial, there were some problems encountered while assembling a Python 3.x tool-chain. Many modules and libraries were not available for Python 3 or had to be compiled from scratch, leading to a lot of difficulties. Unfortunately I had to stick to Python 2.7, but I am sure porting code to Python 3 later on won&#8217;t be too difficult.)</em></span></p>The post <a href="https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/">A Dash of Game Development – 1. Introduction and Getting Started.</a> first appeared on <a href="https://rapidgamebuilder.com">Rapid Game Builder</a>.]]></content:encoded>
					
					<wfw:commentRss>https://rapidgamebuilder.com/2010/12/introduction-and-getting-started/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">29</post-id>	</item>
	</channel>
</rss>
