Game Programming at scriptedfun » gamedev http://www.scriptedfun.com Game Programming for Beginners: Video Tutorials, Source Code, and Articles Thu, 11 Sep 2008 17:45:09 +0000 en hourly 1 http://wordpress.org/?v=3.3.1 http://creativecommons.org/licenses/by/2.5/ Multiplayer Dots and Boxes http://www.scriptedfun.com/multiplayer-dots-and-boxes/ http://www.scriptedfun.com/multiplayer-dots-and-boxes/#comments Thu, 11 Sep 2008 17:45:09 +0000 Chuck http://www.scriptedfun.com/?p=117 Hi everyone! I finally managed to complete a game using Nonoba’s Multiplayer API, and this is what I came up with:

Multiplayer Dots and Boxes screenshot

Please play the game now – and bring a friend with you! If you have your own site / blog / page, I highly encourage you to embed the game in it as well. Basically, please help me promote this game all over the net!

I had a lot of fun implementing this classic pencil and paper game, writing the client in pure ActionScript using the free Flex SDK, and the server using Visual C# Express. This is truly an exciting time to be a game developer – multiplayer Flash games that can be played across different sites all over the net can now be built easily using free tools only!

To put things back on track, I hope to release the source code of the game in a week or so, but in the meantime, please share this game with all your friends! Thank you!

]]>
http://www.scriptedfun.com/multiplayer-dots-and-boxes/feed/ 0 http://creativecommons.org/licenses/by/2.5/
Co-founders of Codemasters made ‘Commanders of the Order of the British Empire (CBE)’ http://www.scriptedfun.com/co-founders-of-codemasters-made-commanders-of-the-order-of-the-british-empire-cbe/ http://www.scriptedfun.com/co-founders-of-codemasters-made-commanders-of-the-order-of-the-british-empire-cbe/#comments Sat, 14 Jun 2008 16:02:31 +0000 Chuck http://www.scriptedfun.com/?p=116 Full story at the BBC.

I am happy that the brothers David and Richard Darling, who started their company in the mid-80′s, were honored for their “services to the computer games industry”. They have blazed a trail for independent game developers to follow, and I am truly grateful to them for their pioneering efforts as bedroom coders.

David and Richard, I salute you.

]]>
http://www.scriptedfun.com/co-founders-of-codemasters-made-commanders-of-the-order-of-the-british-empire-cbe/feed/ 0 http://creativecommons.org/licenses/by/2.5/
Poor Man’s Flash http://www.scriptedfun.com/poor-mans-flash/ http://www.scriptedfun.com/poor-mans-flash/#comments Fri, 16 May 2008 16:05:31 +0000 Chuck http://www.scriptedfun.com/?p=113 John Hattan has written a review of Express Animator on GameDev.net, and Flex SDK / Silverlight developers who do not have access to the corresponding designer’s tools (Flash / Expression Blend) might find his review interesting. Express Animator, as stated in the product name, is a tool that allows you to make animations, and publish them in SWF format for Flash, or XAML format for Silverlight. This basically allows you to make animations for your Flex / Silverlight project for just US$39, instead of paying US$699 for Flash or US$499 for Expression Blend. You won’t be getting all the features of the more expensive products, but you might be surprised to know that Express Animator has features which the other two do not, such as “hierarchical bones”. From the review:

In fact, the combination of Express Animator with the free Flex or MTASC compiler would make for a pretty good “Poor Man’s Flash” product that could be used to make full Flash CS3 quality games, and for quite a bit less than the $699 that you’d spend on a new license of Flash CS3.

]]>
http://www.scriptedfun.com/poor-mans-flash/feed/ 0 http://creativecommons.org/licenses/by/2.5/
Music and Sound Effects for Games http://www.scriptedfun.com/music-and-sound-effects-for-games/ http://www.scriptedfun.com/music-and-sound-effects-for-games/#comments Thu, 15 May 2008 13:15:57 +0000 Chuck http://www.scriptedfun.com/?p=112 A great article called Tools of the Trade has just been posted on MochiLand. It gives a list of software and libraries which you can use to generate sound effects and music for your games.

Among the different aspects of game development, I think I’m weakest at sound matters. This is something that has to change though, with the success that audio-based games have been having, such as the IGF winner Audiosurf and the Python-based Frets on Fire.

It’s good that Kunal Joshi pointed out in the comments the amazing DrPetter’s sfxr, an excellent (and free!) piece of software that generates retro-style sound effects. This was used by Kian in his very funny, and VERY ORIGINAL (you have to see it!) game You Have To Burn The Rope.

]]>
http://www.scriptedfun.com/music-and-sound-effects-for-games/feed/ 0 http://creativecommons.org/licenses/by/2.5/
Make a Flash Game for Free http://www.scriptedfun.com/make-a-flash-game-for-free/ http://www.scriptedfun.com/make-a-flash-game-for-free/#comments Thu, 08 May 2008 15:41:20 +0000 Chuck http://www.scriptedfun.com/?p=107 One of the main reasons why people aren’t able to make their own Flash games is because the development environment is expensive. Currently, a copy of Flash CS3 Professional costs US$699, an amount which most people can’t just pull out of their wallet (although I think that this price is very reasonable, considering the product’s quality and the possibilities that it offers).

Fortunately, there are several alternatives to Flash for making Flash content. One of these alternatives is the Flex SDK, a free product which Adobe itself offers.

I’ve spent some time with the Flex SDK over the past months, and I’ve had success in writing games with it. Herder is my first game with the Flex SDK, and I have a few others which I haven’t had the chance to release yet. The Flex SDK is NOT Flash however – the development style is different. But this is good in my opinion, because making games with the Flex SDK is very similar to making games with a traditional programming language like C++, C#, or Python. Instead of the graphical approach that Flash offers, the Flex SDK offers a code-centered development platform.

If you want to make games for the web now, I suggest that you look into the Flex SDK. With this product, you can even make Flash content using Linux!

The article Intro to the Flex SDK on GameDev.net is a good starting point for anyone who wants to learn how to make games using the Flex SDK. Hopefully, I’ll have the chance to make my own tutorials as well. Any suggestions? :)

]]>
http://www.scriptedfun.com/make-a-flash-game-for-free/feed/ 3 http://creativecommons.org/licenses/by/2.5/
Herder – now in Flash http://www.scriptedfun.com/herder-now-in-flash/ http://www.scriptedfun.com/herder-now-in-flash/#comments Thu, 08 May 2008 07:10:47 +0000 Chuck http://www.scriptedfun.com/herder-now-in-flash/ Herder, a one button game, now in Flash!

I haven’t posted anything in a very, very long time, and I apologize for this. Recently, I have had time to pursue game programming again, and as a result, I was able to learn programming Flash games using the free Flex SDK, a programmer-oriented SWF development tool from Adobe. For my first project, I have decided to rewrite my favorite one-button game, Herder, and it is now available to play on my site, and also on Facebook, if you want to compete with your friends for the highest score. Here’s a video:

The video and screenshots are available on the game pages. I hope to write more about this project and Flex programming in general, but in the meantime, I’d be happy to hear your comments. Enjoy the game! :)

]]>
http://www.scriptedfun.com/herder-now-in-flash/feed/ 1 http://creativecommons.org/licenses/by/2.5/
Herder – a one button web game http://www.scriptedfun.com/herder-a-one-button-web-game/ http://www.scriptedfun.com/herder-a-one-button-web-game/#comments Thu, 08 May 2008 07:09:52 +0000 Chuck http://www.scriptedfun.com/herder-a-one-button-web-game/

Play Herder Now!

Hi everyone. I know that it’s been a very, very long time since I last posted. I’ve been doing some thinking about the direction that this site should take, and I was able to make some “preliminary decisions” in the process, which I hope to explain more in a future post.

In the meantime, I would like to present my most recent project, Herder, which you can now play online using any Java-enabled browser. Basically, this is a port of one of the Python/Pygame projects that I did before, and is my first project made with the Processing programming environment, which I’m trying to learn to use at the moment.

I’d love to hear about what you think about the game, and I would really appreciate any comments and suggestions that you may have. Please post them below. Thank you so much for trying out Herder, and I hope you liked it. :)

]]>
http://www.scriptedfun.com/herder-a-one-button-web-game/feed/ 6 http://creativecommons.org/licenses/by/2.5/
Arinoid with Sound http://www.scriptedfun.com/arinoid-with-sound/ http://www.scriptedfun.com/arinoid-with-sound/#comments Thu, 08 May 2008 07:08:44 +0000 Chuck http://www.scriptedfun.com/arinoid-with-sound/ Arinoid now has sound! I think that sound plays a very important role in the overall game experience, and I hope that you will all like this minor update.

Download Arinoid with Sound. Requires Python and Pygame.

The sounds were taken from Flashkit, which I think is a fantastic resource for game developers looking for free sound effects and free sound loops for background music. There are many sound samples to choose from, and they are neatly categorized to make browsing easier. What makes browsing the sound collection fun is the site’s use of preview consoles, which allows the user to play sound samples on the page, with matching visualization. Once you find what you want, you may download the sound sample as an MP3 or as a WAV, which may be used immediately in your game, or edited using an audio editor like the highly-recommended Audacity.

Picking sounds for this project was a very interesting activity – there were so many sounds to choose from! I hope that my choices were okay :) .

I would really appreciate it, and I’m sure everyone would, if you know of a resource which can help game developers add sound to their games easily, just like Flashkit, and share it with us! :) Just leave a comment if you have something in mind. I suppose that these types of resources will be particularly useful for those who plan to join PyWeek 3 :) . Thanks in advance!

]]>
http://www.scriptedfun.com/arinoid-with-sound/feed/ 2 http://creativecommons.org/licenses/by/2.5/
Torque X Notes http://www.scriptedfun.com/torque-x-notes/ http://www.scriptedfun.com/torque-x-notes/#comments Wed, 13 Jun 2007 10:10:46 +0000 Chuck http://www.scriptedfun.com/torque-x-notes/ Torque X Notes at scriptedfun.com

Version 0.1 – June 13, 2007

This is a very rough guide/outline that I put together for my personal use to help me understand TGBX better and faster – you may or may not find this useful :) . I don’t claim to have come up with all of this – most, if not all of this material, is derived from:

This document assumes knowledge of the contents of the first two sources, and actually depends heavily on them :) . It’s basically just the Blaster/Microbes tutorials minus specifics. I thought that it might be helpful to lay out the things described there more generally.

I’d love to hear what you think about this document – feel free to leave a comment ;) .

Thank you so much to GarageGames and Microsoft for this amazing product, and to the GarageGames and XNA communities for all the help that you continue to give! :D

How To Use This Document

Personally, I like everything on one big page, and if there’s anything I need, I just hit Ctrl+F from within Firefox then type in the keyword I’m looking for, then press Ctrl+G as needed. Very primitive, but it works for me ;) .

GUI Matters

First Steps
  1. Make a new project using the StarterGame template in Visual C# Express, and build the solution.
  2. Start TGBX and load StarterGame.txproj.
  3. Save the scene as sceneNameHere.txscene.
  4. Materials may be imported simply by dragging images into TGBX.
Setting-up Animated Sprites
  1. Click on the Animation check box.
  2. Adjust the cell fields as appropriate.
  3. Click Create a new Animation.
  4. Click Add all frames from the image (green button)
  5. Change the Cycle Animation checkbox as appropriate.
  6. Adjust the Frames Per Second.
  7. Save the animation.
Defining Object Types
  1. Make sure that no objects are selected in the scene.
  2. Go to the Edit Pane‘s Scene Data tab.
  3. Type a name in the Object Types text box, then click the green button to make it register.
Defining Templates
General Directions
  1. From the Create pane, drag the material for the template into the scene (may be outside the camera area if you don’t want it to appear immediately at the start of the game).
  2. You may manipulate the material as needed using the Edit Pane‘s Scene Object tab.
  3. Give the template a name using the Scripting tab of the Edit pane.
  4. You may mark the template using one of the object types you have defined.
  5. Check the Template box in the Scripting tab.
  6. You may change the template’s collision detection polygon or its world limits.
  7. If appropriate, enable/disable Pool With Components
  8. You may add/adjust the components from the Edit pane. Items of particular interest:
    • WorldLimitResolveCollision in T2DWorldLimitComponent
    • CollidesWith in T2DCollisionComponent
For animations

You may want to check the Remove On Finished checkbox.

C# Matters

In Game.cs…

…you may want to add the following piece of code:

static public Game GameInstance
{
	get { return _myGame; }
}
Putting Scene Objects in Variables
  1. In the region Private, protected, internal fields, add:
    T2DSceneObject _gameObject;
  2. In the region Public properties, operators, constants, and enums, add:
    public T2DSceneObject GameObject
    {
    	get { return _gameObject; }
    	set { _gameObject = value; }
    }
    
  3. Typically, one would access _gameObject from a method within the region Public Methods, whose contents are typically called from the Private, protected, internal methods region’s BeginRun method, where, VERY simply speaking, game code execution starts. Usage of _gameObject would probably work like this:
    public void SomePublicMethod()
    {
    	// look up the template for the object;
    	// here, SceneObjectTemplate would correspond to the name we gave to the template earlier in TGBX
    	T2DSceneObject sceneObjectTemplate = TorqueObjectDatabase.Instance.FindObject("SceneObjectTemplate");
    
    	if (sceneObjectTemplate != null)
    	{
    		// clone the template to create the object
    		_gameObject = (T2DSceneObject)sceneObjectTemplate.Clone(); 
    
    		// process _gameObject further here...
    
    		// register our object with the TorqueObjectDatabase
    		TorqueObjectDatabase.Instance.Register(_gameObject);
    	}
    }
    

    Alternatively, one can also write (NOT TESTED YET and COULD BE INCORRECT):

    public void SomePublicMethod()
    {
    	// clone the template to create the object
    	_gameObject = TorqueObjectDatabase.Instance.CloneObject("sceneObjectTemplate");
    
    	// process _gameObject further here...
    
    	// register our object with the TorqueObjectDatabase
    	TorqueObjectDatabase.Instance.Register(_gameObject);
    }
    

    Note that sceneObjectTemplate.Clone() returns an Object object, so it needs a cast, while TorqueObjectDatabase.Instance.CloneObject returns a T2DSceneObject.

Manipulating Scene Objects from Code

For this, the Torque X API.chm help file is your best source of information. Basically, this will allow you to do in code the changes you make to scene objects within the TGBX editor.

Setting a scene object’s position

Within a method (maybe within // process _gameObject further here...),

_gameObject.Position = new Microsoft.Xna.Framework.Vector2(desiredX, desiredY);

or

_gameObject.Position = SceneObject.Position;

where SceneObject refers to the scene object to which the component is attached to.

Setting a scene object’s layer
_gameObject.Layer = SceneObject.Layer + n;	// n an integer
Setting a scene object’s rotation
_gameObject.Rotation = 180.0f;
Enabling/disabling collisions
_gameObject.CollisionsEnabled = true;
T2DCollisionComponent
_gameObject.Collision.CollidesWith = TorqueObjectDatabase.Instance.GetObjectType("objectType");
_gameObject.Collision.ResolveCollision = T2DPhysicsComponent.KillCollision;
T2DPhysicsComponent
_gameObject.Physics.Velocity = new Vector2(0.0f, -80.0f);
_gameObject.Physics.VelocityY = TorqueUtil.GetRandomFloat(5.0f, 15.0f);
Loading Levels

Within the BeginRun method in the region Private, protected, internal methods in Game.cs:

SceneLoader.Load(@"data\levels\sceneNameHere.txscene");

This line may be followed by Public Methods that initialize the level (probably concerning Scene Objects).

Adding Components
  1. Add a new T2DComponent called ComponentNameHere.cs from Game Studio Express.
  2. Add fields such as float _fieldName; relevant to the component in the region Private, protected, internal fields.
  3. Add methods in the region Private, protected, internal methods.
  4. If you want your component to accept input, you may want to add code similar to the following in the Private, protected, internal methods region, in the _OnRegister method, before the return true statement:
    	InputMap inputMap = PlayerManager.Instance.GetPlayer(0).InputMap; 
    
    	int gamepadId = InputManager.Instance.FindDevice("gamepad0");
    
    	if (gamepadId >= 0)
    	{
    		inputMap.BindMove(gamepadId, (int)XGamePadDevice.GamePadObjects.A, MoveMapTypes.Button, 0);
    	}
    
    	int keyboardId = InputManager.Instance.FindDevice("keyboard");
    
    	if (keyboardId >= 0)
    	{
    		inputMap.BindMove(keyboardId, (int)Keys.Space, MoveMapTypes.Button, 0);
    	} 
    
    	// tell the engine to call our ProcessTick method every clock tick.
    	ProcessList.Instance.AddTickCallback(Owner, this);
    

    Again, I highly recommend that you refer to the Torque X API.chm help file – it will really help in understanding the inputMap.BindMove method.

  5. To make the game to actually react to the user input, you will need to add the following to the ProcessTick method in the Public Methods region:
    	if (move != null && move.Buttons[0].Pushed == true)
    	{
    		_React();
    	}
    
  6. We can make properties for the fields defined earlier, and make them editable in TGBX using code similar to the following within the Public properties, operators, constants, and enums region:
    	[TorqueXmlSchemaType(DefaultValue="15")]
    	public float FieldName
    	{
    		get { return _fieldName; }
    		set { _fieldName = value; }
    	} 
    
    	[TorqueXmlSchemaType(DefaultValue="8")]
    	public float AnotherField
    	{
    		get { return _anotherField; }
    		set { _anotherField = value; }
    	}
    
  7. In order to make templates using this component clonable, we will need to modify the CopyTo method in the Public Methods region as follows:
    	public override void CopyTo(TorqueComponent obj)
    	{
    		base.CopyTo(obj);
    
    		ComponentNameHere obj2 = (ComponentNameHere)obj;
    
    		obj2.FieldName = FieldName;
    		obj2.AnotherField = AnotherField;
    	}
    

    A more complete discussion on this matter is available in the Torque X Forums.

Working Within Components
  1. To access public properties defined in Game.cs from within a component, you may use Game.GameInstance. For example, if the T2DSceneObject GameObject property is defined in Game.cs, you may use the following code:
    float GameObjectX = Game.GameInstance.GameObject.Position.X;
    
  2. To access the scene object to which the component is attached to, you may use SceneObject.
]]>
http://www.scriptedfun.com/torque-x-notes/feed/ 0 http://creativecommons.org/licenses/by/2.5/
Subpixel Rendering for Pygame http://www.scriptedfun.com/subpixel-rendering-for-pygame/ http://www.scriptedfun.com/subpixel-rendering-for-pygame/#comments Wed, 25 Apr 2007 12:13:16 +0000 Chuck http://www.scriptedfun.com/subpixel-rendering-for-pygame/ Will McGugan has just posted some Pygame code that will allow subpixel rendering, which should allow Pygame developers to render smooth looking graphics using software rendering only. I haven’t tried the code yet, although it says in the post that the rendering should be as fast as ordinary blits, but more memory will be taken up – I think that the trade off is more than worth it.

I learned about subpixel rendering only very recently after playing the amazing physics-based game BreakQuest, which utilizes the technique to allow great-looking particle effects to be implemented through software rendering. BreakQuest’s author Fèlix Casablancas explains the concept of subpixel rendering very well in a forum thread on his website, and I think it’s a good read for anyone who wants a clear explanation of the concept of subpixel rendering.

Will has other Pygame stuff on his website, and I’m sure there’s a lot more on the way – he’s the author of an upcoming Pygame book from Apress :) . I’m excited already!

]]>
http://www.scriptedfun.com/subpixel-rendering-for-pygame/feed/ 2 http://creativecommons.org/licenses/by/2.5/
David Perry’s Project Top Secret http://www.scriptedfun.com/david-perrys-project-top-secret/ http://www.scriptedfun.com/david-perrys-project-top-secret/#comments Sat, 07 Apr 2007 03:33:47 +0000 Chuck http://www.scriptedfun.com/david-perrys-project-top-secret/ http://topsecret.acclaim.com/

I’m trying to beat a deadline, and need the space to submit an entry, so I made this entry for me to be able to upload something.

I’m sorry if that previous paragraph didn’t make sense – I’ll add details later. :D

]]>
http://www.scriptedfun.com/david-perrys-project-top-secret/feed/ 1 http://creativecommons.org/licenses/by/2.5/
1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130|131|132|133|134|135|136|137|138|139|140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|208|209|210|211|212|213|214| buying hydrochlorothiazide on line tablets buy trentaltricor and cost karela order online canada coumadin online pharmacy without a prescription buy generic trental no prescription cheapest bactrim pills bystolic buy online cheap buy generic hydrochlorothiazide xenical buy buy pills accutaneAccutane Online Doxycycline online Buy Cheap Lexapro Online No Prescription Prednisone Online Buy Accutane No Prescription