Friday, May 20, 2016

Colobot: Robot switching Power Cells by itself

If you have discovered Colobot: Gold Edition, you've been missing a great game.  It's free as in open source and is available on all operating systems.

The main feature is the possibility to program your robots with real code.  The syntax does look like Java or C# and is quite easy to master.  I've created a little program that will find the best available power cell in the area and will let the robot find it and use it as it's new power source.

Here's the code:
extern void object::FindEnergy()
{
while(true){
object newcell = FindCell();
if (newcell !=null){
message("New cell found!");
turn(direction(newcell.position));
moveToPosition(position,newcell.position);
replaceCell();
} else {
message("Cannot find another cell...");
break;
}
}
}
void moveToPosition(point p1,point p2){
errmode(0);
int err = move(distance(p1,p2)-1.5);
while (err != 0){
turn(45);
move(5);
err = move(distance(p1,p2)-1.5);
}
}
object FindCell(){
message("Scanning for cell...");
int minDist = 5;
object cell = radar(PowerCell,0,360,5);
object otherCell= cell;
while (otherCell != null ){
minDist += 1;
otherCell = radar(PowerCell,0,360,minDist);
if (otherCell != null){
if (otherCell.energyLevel > cell.energyLevel){
cell = otherCell;
}
}
}
if (cell.energyLevel == 0){
cell = null;
return cell;
}
void replaceCell(){
message("Replacing cell...");
grab(EnergyCell);
drop(Behind);
grab(InFront);
drop(EnergyCell);
grab(Behind);
drop(InFront);
turn(-90);
move(4);
}
 
See it in action:


Have fun!

Tuesday, May 17, 2016

Google Spaces just launched...

Yesterday, Google Spaces was available on my iPad and my iPhone.  I downloaded the new thing to try it out and explore the features.

As you may guess, it's a bit lonely in space... (Pun intended).  Basically, you create a "space" about your favourite subject and post links relevent to the theme.  I've created one for ScreenStudio and posted a few links.


After a few posts, I then realized that this is Pinterest à la Google.  You can post (pin) all kinds of links and comments.  You can invite your friends and family to join your own personal space as the only way to join seems to be sharing the "secret" link.  I still don't know if Spaces is meant to create small and personal communities or to be a central point for all the stuff that you are interested in.

On iOS, the app does look nice but lacks the tablet format support.  I will go explore http://spaces.google.com from my computer to see how it does behave on a large display.

If you want to explore a bit, here's the link to the ScreenStudio space: https://goo.gl/spaces/oLeXGyJbHutGwX5v5

More to come...

Sunday, May 15, 2016

Scracth Jr for iOS: Coding for kids


Wondering if you have what's required to create an app or a game?  Why not start gently with Scratch Jr. for iPad.



A few years ago, I was showing my kids what I was doing at my job by using Scratch on the computer.  Basically, it's a software that lets you create small games and applications using logic blocks that you can drag and drop on you characters.  It's a bit like playing Lego blocks with your mouse.

There is an iOS version called Scratch Jr. available in the AppStore.  It targets kids but anyone who wants to learn about software programing can start with this little app.  Of course, you won't be able to publish your apps or create the latest 3D games with Scratch Jr.  It is meant to be a really simplified version of the real thing.  But nevertheless, you will learn about conditions, loops and events in a matter of minutes.


The best thing is that Scratch Jr. is free.  The MIT has created this amazing app so kids, and grown ups, can learn about software development in a fun way.


There is a more advanced version of Scratch available online at https://scratch.mit.edu.

Have fun!

Sunday, May 8, 2016

How to stream to Twitch.tv with ScreenStudio

How to stream to Twitch.tv with ScreenStudio 2.2.0

If you are using Ubuntu (or any derivative), you can easily stream your desktop over Twitch.tv with ScreenStudio.

The main goal of ScreenStudio is to be simple to use and work on almost any hardware.

Get ScreenStudio

First, you need to download the latest version of ScreenStudio from http://screenstudio.crombz.com
  • Install OpenJDK 8 JRE and FFMpeg 
    • sudo apt-get install ffmpeg openjdk-8-jre
  • Uncompress the ScreenStudio archive in a folder
  • Create the desktop icon shortcut by executing the script createDesktopIcon.sh from the installation folder
  • See more installations tips from http://screenstudio.crombz.com/instructions.html

Set your secret key

In ScreenStudio, select the target to TWITCH...


Select the desired server and secret key from your Twitch account.
 





Adjust encoding bitrate and format by selecting the profile...

ScreenStudio has already optimized advanced encoding parameters so all you need to set is the bitrate and preset settings to your needs.

Select your video sources

From the Sources tab, select your audio and video sources that you wish to stream.

  • Display: The screen to stream.  If you have more than one screen, a special one will show up combining all of them in to a single super large screen.
  • Webcam: The webcam you want to use for streaming.  Optionally, you can use the "Mouse" which is a zoomed view of your mouse location.  You can set the webcam location as you like from the parameter buttons...
    • Note: Webcam will only show-up if a Panel is selected..
  • Microphone: Audio source for your microphone
  • Internal: Audio source for your internal sound system
    • If you select both Mic+Internal, ScreenStudio will mix them automatically.
  • Audio Rate: The quality encoding audio settings
  • Watermark:  If PNG files are available in your "Overlays" folder, they will be shown here.  This will add the image as a static overlay in your stream  in the bottom left corner.

Customize your stream

 This is where ScreenStudio shines.  You can select a size panel from a pre-configured HTML file.


Instead of cluttering your desktop view with overlays everywhere, ScreenStudio is adding a side panel (top, left, bottom, right) to display custom informations.

All you need to do is to create a basic HTML file to populate your side panel.  A default sample will be available on your first run.  Not all HTML tags are supported but it does give you a lot of possibilities.

The side panel also supports TAGs as the content is dynamic.  For example, @TEXT will show the content of the text entry at the bottom.

Images (even GIF format) are supported and you can update the content of the HTML file with something else.  Any update on the file will show up in your stream as it is updated.

For example, you could you a generated template file called "Panel.html".  Using a script or any software, you can update that file to update the content as needed, live.  Each time the file is updated, the content will show instantly in your stream.

The @COMMAND tag is used to embed the result of an external command in your panel.  Enter the command line and its output will be shown where you have set the @COMMAND in your HTML file.  That can be useful to create alerts and notifications.

Here's what it looks like when streaming...




Note: Images must be referenced by they full path...

Start streaming

 Once everything is setup, you can start streaming by pressing the "Capture" button or by using a keyboard shortcut.


When capturing, ScreenStudio will hide itself and you can either use the shortcut keys to stop the streaming or use the tray icon at the top.


Enable privacy mode

While streaming, you may want to hide your desktop from your viewers temporarily.  Use the Privacy Mode from the tray icon menu or by invoking the shortcut key.


While in Privacy Mode, the tray icon will be red and you viewers will only see a black screen.  If you add a file "privacy.png" in your Overlays folder, this image will be shown instead of the default back display.



This is a neat way to protect your personal information without having to stop your streaming.

For Support and Help

If you need help, you can post your questions here:


Wednesday, May 4, 2016

ScreenStudio 2.2: A new compositing engine

I've been working on ScreenStudio 2.2.0 today as I was stuck in bed with a major backache.

I took the time to rework the compositing of the desktop and the side panel to provide more customization in the future.

With version 2.1.x, the compositing was executed by FFMpeg itself.  This is faster to render, but the drawback is the synchronization between the audio and video that does not always work as expected.

As of version 2.2.x, ScreenStudio will take charge of compositing all the video sources and FFMpeg will only have to encode the audio and video.

I was expecting a loss in performances but I was quite surprised to find out that nothing was lost.  I even saw better performance in some specific cases.

More tests are to be done but if all goes well, it will open a lot of possibilities for ScreenStudio like dynamic layouts while streaming.

Source code is already available in the Github repository is you feel adventurous....

https://github.com/patrickballeux/screenstudio

Sunday, May 1, 2016

iOS 9.3.1 small bug: Round folders

Just found out that if you use a specific wallpaper for your iOS 9.3.1 device, you will end up with round folders in your homes screen.


If you want to try it out, just follow this link and save one of the image to be used as your home screen wallpaper.  You will then have all your folders in a round shape instead of the default shape.


There's not a lot to choose from, but it's fun to try.  Oh yeah, no jailbreak is required...