Jump to content


Photo

Monogame/XNA Examples v2.0

monogame xna examples tutorials

  • Please log in to reply
15 replies to this topic

#1 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 16 December 2013 - 04:08 PM

Let me introduce a series of essential monogame/XNA tutorials and examples that are definetly will come in handy for the begginers. I've planned this stuff a while ago, so it will be updated from time to time as my own research in the area goes on (and of cause i have some free time). 
 
If you have any suggestions or ideas about my examples please feel free to discuss them. This work is my open-source contribution to the community.
 
The current version of examples solution includes the following:

  • Independent resolution renderer (IRR). One of the main cross-platform development problems is the problem of optimization of the displayed content on the variety of different devices with different screen resolutions. IRR is one of the simpliest solutions for such problems. It automaticaly scales rendered content according to custom "virtual" screen resolution maintaining defined screen width/height ratio. Though huge scales probably can cripple your textures it is possible to implement additional techniques to load different sets of the textures (high res/low res)  for different resolution ranges. This IRR is based on the work of other author (all copyrights are preserved) but modified for better usability and features support. Be sure that it will be updated to better accomodate all of the example projects.

    Capabilities:

- Screen auto scaling to fit any resolution with any aspect ratio

- Single virtual screen resolution space that makes you to store only one coordinates set valid for all resolutions

- Easy objects selection and coordinates conversion

  • UI Designer Component. By the time i've spent making my first game i've runned into the small but nasty problem. This is the problem of making the good looking UI with ease and this is the problem even in case you already have some nice textures. My little component saves your time by allowing you to place a list of textures on the screen and arranges them as you like alowing to change texture position and size. After the composition is done you can copy pos and size data for each texture right into the clipboard (Thanks WinForms!). And bear in mind that if we'll use IRR from the first example we get virtual coordinates that are valid for all resolutions at once.  Recently, i've also added helper WinForms window that provides easy textures and names management, now you can load/remove/dupe textures on the fly and generate coordinates code for all textures at once. Nice? I bet it is! :)
    Capabilities:

- Load/remove/duplicate textures on the fly from source images

- Place and resize textures using mouse, keyboard and input fields

- Change textures drawing order, names and coordinats using WF support window

- Get generated textures rectangle code right into your clipboard

- Compatible with independent resolution renderer

  • Advanced Camera2D. A must have for any 2D game! Camera2D concept allows to perform common zoom, pan and rotate operations on all textures that is drawn using this camera. My camera example also provides additional features such as smooth camera transition to coordinates, smooth coordinates follow logic and rectangle area zoom. This camera is intended to be used with IRR so basicaly the order of coordinates transformation is: IRR matrix -> Camera matrix -> Onscreen result!
    Capabilities:

- Zoom, pan and rotate affected textures

- Smooth transition to specified position

- Smooth object follow camera using transition

- Zoom to rectangle area

- Easy objects selection and coordinates conversion

- Compatible with independent resolution renderer

 

  • Sprites example. Sprite class is commonly used to incorporate and make easier different operations with the textures. This is my own implementation of Sprite class that provides such features as:

- Multiple textures storage each with own properties such as Visibility, Scale, Rotation, Origin, Transparency, Depth, etc.

- Different texture types: SpriteTexture (used as the main texture ) and DecalTexture (used as the decoration texture that is bound to sprite rectangle and scaled/rotated automaticaly)

- Interface based structure that allows to easily implement different sprite classes (TODO: SimpleSprite and AnimationSprite examples)

 

  • Particles example. Particles will come in handy when you decide to make some nice special effects for you game. For example gun/laser shots, smoke, rocket trails and explosion. Possibilities are limitless. In this example there are a couple of classes that are compiled in a mini particles engine that performs centralized particle logics handling and takes care of basic stuff like particle update/disposing and universal rendering. Also there are some custom logic classes included for different special effects. Component classes are:

- ParticlesManager - static class that manages particle logic objects and draws particles.

- ParticlesLogic - base abstract class for custom logic object that implements particles storage, TTL tracking and handles particles creation using input properties.

- Particle - particle class that contains all basic particle properties such as Texture, Position, Direction, etc.

 

Some helper classes that will be definetly improved with more examples to come:

  • InputHelper class. Simplifies input management for a variety of devices across many platforms. You can see its actual usage in my examples. Some parts of the code i've got somewhere from the web, unfortunately i don't remember where exactly...
  • ResolutionRenderer class. So its the same IRR from the first example used in all my examples.
  • Extensions class. Holds different extension methods for monogame classes. Mostly SpriteBatch class extensions for method calls simplification.

Version history

Spoiler

 
Click here to VISIT DOWNLOADS PAGE


Edited by PantheR, 22 May 2014 - 08:01 PM.
Updated

  • MarinaNeiz likes this

If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#2 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 28 December 2013 - 06:01 PM

Updated examples project. Added UI designer component example.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#3 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 28 December 2013 - 11:50 PM

Another update! Added advanced Camera2D example with some nice capabilities.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#4 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 29 December 2013 - 10:03 AM

And another small update (Hello holidays!). Read changelog for details.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#5 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 29 December 2013 - 05:26 PM

And another one small but handy update! I've added helper window for UIDesigner component so now all textures can be managed on the fly. Now UI editing became realy easy :)

V1.4


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#6 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 30 December 2013 - 12:15 PM

Updated UIDesigner to better accomodate the needs of UI design. Read V1.5 changelog.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#7 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 30 December 2013 - 08:13 PM

UIDesigner is getting better and better as i work with it on my own :) Just added draw order change for textures and fixed some bugs. Look at V1.6 changelog.

The idea of creating such component is exciting and interesting, hope someone will find it useful :)


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#8 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 09 January 2014 - 10:56 PM

Released v1.7 with some fixes and new Sprites example.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#9 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 10 January 2014 - 11:27 PM

Updated examples to v1.8. Added particles example.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#10 JCPhlux

JCPhlux

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 27 January 2014 - 06:18 AM

Trying to get the examples working but am getting 652 build errors that look like they are related to Xna

Error 1 The type or namespace name 'Xna' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
 
I have the latest mongame 3.1.2.0 installed.


#11 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 27 January 2014 - 08:12 AM

Please check the project references for any inconsistencies that can appear on your system.

 

Project references assemblies from:

C:\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\

These assemblies contains namespaces such as Microsoft.Xna.Framework

 

Also, as i know, the latest public release of Monogame is 3.0.1.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#12 JCPhlux

JCPhlux

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 27 January 2014 - 12:34 PM

I have installed the 3.1.2 alpha. To get monogame to work with VS2013.

 

Ok so I looked into it and it looks like 3.1.2 has some issues with "\MonoGame\v3.0\Assemblies\WindowsGL\" but I was able to get it working by removing the ref to that and adding a ref to "\MonoGame\v3.0\Assemblies\Windows\".



#13 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 28 January 2014 - 04:40 AM

I see now :) Btw there are 3.1.3 that fixes this problem.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#14 JCPhlux

JCPhlux

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 28 January 2014 - 04:55 AM

I see now :) Btw there are 3.1.3 that fixes this problem.

Thanks



#15 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 24 February 2014 - 06:47 PM

Updated examples to v1.9. Includes fixes and improvements mostly.


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org


#16 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 22 May 2014 - 07:59 PM

Updated code for Monogame 3.2 and moved sources to GitHub repo: https://github.com/p...nogame-Examples


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org






Also tagged with one or more of these keywords: monogame, xna, examples, tutorials

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users