Author:


MonoPack – A lightweight sprite packer.

Posted by on February 28, 2014

What and why is MonoPack?

MonoPack is a simple, comprehensive, lightweight and portable pipeline oriented sprite / texture packer for web, game and software developers alike.

Right now MonoPack is a console-only application, oriented to streamline game and website development pipelines. It’s nature allows it to be automated via batch and scripting engines very easily. It is, as well, completely free for commercial and non commercial projects (contact me for more details)

It’s “page” oriented, meaning it will iterate through a given directory, including all matching images into the final atlas. It does not take into consideration sequential images (animations) nor grouping yet.

It’s always the same story, either the available tools are too slow, cumbersome or have multiple dependencies, they may be free but not functional or prohibitively expensive… The available commercial tools are fine but they’re on the slow end of the spectrum with features most devs will never need and so many lacking important features on their “free” versions that render them virtually useless.

A quick benchmark:

| MONOPACK REPORT | Contact/Author: http://gushh.net |
Directory: ‘warrs/’
Pattern: ‘*.png’
Amount of images: 2194
Atlas Dimensions: [2048, 2048]
Covered Area: 3155592
Total Area: 4194304
Packaging Efficiency: 75.2352%
Time spent: 702ms
Loading: 296ms
Processing: 78ms
Rendering: 265ms
Saving Data: 47ms
Saving Image: 16ms

The resulting atlas (scaled down for display purposes)

The resulting atlas (scaled down for display purposes)

Currently supported atlas formats:

The output is always 32bit with alpha channel (supported if your sprites have them, otherwise it can generate the alpha mask given a color-key, see the configuration file for more information or leave me a message and I’ll try my best to guide you).

Current output formats are:

  • PNG (32Bit)
  • BMP (Bitmap 32bit)
  • JPEG

Planned outputs on future versions: JPEG2000, TGA and RAW.

Planned features:

  • Output separate alpha channel < (being tested)
  • Scaling and Rotation of sprites < (mipmaps pseudo implemented)
  • Sequential grouping for animations
  • Image manipulation functions (contrast, sharpen, etc.)
  • Faster alpha key generator (currently not optimized)
  • Automatic atlas resizing (will be optional) < Done – It’s called AutoSize!
  • Multiple pages per directory (to be implemented)
  • Parameter for output path. < Done – Full parameter support through console.
  • x86 and x64 binaries. < Done

Bugs and (are?) Features

Feature requests and bug reports are welcomed and encouraged. If you would like to support further development of this tool, or if you’ve found it invaluable in your work pipeline, please consider a small donation. You can contact me or click directly on the Donate button.

Why is it called MonoPack?

Originally intended for the Monkey and Monkey-X community, Mono comes from Monkey in Spanish. The rest requires no further explanation! – Needless to say this application is open to all communities and everyone’s suggestions are welcomed.

Obtaining the goodies

If you’ve made it this far, it’s only fair I hand you over the download link:

Please remember: this is a beta version, open to the public for testing. Bugs may be found!  http://gushh.net/dls/monopackb9e.zip

Older versions:

http://gushh.net/dls/monopackb9c.zip

http://gushh.net/dls/monopackb8.zip

http://gushh.net/dls/monopackb7.zip

http://gushh.net/dls/monopackb6.zip

http://gushh.net/dls/monopackb5.zip

http://gushh.net/dls/monopackb4.zip

 

No hard limits imposed on the amount of sprites or alpha channel nonsense.

A Commercial and Freeware GUI is currently being developed.

Thank you for downloading and testing MonoPack!

Cheers,
Gus

China lathe goes Chinese on me.

Posted by on February 26, 2014

When steel turns into butter, again.

I’m starting to believe the best idea for a chinese lathe, as a first mod or project, would be to replace all threaded parts with proper ones. This is not the first stripped thread on the lathe… And rest assured, any time a thread strips, you lose at least half a lathe – functionality wise.

Actually scrap that, the best idea is, if you have the option, not to buy chinese. Buy old iron instead, problem is finding an old lathe that doesn’t have massive wear and isn’t missing most of the parts… So you might need some luck there.

DSCN5157f

Was it made out of rebar? or butter?

DSCN5154f

Dat oiler.

Discussing the problem

Since I don’t have any oiler inserts and I don’t plan on making any, the idea of making a new part from scratch seems sketchy as I wouldn’t have a way to seal the oil and prevent gunk from getting inside the port.

This part is the shaft for the double transmission gear on the banjo, it transmits power, through the two A and B gears, to the gearbox for power feeding, threading, etc. Without it, you only have half a lathe.

The oil port acts as a valve, allowing the oil to only escape through the hole on the shaft, which it does by centrifugal force, allowing a layer of oil to remain in between the bushing of the gears and the shaft itself, reducing friction and wear. Without the valve, very little oil would get onto the shaft and most would fall off the oiling port.

Thankfuly the T-nut didn’t strip, but the thread was slightly damaged and had to be dressed with a tap, it’s been since case-hardened and awaits installation.

Two Options

Either I turn down the stripped M6 portion, counterbore the shaft and press a new stud with an M6x1 thread or I make the whole part from scratch using mild steel (I would like to use brass, but I don’t currenly have any stock big enough). Of course we only have a square portion to chuck onto, that means moving onto the 4 jaw chuck and busting out the indicator. One problem though the square part wasn’t milled exactly 90°, it’s all over the place.

The second option, make the part from scratch out of mild steel and figure out a way to fashion an oiling port.

Contrary to what I thought, and as I’ve mentioned, the square portion was milled flat from round stock, this part did not start life as a square stock. Makes sense, since interrupted cuts are slower in production and you can trade in a bit more material loss over higher productivity time, which means more income in general… Of course, if you use crappy materials, it doesn’t matter how you make the part… it’s always going to be crappy.

Given the slot near the square portion is to engage another part, which acts as a washer and for lack of better words, a sort of thrust “bearing” or “clamp” which also helps lock the parts in place, the head of the part MUST be square, otherwise the other part would also have to be remade since it’s slotted to fit and slide through the square portion.

 

Critical Dimensions:

The shaft is 10mm and pennies, turned down for a perfect sliding fit on the gear train (Currently 10.05mm). The threaded portion is M6x1mm however originally it wasn’t long enough to engage all of the threads on the T nut (not shown on pictures). So while I will duplicate the original part, I might make a second part, with my own design. Of course if I could have it my way I would use at least M8 for this, M10 would be ideal.

Making due with what you’ve got.

For a temporary part, I’m thinking I could skip the oiling (maybe add oil “holes” on the shaft, not through holes, just small pockets throughout to contain oil) and use a slotted head on the end, to fasten the part. This would work perfectly on the short term while I come across better stock or a better design.

Thinking in advance…

Now I can’t help but wonder, should I make spares of every part that’s been damaged?, or should I trust my materials and skills?. For now, let’s make a working part, once I’ve got power feed and threading capabilities back, I might turn spares. This is not the first time a thread strips on this lathe.

Gettin’ busy!

DSCN5165f

Test fitting on the rough blank after careful turning it down to size, the gears turn freely with ever so slightly drag (excellent!)

Filed the flats, parted with the chop saw. Time to debur!

Filed the flats, parted with the chop saw. Time to deburr!

 

The almost finished part, compared to the original.

The almost finished part, next to the original. There’s no real need for all faces to be flat, two are the absolute minimum you need, two is what I did. I faced it on the lathe and deburred the remaining edges with a file.

DSCN5186f

The finished part, Bored the inside, drilled the oil port. Case hardened and black oxide finish. Ready to install!

 

DSCN5188f

All setup and working! Let’s hope it lasts. A new T nut is in order though.

Final notes

All in all a simple project, but shows how even the simplest parts can fail -one way or another- and cause you a lot of trouble.

Once I figure out a simple way to make oiler inserts I’ll most likely be adding one to the new shaft. Next time I will probably use a better material, cold rolled steel isn’t ideal, but it’s what I had. I will probably make spares anyway, including new T-nuts.

I have an idea for a different style oiler (gravity fed, bottle style) but out of cheap aluminum, I would ideally use glass with aluminum caps but at the moment I don’t have a source for small diameter glass tubing (8mm or so) and cutting it might end up being problematic.

Of course there isn’t a lot of space available and it has to be sturdy and reliable. Ideally the originals could be ordered (I really can’t do that anymore) or made to look alike, but they are rather complicated due to the fact they use a tapered spring and require flat milling on the bore of the part, the right sized steel ball bearings, etc..

Either way, rest assured something cheap and simple will be devised!

That’s all for now, cheers.

PureBasic – strip_tags() just like in PHP!

Posted by on February 11, 2014

Let the strippin’ begin!

This is a basic implementation of PHP’s strip_tags() for PureBasic, it’s not fully optimized but it’s fast enough for most applications. It doesn’t use native string manipulation functions, instead it parses through each character of the string.

Naturally it’s going to be faster than using REGEXP, but not as flexible. Lots of room for improvement, but for now it is what it is!

Procedure.s strip_tags( *szInput.character)
	Define.s szOutput
 
	If (*szInput)
 
		Repeat
 
			If (*szInput\c = '< ')
				;Strip markup tags (completely)
				Repeat
					;-ToDo: add support for selective tag stripping!
					*szInput + SizeOf(CHARACTER)
				Until *szInput\c = '>'
 
			Else
 
				;Not a tag?, process for entities or send to output directly
				Define.c ThisCharacter = *szInput\c
				Select ThisCharacter
					Case '&' ;Entity
						*szInput + SizeOf(CHARACTER)
						If *szInput\c = '#'
							*szInput + SizeOf(CHARACTER)
							Define.s szEntity
							Repeat
								szEntity + Chr(*szInput\c)
								*szInput + SizeOf(CHARACTER)
							Until *szInput\c = ';'
							szOutput + Chr(Val(szEntity))
						EndIf
					Default
						szOutput + Chr( ThisCharacter )
				EndSelect
 
			EndIf
 
			*szInput + SizeOf(CHARACTER)
		Until *szInput\c = #Null
		ProcedureReturn (szOutput)
 
	EndIf
 
EndProcedure

Simple use example:

Define.s test = "<p>Test paragraph.</p><!-- Comment --> <a href="+Chr(34)+"#fragment"+Chr(34)+">Other text</a>"
 
Debug test
Debug strip_tags(@test)

Got any ideas on how to improve this?, let me know!

Enjoy,
Gus

Android – Debugging through WIFI

Posted by on February 9, 2014

Ever wondered if you could use ADB through WiFi to avoid using the USB connector while debugging on Android all the time?, turns out you can and it’s simpler than you thought!

Of course, the first step is to root your Android device, But don’t worry, it’s also very easy now adays. I recommend you try Framaroot — Yes, in theory there could be some risk involved, but given the current state of Framaroot I’ve never had a problem and it takes about 3 seconds to root your device, you don’t really need to reboot it either although it’s recommended.

Once you’ve got SU (SuperUser), you can proceed to install WiFi ADB — Avoid any other application, specially if it requires a host on your desktop / dev box since really, you’ve rooted your device, no need to go around obstacles that aren’t there anymore.

Now, simply start WiFI ADB and enable it, the final step is to get your ADB to listen to your device through TCP/ip, we simply open ADB via the console and perform the connect command followed by the ip and the port of your device.

For example in my case:

adb connect 192.168.2.100:5555

ADB should then report “connected”, otherwise make sure your device is listed to begin with using the “devices” command, it should pop the id of your device. Otherwise, make sure WiFI ADB is enabled.

That’s all!

Free Game Resources – Cloud pack with full alpha channel.

Posted by on February 1, 2014

Sample set of volumetric clouds

It’s been a while since I shared some of my game development related artwork, but here’s a nifty set of volumetric cloud samples I’ve made for one of my projects, the various shapes contained allow to create a vast amount of variations rather easily.

 

cloud_pack

 

These images contain full alpha channel and are all 512×512.

Download here: gushh_dot_net_cloudpack

Some of the clouds have a dark background (night) — Others are daylight based, however they can be mixed using various rendering and blending methods to obtain rich pseudo dynamic clouds at a low processing cost.

Rendering Tips

An ideal blending method would be to utilize the luminosity of the samples to blend against an existing background, then through the use of layering and clever movement quite interesting cloud representations can be achieved for games and simulators, and why not a screensaver?.

Closing up

These samples are free of use for non commercial projects, however credit must be given.
If you need a complete set, higher resolution renders or other custom work — Feel free to contact me for extra details!.

Also, feel free to send in your suggestions for future freebies, I’m open to a challenge.

Enjoy,
Gus