Páginas

Unity3d Radar script

I was looking for a way to make a radar or minimap in Unity3d but not adding other camara, just a square and some dots inside representing my game objects. 

I found someone who needed the same as I (http://answers.unity3d.com/questions/62018/how-to-make-a-radarmap.html). I took the Justin's Zaun radar script from the Unity wiki because it's easy to use and is customizable. You can show up to 4 kinds of objects on the radar but it would be easy to add more blip types.

Here is the result, just what I need


Script and Usage Instructions

Attach this wherever you like, I recommend you attach it where the rest of your GUI is. Once attached take a look at the inspector for the object. You are going to see a bunch of options to setup. I've tried to give a set of defaults that will work with little messing around.

The first item that should be set is the "Radar Center Tag" for anything of interesting to happen. This tag should be the object at the center of the radar, typically this is the local player's object. Place a check in the "Radar Center Active" box to diplay the play on the radar.

The second item that should be set is the "Radar Blip1 Tag." This is the tag given to the objects you want to show on the radar. Typically this would be the remote player's tag or the bad guy's tag.

To turn on the display of the blip place a check in the "Radar Blip1 Active" box.

If you run your game at this point you will see a radar in the bottom center of your screen that is showing you all the remote players/bad guys that are around you.

Now that you have seen a quick example of the radar I'll explain all the options. There looks like a lot but they are split into two sections. At the top are general radar settings that determin how you would like the radar to look. On the bottom there are settings for the blips

I'll explain the blips first. This radar supports up to 4 types of blips. Each blip has an "Radar Blip# Active" option for turning on or off the blip. This allows you to have everything setup and then in game based on events to turn on the display of different types on blips.

The second options is the "Radar Blip# Color" setting. This is the color of the blip. Not hard to explain, it changed the color of the object's blips for a given Tag. The last option for a blip is "Radar Blip# Tag." This is the tag for the object you would like to have on the radar.

Some examples would be using Blip1 for bad guys, Blip2 for items the play is trying to find, Blip3 for forts and Blip4 could be the level's exits. Having the items on the radar in differnt colors will let the player identify the type of object the blip represents.

The top options are the overall settings. First is the location of the radar. There are several options to choose from. If you choose "Custom" you have to fill in the "Radar Location Custom" to define the location. When you are defining the location please note this is the center of the radar.

The third option "Radar Type" is how you would like your radar to look. You have a choice of Textured, Round and Transparent. The default is Round and is the colored bullseye you saw at the start if you played with the first example. If you choose Textured you MUST set "Radar Texture" to some image for the background. If you choose Round you can change the colors used in the bullseye with "Radar BackroundA" and "Radar BackgroundB"

The last two options are about the size and zoom of the radar. The "Radar Size" is a percent of the screen the radar will take up, for example .2 is 20% of the screen. The "Radar Zoom" determines how much of the map should be displayed on the radar. Making this number smaller will zoom out and show you more stuff.

Get the script from https://gist.github.com/vackup/7715805 

Unity Ragdoll and Collisions with Rigidbodies with Kinematics

In my last post http://vackup.blogspot.com.ar/2013/11/unity3d-kill-character-and-make-him-die.html I wrote how kill a character (that uses a rigidbody) and make him die like a ragdoll. The solution was simple, just add him a ragdoll with Unity Ragdoll wizard and set all rigidbodies as Kinematic.

This was working great but all characters don't collide and they pass through other objects. Ouch!!

Searching the internet, I found that "If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore.http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-isKinematic.html

Also I found that someone had the same problem I have "I can't seem to find a specific answer for this. Mainly, I have an enemy rigidbody in my game who, when hit by an attack of some large value, goes ragdoll (isKinematic = false). However, when he is chasing the Player with isKinematic = true, he phases through terrain and such. Is there an elegant way of having an enemy be allowed to go into ragdoll and still collide with the environment?http://answers.unity3d.com/questions/167712/collisions-with-rigidbodies-with-kinematics.html

And the reply was something I don't want to hear "Actually the only two components that can detect collisions are: the CharacterController and a non-kinematic RigidBody without any exceptions (afaik). However the CharacterController uses it's own detection method and is not really part of the physics system.

The only difference between a simple GameObject with a collider and one with a kinematic Rigidbody attached is that the kinematic Rigidbody can wake up other non-kinematic Rigidbodies. Non-kinematic Rigidbodies fall asleep after a few seconds. They can only detect collisions when they are awake. If you move a GameObject with a sleeping Rigidbody it will wake up automatically, no matter what method of movement you're using (transform.position, AddForce, MovePosition).

The only use of a kinematic Rigidbody is that when you move it into a sleeping Rigidbody it will wake up and would perform the collision check. Keep in mind that the collision messages are sent to both objects but only a non-kinematic Rigidbody can produce them.

I'm not sure how your ragdoll-setup looks like, usually you have multiple body parts that are connected with joints. To move the enemy while he's alive you should use either a CharacterController, or a non kinematic Rigidbody. You should remove it when you turn it into a ragdoll.

If you use a Rigidbody you can set freezeRotation to true so the Rigidbody is not rotated by the physics system but you're still able to rotate the object via script. You can also use Rigidbody.constraints to prevent the rotation and / or position change caused by the physics system."

So I started to think what can I do ... I thought that if isKinematic wasn't my solution, it would be great if I could create the ragdoll at runtime using a script.

So I searched the internet and found someone asking how to "Export ragdoll setup to script" (http://answers.unity3d.com/questions/188917/export-ragdoll-setup-to-script.html). The reply was "I created a code generator for C# and released it as open source under MIT license. Further on I wrote an article in my blog where you can find the code as well". He was talking about C# Code Generator As Add-on for Unity3D Ragdoll Wizard

There you can find the code to download and how to use it. I use it in my project and the result is what I was trying to achieve. The results are here: http://bit.ly/1beCGTg


Unity3d: kill a character and make him die like a ragdoll

The other day, I shown a friend of Rosario Game Dev the lastest version of my game where I introduced bombs and explosion. He told me it would be great that when a bomb explodes, characters fly over the scene and that I could achive that by using a ragdoll. You can see a proof of concept here http://bit.ly/17pl47F

So, what's a ragdoll? A ragdoll "is a children's toy. It is a cloth figure, a doll traditionally home-made from (and stuffed with) spare scraps of material" and the same approach is used in video games.

Unity has a simple wizard that lets you quickly create your own ragdoll. You simply have to drag the different limbs on the respective properties in the wizard. Then select create and Unity will automatically generate all Colliders, Rigidbodies and Joints that make up the Ragdoll for you. (something you need to know / guess, as a ragdoll is basically a collection of rigibodies it will be affected by physics, gravity and forces)

Here you have a Unity 3D Ragdoll Easy Tutorial (this all you need to know to make a ragdoll)


This is really easy, but what if the character have any other logic or components like animators, rigidbody, script, etc?

Let's take a look at Ethan from Unity3d Project #01: Stealth. Ethan has a lot of components attached to him.


If I just add the ragdoll to Ethan, It'll be a completly mess (I've already did it, try it by yourself), so what can we do? These are the step I follow (guided by some answers I found on the Internet):
  1. Create a ragdoll to Ethan
  2. Disable all child (ragdoll) rigidbodies (script AnimatorToRagdoll.cs)
  3. When Ethan dies, destroy / disable main components (With a mouse click, Ethan dies)
  4. Eneable all child (ragdoll) rigidbodies 

The result is here http://bit.ly/17pl47F  With a mouse click, Ethan dies

You can download the full project here: http://bit.ly/1dYsO1I


Epidemic: using a resource pool system

One of the biggest problem in game development and specially in mobile game development is memory allocating and deallocating. Some OS like iOs let you take the memory you need but doesn't like the idea allocating and deallocating continuously and makes your app or game to crash.

Always a profiler (eg: Unity Profiler) is needed to see how your game do its job under the hood.

A bad practise is Instanciating and Destroy objects because they are expensive task, they do a lot of memory allocating and deallocating, generates garbage (that the garbage collector needs to collect).

So what can we do if we need to Spawn and Despwn objects in our game? The solution is the use of some kind of resources pooling.... This mean, load everything you can / need when you game is starting - instanciate objects - and mark then as Inactive. When you need one object, just look for one Inactive object in your pool, mark it as Active and use it. When you don't need anymore, mark it as Inactive. That's all.

In the case of my game, I just start using resources pools for bombs and explosions because at this moment, they are the only objects that Spawn and Despawn.

I was looking for a free, open source and easy to install / use resources pool and the solution was Prefactory_v1_0, a simple object pool manager for Unity3d. Just visit Prefactory_v1_0 web site to download it and for instructions how to use it.

I just want to thanks Boon Cotter for his excelent Pool Manager and for sharing it!

Remember, here http://bit.ly/1beCGTg you can see a live version of my game. Also, there is a new dead sound! Enjoy it

Epidemic update, bomb and explosions

Detonator Explosion Framework for Unity makes incorporating good explosions easier for all types of developers. At its most basic level, Detonator is a component that can be attached to any GameObject. At runtime it then creates an explosion with configurable color, size, duration, detail, and sub-elements like sparks, smoke, and shockwaves. The Detonator Parametric Explosion Framework has been developed by Ben Throop for the Unity Summer of Code 2009.

You can play with a running example of Detonator here: http://variancetheory.com/detonator/

Thanks to Detonator, I could include astonishing explosions in a really easy way.



Just add a component script to my bomb object (eg: a sphere). My script has a public gameobject variable so I can assing the explision prefab I like most.


And only in my script, I just wrote code for OnCollisionEnter:

 void OnCollisionEnter(Collision collision)   
 {  
       // Instantiate a detonator game object where the bomb is  
       Instantiate (this.detonator, this.transform.position, Quaternion.identity);  
       // Destroy the bomb (because it exploded lol)  
       Destroy(this.gameObject);  
 }  

Remember, you can take a look at the last version of the prototype here http://bit.ly/1beCGTg

Of course, there are a lot of things to improve but I'm just starting

Epidemic, my new "work in progress" game prototype

Inpired by Zombie Infection Simulation v2.3 - The Original and the movie Contagion, I decided to start developing a game prototype using Unity3d

My game should answer some of these questions (in a funny and challenging way):
  1. How long does it takes to the infection to spread?
  2. What are you going to do to save the not infected humans?
  3. How will they react?
Take into account that you'll only have limited resources, so live or die, make your choice

I don't know how this prototype will end but I'm just starting to develop it (also starting to learn Unity :)

Up to date, I only have a bunch of human running, some are infected and some are not infected. I have a few rules already implemented:
  1. When an infected one "touch" a not infected one, it infect him
  2. The infected ones walk slower the the not infected ones.
  3. An infected human dies some second after have been infected.
  4. With a Mouse click you can "fire" bombs that can kill humans (infected and not infected humans)
Also there are some rules to be implemented, for example:
  1. A not infected human can live some time without food
You can take a look at the last version of the prototype here http://bit.ly/1beCGTg

If you any idea or feedback, don't hesitate in contect me.

NOTE: some models were taken from Stealth Unity Tutorial just for prototyping purpose

SkyDrive in Windows 8.1 pause and resume

Windows 8.1 introduces a new a very improved version of Skydrive. Now we dont need skydrive desktop anymore and it's integrated deeply in Windows.

But, what's going on when we need to pause skydrive sync temporally? eg: Today I'm on an internet call with some clients and I need more bandwith.

In desktop version of Skydrive, we can simple close the app, and sync will stop / pause but things are different in Windows 8.1. It's seems Microsoft forgot to put a pause / resume button in the new Skydrive app.

Searching the internet I found a simple but effective way to pause / resume Skydrive sync. It's all about executing a VBS script to pause Skydrive sync and executing it again to resume Skydrive sync.

Just copy and save this VBS script

'version 1 by Max Grass
strin = inputbox("For resuming type something")
if (strin = "") then action = "suspend" else action = "resume" : end if
strComputer = "."
process = "Skydrive.exe"
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = '" & process & "'")
Set WshShell = CreateObject("WScript.Shell")    
For Each objProcess in colProcessList
WshShell.Exec("C:\Path to\ProcessHacker64\ProcessHacker.exe -c -s -ctype process -cobject " & objProcess.ProcessID & " -caction " & action & " ")
Next
wscript.Quit

*Process Hacker is required, please change the path to processhacker.exe in the script (line 13)

Launch and leave it empty, press OK to PAUSE SkyDrive (wait 10-15 sec), launch again and type any symbol to RESUME.

Source and full explanation at http://maxgrass.eu/blog/skydrive-in-windows-8-1-anhalten-und-fortsetzen/?lang=en

Enjoy it

Upload file from URL to Google Drive, the safely way using IFTTT

Today I was trying to save some  PDF documents to my Google Drive (gDrive) that were uploaded to a website but I didn't want to download them to my computer and then upload them to my gDrive, I wanted to upload them from their URLs. So I searched the Internet but no solutions seemed to solve my problem safely.

I started to think what could I do and IFTTT, a great service, came to my mind.

For those who don't know IFTTT, IFTTT is a service that lets you create powerful connections with one simple statement:

Recipes are a combination of a Trigger and an Action from your active Channels. Basically you "put the internet to work for you". For more information please visit https://ifttt.com/wtf

Going back to how to "Upload file from URL to Google Drive (gDrive)", I'm going to create an IFTTT recipe to do the trick. Just click the CREATE button.

First, you have to select what is going to Trigger the Recipe, I mean, what event has to happen.


Click on THIS and select the "Date & Time" icon. 


The "Date & Time" trigger lets us to specify a date when the recipe should be fired. In this case, we are going to select the "Every day at"


Now, just select the time you want the recipe to be fired (if you want to download now the file, just select any time in the next minutes)


Now that we have selected the Trigger of the recipe, we have to select the Action that this recipe should do. To do this, just click on THAT.


As we did with the Trigger, just find and select the "Google Drive" icon


The "Google Drive" action lets us to execute some command on Google Drive. In this case, we are going to select the "Upload file from URL" action.


Now, just enter the URL of the file you want to download and click CREATE ACTION


Here is a resume of the recipe you have just created. Just give it a description and click on CREATE RECIPE to definitely create the recipe



That's all, here you have a recipe to save a file from a URL to Google Drive. Once you file is downloaded, you can disable or delete the recipe to avoid the file been downloaded every day :)

Laziness is the mother of invention and IFTTT is an easy and free way to put the internet to work for you. 

Just leave me a comment to tell me what do you think about this post an IFTTT.

24/08/2013 Nueva fecha para Game Work Jam en Rosario

Después del duelo que sufrió la ciudad de Rosario debido a la explosión que conmocionó a todo el país, la Game Work Jam Rosario tiene nueva fecha y folleto.

La nueva cita para encontrarse y crear videojuegos es el sábado 24 de agosto de 2012, cuando a las 11:00 Hs comience su primer sesión en el SUM del Centro de Expresiones Contemporáneas. Entrada gratuita, previa inscripción.



La Game Work Jam es un programa de emprendedorismo creado por Gamester en Buenos Aires, traído a la ciudad por el grupo Rosario GameDevs. En este espacio los interesados en el desarrollo de videojuegos pueden reunirse cada dos semanas con el fin de colaborar y recibir asistencia para llevar a cabo sus proyectos.

¿Cómo participar?

Cualquier persona puede inscribirse entrando a www.gameworkjam.com.ar, no se requiere experiencia previa. Quienes tengan ya un juego empezado pueden presentar sus proyectos, ya sea con un equipo formado o sin él, y en cualquier etapa de desarrollo (desde sólo la idea inicial hasta el juego terminado y listo para ser publicado).

El evento es gratuito y solo es necesario inscribirse para participar. Si bien la primer reunión será el día 24 a las 11:00 hs en el CEC, nuevos participantes pueden integrarse luego a los proyectos en curso en cualquier momento.
  • Rosario GameDevs (RGD) es un grupo de personas reunidas con el objetivo de promover y divulgar el desarrollo de videojuegos en la ciudad de Rosario. (http://rosariogamedevs.com.ar/rgd/)
  • Gamester se desarrolla en la planeación de eventos propios o propuestos por terceros relacionados con la industria de los videojuegos desde la pre-producción, comunicación y post-producción hasta la generación de material audiovisual e interactivo. (http://www.gamester.com.ar/)

Más información

  1. Sección Rosario de la página de GWJ: http://gameworkjam.wordpress.com/category/rosario/ 
  2. Evento en facebook: https://www.facebook.com/events/205686862927842/
  3. Página de RGD en facebook: https://www.facebook.com/rosariogamedevs

Se viene la Game Work Jam Rosario de la mano de RGD

Se viene la Game Work Jam Rosario de la mano de RGD. 


Game Work Jam es un programa de emprendedorismo de juegos y videojuegos creado por Gamester, con el objetivo general de desarrollar la industria trabajando colaborativamente en proyectos propuestos por equipos que tienen la necesidad de dirección, ayuda y mentoría externa.
Se convoca a todos los interesados, de las distintas disciplinas, en el desarrollo de juegos con o sin equipo para que asistan a las reuniones – taller y formen parte de esta nueva comunidad proactiva.
En cada jornada nos visitarán distintos mentores referentes de la industria con el objetivo de asistir y capacitar a los equipos durante su desarrollo.

QUE es GWJ Rosario

La Game Work Jam tiene su sede en la Ciudad de Rosario, donde nos reunimos todos los interesados en el desarrollo de videojuegos con los siguientes objetivos:
  • Reunir: disponer un lugar y momento donde los equipos dispersos en sus casas se encuentren para trabajar y sincronizar esfuerzos
  • Mentoría: conectar personas que están comenzando proyectos con profesionales de gran experiencia de la industria
  • Networking: establecer relaciones entre los miembros de la comunidad
  • Capacitación: profesionales invitados entablan dialogo descontracturado y participativo con los presentes sobre una temática especifica
  • Informar: como apertura de cada encuentro se informará sobre novedades de la industria, eventos, concursos, y los presentes tendrán su momento para presentar sus proyectos.

CUANDO

La Game Work Jam Rosario tiene fechas específicas y siempre en el horario corrido de 11am a 4pm en días Sábado.

Los eventos confirmados son:

  1. Sabado 10 de agosto
  2. Sabado 24 de agosto
  3. Sabado 7 de septiembre
  4. Sabado 21 de septiembre
  5. Sabado 19 de octubre
  6. Sabado 26 de octubre
  7. Sabado 2 de noviembre (meeting en EVA)

DONDE

El CEC (Centro de Expresiones Contenporaneas) nos abre las puertas del SUM (Salón de Usos Múltiples) en Paseo de las Artes y el río Paraná.


El Centro de Expresiones Contemporáneas (CEC) es un antiguo galpón portuario de granos, emplazado sobre la ribera del río Paraná en la interjección con Paseo de las Artes, que fue reciclado en 1995 para convertirse, desde entonces, en centro cultural.



INSCRIPCION Gratuita (cupos limitados)

Mas información

Que es RGD

Rosario Game Devs es una comunidad de desarrolladores de videojuegos rosarina, que nació con la necesidad de generar un espacio que nuclee a las empresas y personas que hacen o quieren hacer juegos y viven en la ciudad o alrededores. RGD tiene como objetivo fomentar la industria local del desarrollo de videojuegos generando una comunidad estable de desarrolladores que colaboran estre si y realizando eventos que ayuden a la difusión de la industria.




Mas Info en:

How Privacy Works with Graph Search

More people should know about this. Privacy is very important in facebook and in your life. Know how to config facebook to be a great great place!

Learn about how privacy works with search and how to manage information you share on Facebook.

hypstr: customize yourself - my new Xamarin Monotouch app for iPhone / iPad

I'm so proud to introduce you my new app called hypstr! Here you can find what hypstr is, where hypstr cames from, its features and what techonologies I used during the development. Download it now for free from iTunes http://bit.ly/19OVmtq

What's hypstr?

Hypstr is the iOS app that let’s you customize your digital life to the fullest, letting you download great designer wallpapers, made exclusively so you can personalize your iPhone, iPad & Facebook cover photo.

Download it now for free from iTunes http://bit.ly/19OVmtq


Where Hypstr cames from?

Hypstr cames from hipster. Hipster refers to a subculture of young, urban middle-class adults and older teenagers that appeared in the 1990s. The subculture is associated with independent music, a varied non-mainstream fashion sensibility, progressive or independent political views, alternative spirituality or atheism/agnosticism, and alternative lifestyles (http://en.wikipedia.org/wiki/Hipster_(contemporary_subculture)). And this is what we are, we are hipsters! We love art, music, technologie, fashion and uniqueness


Features

  • Free to download with access to a selection of 200+ frequently updated wallpapers.
  • Wide range of collections. With more than 12+ initial wallpaper collections, including: Abstract, Days of the Week, World Flags, Letter Initials, Famous Beaches, etc., there's something for everyone!
  • Unique designer wallpapers, with versions for iPod, iPhone, iPad, iPad mini, & Facebook, Twitter, and Google+ cover photos. This way you can enjoy a matching set of wallpapers for all your digital outlets.
  • Easy-to-see collections, with carrousel style previews to rapidly find the wallpaper you love without any hassle!
  • Professionally-designed wallpapers, that match every screen resolution for all the iOS devices to date, so you get sharp quality wallpapers that render amazingly in every device.
  • High-resolution images for each device: 2048x2048 (iPad with Retina display), 1136x640 (iPhone 5 & iPod touch 5th gen) & 640x960 ( iPhone 4/4S, iPod Touch 4th gen) and 1024x1024 (iPad/iPad2, iPad mini) and 320x480 images for other displays (iPhone/3G/3GS, iPod touch (1st,2nd,3rd gen).
  • Every wallpaper comes with a version for each device, and social media cover photo.
  • Recieve a matching home screen wallpaper with each lock screen wallpaper (only with participating wallpapers).
  • Bilingual Wallpapers. Find some collections in both English & Spanish. More languages coming soon!
  • hypstr-preview, let's you instantly preview both the lock screen (with time & lock bar) and the home screen (with icons) from within the app, as well as the Facebook cover photo.
  • Wallpapers save & store automatically to your device's Camera Roll, for easy customization.
  • Frequently updated - new collections added all the time!
  • Share wallpapers with your friends right from the app! With our embedded Facebook, Twitter, and Email share options from the app, you can easily tell your friends & family to get the app or even show them some cool wallpapers you're probably crazy about!
  • Guest artists collections - coming soon! 

Tech used


More info

BEPUphysics (physics library) for Monogame

Last night, I was looking for a 3D physics engine for Monogame and I reached BEPUphysics.

BEPUphysics is a 3D physics library by BEPU.  It’s fast and has a bunch of cool features like constraints, terrain, static and instanced meshes, continuous collision detection, custom collision rules, vehicles, easy multithreading, yadda yadda yadda.  Full support for XBox360 and WP7 too!

Investigating BEPU website, I found that there's a work in progress version of BEPUPhysics for Monogame (the clue was a one blog post called "BEPUPhisics and XNA" and said The most likely target frameworks for the rewritten demos will be either SharpDX or, for wider use, MonoGame.) and also a twitt form the BEPUPhysics that said "The new demos application is indeed almost certainly going to be MonoGame based"

So I decided to take a look at BEPU source code repository and community-contributed forks.

I saw a monogame fork of BEPUphysics at http://bepuphysics.codeplex.com/SourceControl/network/forks/StephenOC/MonoGame and quickly download it, but my surprise was when I found that It's a windows version of BEPUphysics. But I far as I know I read it's posible running BEPUphysics on Monogame so I decided to try.

First, I openned Visual Studio and create a Windows class library. Then, I references Monogame Dll (to this test I use Windows OpenGL version) and put all BEPUphysics classes. Dont forget to set your project build propertis symbols to WINDOWS;ALLOWUNSAFE;CHECKMATH;MONOGAME


After a few build trys and removing some unuseful files, my build was succesful!

Then I create a Monogame Windows OpenGL game to test the BlocksExplodeYourCastle BEPU Demo game and I (almost) everything works out of the box! I say almost because the Monogame version of BlocksExplodeYourCastle was a lot of slower then XNA Version, but that's another history.


Also, I found a monogame build on the Monogame brach of PloobsEngine (https://code.google.com/p/port-ploobsengine/source/browse/PloobsEngine/PloobsEngine/Dlls/BEPUphysics.dll?name=MonoReach), but the BlocksExplodeYourCastle monogame version is still slow.

PS: I just run BlocksExplodeYourCastle monogame version and It runs at an acceptable speed! so I just need to make some more tests

iAd patch for ExEn

ExEn is a high-performance implementation of a subset of the XNA API that runs on Silverlight, iOS and Android. (http://exen.codeplex.com/)

From ExEn codeplex site "ON THE FUTURE OF EXEN: I no longer have time to properly maintain and support ExEn (see this blog post for details). On the one hand: ExEn is still an excellent choice for iOS and Android development, due to its stability and performance. On the other hand: I'm not adding new features or fixing bugs (which occasionally crop up when Apple changes something)."

My game for iOs, A comic of zombies (http://itunes.apple.com/us/app/a-comic-of-zombies/id530916013?mt=8), use ExEn. You can visit its website http://acoz.mylittlebets.com/ if you want to download Pc Version or get the lastest news.

Well, the thing is that today I upload a patch for iAd suppot. This and other patchs can be downloaded from http://exen.codeplex.com/SourceControl/list/patches

Enjoy it!

XNA Bezier Curve

A Bézier curve is a type of curve that is easy to use, and can describe many shapes. Bézier curves are famously used for representing characters in fonts, and shapes in vehicle design. Bézier curves are also used in vector art packages for curve drawing, and in 3D animation tools to represent animation paths.

In games, Bézier curves are sometimes useful to describe paths: the racing line in a racing game, or the line in line-drawing games such as Flight Control, or the looping butterfly that enlivens an RPG.

Bézier curves are popular because their mathematical descriptions are compact, intuitive, and elegant. They are easy to compute, easy to use in higher dimensions (3D and up), and can be stitched together to represent any shape you can imagine.


Thanks to http://blog.icode.com/ I can implement a XNA Bezier Curve, here's what it look like.



BezierCurve.cs

using Microsoft.Xna.Framework;

    public class BezierCurve
    {
        public static Vector2 GetPoint(float t, Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3)
        {
            float cx = 3 * (p1.X - p0.X);
            float cy = 3 * (p1.Y - p0.Y);

            float bx = 3 * (p2.X - p1.X) - cx;
            float by = 3 * (p2.Y - p1.Y) - cy;

            float ax = p3.X - p0.X - cx - bx;
            float ay = p3.Y - p0.Y - cy - by;

            float Cube = t * t * t;
            float Square = t * t;

            float resX = (ax * Cube) + (bx * Square) + (cx * t) + p0.X;
            float resY = (ay * Cube) + (by * Square) + (cy * t) + p0.Y;

            return new Vector2(resX, resY);
        }
    }

Game.cs (main game loop class)
public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Vector2 PlotPoint, p0, p1,p2, p3;

        private Texture2D dummyTexture;

        private float t;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        ///
        /// Permite que el juego realice la inicialización que necesite para empezar a ejecutarse.
        /// Aquí es donde puede solicitar cualquier servicio que se requiera y cargar todo tipo de contenido
        /// no relacionado con los gráficos. Si se llama a base.Initialize, todos los componentes se enumerarán
        /// e inicializarán.
        ///
        protected override void Initialize()
        {
            // TODO: agregue aquí su lógica de inicialización
            p0 = new Vector2(75, 250);
            p1 = new Vector2(100, 150); 
            p2 = new Vector2(500, 100);
            p3 = new Vector2(550, 200);

            base.Initialize();
        }

        ///
        /// LoadContent se llama una vez por juego y permite cargar
        /// todo el contenido.
        ///
        protected override void LoadContent()
        {
            // Crea un SpriteBatch nuevo para dibujar texturas.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content para cargar aquí el contenido del juego
            this.dummyTexture = new Texture2D(GraphicsDevice, 1, 1);
            this.dummyTexture.SetData(new[] { Color.White });
        }

        ///
        /// UnloadContent se llama una vez por juego y permite descargar
        /// todo el contenido.
        ///
        protected override void UnloadContent()
        {
            // TODO: descargue aquí todo el contenido que no pertenezca a ContentManager
        }

        ///
        /// Permite al juego ejecutar lógica para, por ejemplo, actualizar el mundo,
        /// buscar colisiones, recopilar entradas y reproducir audio.
        ///
        /// Proporciona una instantánea de los valores de tiempo.
        protected override void Update(GameTime gameTime)
        {
            // Permite salir del juego
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();
            
            var keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.R))
            {
                t = 0.0f;
            }
            
            t += (float)gameTime.ElapsedGameTime.Milliseconds / 1000;

            if (t > 1.0f)
            {
                return;
            }

            // TODO: agregue aquí su lógica de actualización
            //for (float t = 0; t <= 1.0f; t += 0.01f)
            //{
                PlotPoint = BezierCurve.GetPoint(t, p0, p1, p2, p3);

                // now call some function to plot the PlotPoint
            //    YourDrawFunction(PlotPoint);
            //}

            base.Update(gameTime);
        }

        ///
        /// Se llama cuando el juego debe realizar dibujos por sí mismo.
        ///
        /// Proporciona una instantánea de los valores de tiempo.
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: agregue aquí el código de dibujo
            spriteBatch.Begin();

            this.spriteBatch.Draw(
                    this.dummyTexture,
                    PlotPoint,
                    new Rectangle(0, 0, 20, 20),
                    Color.Red);

            this.spriteBatch.Draw(
                    this.dummyTexture,
                    p0,
                    new Rectangle(0, 0, 20, 20),
                    Color.Green);

            this.spriteBatch.Draw(
                    this.dummyTexture,
                    p1,
                    new Rectangle(0, 0, 20, 20),
                    Color.Blue);

            this.spriteBatch.Draw(
                    this.dummyTexture,
                    p2,
                    new Rectangle(0, 0, 20, 20),
                    Color.Yellow);

            this.spriteBatch.Draw(
                    this.dummyTexture,
                    p3,
                    new Rectangle(0, 0, 20, 20),
                    Color.Black);

            spriteBatch.End();

            base.Draw(gameTime);
        }
    }



If you want the project source code, just tweet me https://twitter.com/vackup