Not logged inGosu Forums
Forum back to Help Search Register Login
Up Forum
1 2 3 4 5 6 Previous Next  
Topic Color Constants By erisdiscord Date 2010-01-16 16:17
And if the above suggestions aren't an option (if you're reading those strings from a file or network stream or something) then you could transform them like so:

@actual_colors = do |triplet| 255, *triplet.split(',').map { |n| n.to_i }

Do this once, obviously. If you do the transformation every frame then it's going to be slow. I don't recommend doing it like this if you can take one of the other solutions because it unnecessarily complicates your code.
Topic Audio By erisdiscord Date 2010-01-15 17:11

> If there was no commercial project driving Gosu, the library and this board wouldn't be here.

You've got me curious; what is this commercial project? I've looked but I can't find anything online. :)
Topic Audio By erisdiscord Date 2010-01-14 22:58
my point is it's perfectly possible (as far as I'm aware) to write a game in C++ with Gosu. In fact, from the looks of things in the repository, Objective-C might be an option as well.
Topic Audio By erisdiscord Date 2010-01-14 22:12

> … I think for the commercial games languages like C++ are better.

Gosu is written in C++ with Ruby bindings, so this argument doesn't really hold up.
Topic Yet Another Tile Map Library By erisdiscord Date 2010-01-08 19:44
I've been working on a tile map library of my own, with a focus on the TMX format. It is, appropriately, called gosu-tmx and I'm hosting it over at github. Licensing is the same as Gosu itself. It only supports the orthogonal projection and that will probably remain the case forever since that's all I'm interested in.

Some highlights:

* Uses autoload so stuff isn't loaded till it's used.
* Loads all layers, object groups and tile sets and caches the tiles for faster rendering.
* There is a hook for creating objects so your own code has total control over that (you aren't forced to use Chingu or something else).
* Tile data is decoded in a way that is hopefully extensible (in case Tiled adds bzip2 compression or uuencoding or something crazy like that).

Future hopes, dreams and plans (which may or may not change):

* Might add a subclass that automatically creates Chingu objects in the future.
* I'd like to abstract the Gosu requirement into a subclass or module also, with user callbacks for tile map loading.
* Runtime modification of maps. For now that business is a bit hairy.
* Support for other map formats, which will make the name misleading.
* Support for defining tile geometry and generating convex polygons from tiles for Chipmunk.
* Make it a gem once I feel the API is stable enough to subject the rest of the world to it.

Actually, I don't recommend using this in production code yet, but if you'd like to check out the source and give it a try, maybe give me some feedback about what I could do better, please do! Fork me on github if you think you have something to contribute.
Topic Tile maps... By erisdiscord Date 2010-01-03 19:38
Looks (and sounds) good to me. I think you should put it on github so other people can help. :)
Topic Need your opinions: Tile Map saving By erisdiscord Date 2010-01-01 22:26
A possible solution nobody has mentioned is to use Array#pack and String#unpack to save the numbers as raw bytes or whatever. If you thing 256 tiles (well, 255 + blank) is enough and you're ok with binary files, then tile_data = tiles.pack('C*') will give you a binary string (not human readable, obviously) and something like tiles = tile_data.unpack('C*') will give you back that array.

If 256 isn't enough (you crazy fellow) then you could use a different format string: n* would convert the numbers to unsigned 16-bit integers, giving you 65536 possible values. As a bonus, the N and n specifiers both use network (big-endian) byte order so it's the same on Intel, PowerPC and everywhere else.

See and for more information about what pack and unpack are doing and what the format strings mean.

If you don't want to save a binary file (for instance, if you intend to store other information in a human readable format) then you could Base64 encode it, although that will bloat the file size. You could also use zlib compression before you encode it, but now I'm going a little beyond the scope of the discussion. :)
Topic Tile maps... By erisdiscord Date 2009-12-29 08:07
That depends entirely on what you need. The XML format of Tiled maps is both a blessing and a curse. What do you want in a map exactly?
Topic Chingu - A game framework for Ruby / Gosu By erisdiscord Date 2009-10-10 02:18

> I know nobody will even look at a framework if it's not documented …

You kidding, mang? You've described exactly the kind of framework I've tried to write. I'd look at the source code if I had to, because this sounds incredibly useful. I'll be trying it myself momentarily. Thanks in advance!
Topic Showing a new window just hangs in Linux By erisdiscord Date 2009-10-03 16:01
Ah, so it's not actually hanging then. Like Julian said, are you running a compositing window manager, and have you tried turning off compositing?

Does other software that uses OpenGL work?
Topic Showing a new window just hangs in Linux By erisdiscord Date 2009-10-01 18:37
We should probably find out whether it's doing its magic but not showing a window, or it's hanging in the window creation bit. Try running this and let us know what it prints, if anything:

require 'gosu'

class LookABug < Gosu::Window
  def show
    @last = 0;
  def update
    t = Gosu::milliseconds
    if @last < t - 1000
      puts "update"
      @last = t

puts "before main loop", 100, false).show

It should only print once per second so's not to flood you with update update update. I doubt this will be a useful diagnostic, but it's worth a shot.
Topic Scaling and Blurring images in TexPlay By erisdiscord Date 2009-09-27 16:57
Why not just have the scale factor as an optional parameter to the splice method? I think it would make for a cleaner API.
Topic Post processing effects for Ruby By erisdiscord Date 2009-09-23 17:06
Hey, this is theoretically totally awesome. OK, in practice it's awesome too, but I've got the same problem as deps above when running test_multiple.rb and  test_contrast.rb. test_pixelate.rb runs with no complaints.

My setup is Ruby 1.9.1 revision 24175 from MacPorts, ruby-opengl 0.60.1 (freshly updated just five minutes ago) and Mac OS X 10.6.1. Everything is compiled for x86_64.

I have no problems with Gosu and doing raw OpenGL calls has worked for me as well. I'm on a MacBook Pro with one of those fancy GPUs with, like, its memory and stuff, so I don't think the hardware should be a problem. Actually, OS X emulates unsupported calls on the less capable GPUs with dynamically loaded LLVM routines, so even there it shouldn't be a problem (except maybe poor performance).

Edited for formatting. My brain was in Markdown mode.
Topic Game state manager for Gosu (Gem available) By erisdiscord Date 2009-09-14 06:51
Perhaps you should create another GameState subclass as part of your library—something like, er, Transition—and have that class implement all the magic like switching to the next state automatically. Transitional states such as FadeTo, obviously, would inherit from that.

Oh boy, when the alert popup told me I was replying to a post older than 24 hours, I didn't realise it was from last month. Sorry, I'll pay more attention next time!
Topic Gosu with MacRuby By erisdiscord Date 2009-08-10 13:51
I've thought about it, but I use Ruby because I don't like the C bit of Objective-C (and I'm not very good at it, for that matter). I'm content to wait. :)

I've built MacRuby from source a couple of times and the Rakefile has the option to build a static library as well. I think it requires the Objective-C garbage collector to function, though, and I'm fairly sure the iPhone doesn't support that.
Topic Gosu with MacRuby By erisdiscord Date 2009-08-10 05:14
And I've just registered a user name. Responding to my own post so I'll get reply notifications I suppose. Hope nobody's bothered!

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill