Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Forum
1 2 3 4 5 6 Previous Next  
Search
Topic Cannot install Gosu on OS X 10.9.1? By erisdiscord Date 2014-02-03 16:31
I'd like to chime in to add that, if you absolutely must manage multiple ruby versions on your system, use rbenv instead of rvm. It's missing some of the more advanced features of rvm, but you probably don't use them.

rbenv doesn't handle installing Ruby versions on its own, but there is a plugin, ruby-build, that will do that for you.
Topic Space Can By erisdiscord Date 2014-01-18 02:57
Do Z80 next! I ported libz80 to JavaScript a while back for a project that ultimately got a bit overwhelming and I lost interest, but I learned a lot about the venerable-if-wacky Z80 (and the hardware of various 8-bit computers and game consoles) in the process.

I followed the DCPU-16 scene for a while, but ultimately that architecture is a bit too regular to be particularly interesting. C:
Topic Problem running Ruby4Kids!! By erisdiscord Date 2013-12-15 05:57
ugh, is rvm seriously installing gcc just to compile Ruby? Man, I'm glad I ditched it a long time ago for rbenv.
Topic A game with mouse input By erisdiscord Date 2013-12-10 06:25
Yeah, I recommend using the system cursor because it's easy. Just override needs_cursor? in your Window class:

def needs_cursor?
  true
end
Topic Is there actual documentation for gosu? By erisdiscord Date 2013-10-03 17:07
Yeah, I've got so much enjoyment out of Gosu, it really just feels good to contribute back.

Maybe one of these days I'll finish one of the projects I've started.
Topic Is there actual documentation for gosu? By erisdiscord Date 2013-10-02 16:08
Yep, the layout would actually take a lot more work to change than the content! YARD theming is undocumented territory.

Thanks! I wanted to work on something, saw an opportunity and took it. It was about a day's work IIRC and actually pretty fun. Mostly adding actual documentation for a lot of the parameters, fixing a few errors and elaborating on descriptions I thought were unclear. Pretty proud of my work.

I've actually got a writeup explaining the blending modes floating around too but I think I haven't pushed it yet for some reason. Maybe I'll work a bit more on my local copy and send a pull request later this week when I'm not busy.
Topic Font Icons By erisdiscord Date 2013-09-27 01:12
Wow, that's a pretty cool find! Might also be useful when I get off my butt and start working on that new Adium message style I've been kicking around for a while.

Consider sticking that parsing code up on GitHub? I think it'd have a bit better longevity than on a file sharing site. C:
Topic Gosu's OpenGL implementation vs. Python's SDL By erisdiscord Date 2013-09-19 00:59
Re separating "game" from graphics: AFAIK Gosu's rendering system is tightly integrated into the run loop. There's some stuff that has to happen before and after your custom draw method, and I think extracting that from the rest of the library would be difficult and not worthwhile. The architecture is what it is.

I think OpenGL is the best choice for graphics, even 2D. It's much faster than SDL's software-based rendering and it's much easier to do fancy stuff like rotation, perspective transformation and blending modes—not to mention the potential to use GLSL for advanced effects. Gosu doesn't directly support GLSL just yet, but there are already libraries like Ashton that support it as an add-on.

I don't have an answer or opinion for the other questions really.
Topic Suggestions on how to implement syntax highlighting By erisdiscord Date 2013-09-13 18:49
Document it on Font#draw; add a "see also" to Image#from_text with a note saying that that method supports the same formatting codes.

Also, you should note in the docs that this is not actually XML or HTML so XML-style nesting rules don't apply—e.g., <b>bold <i>bold-italic</b> italic</i> is perfectly valid.
Topic Gosu + Ouya? By erisdiscord Date 2013-08-05 21:30
The startup time for any nontrivial application with Ruboto is pretty bad. It's bad enough to be a deal breaker for me.

Plus it's really difficult to debug because you end up with really big stack traces that include jruby internals (think of what Ruby on Rails stack traces look like) and it's often not clear where the error has actually originated in your code. I don't know whether this is a jruby problem or a problem with Ruboto's glue code.

Ruboto doesn't feel like a finished product to me, more of a proof-of-concept.
Topic IDE By erisdiscord Date 2013-07-01 15:14
TextMate 2 is complaining about that bundle.

The bundle “RubyGosu” could not be installed because it is malformed.
The bundle lacks mandatory keys in its property list file.


but it doesn't actually say which keys are missing. Hrmph.
Topic Multiplayer Ruby game possible with UDPSocket? By erisdiscord Date 2013-04-07 21:36
I wish the ENet people (person?) would publish, like, a formal description of the actual protocol and algorithms used so that there can be more than one implementation. The reference implementation's API is kind of…not that great. :\
Topic IDE By erisdiscord Date 2013-03-06 00:50
If you made a TextMate bundle part of the official Gosu distribution, I would be so happy.
Topic IDE By erisdiscord Date 2013-03-05 17:56
I have yet to find a full IDE that doesn't just get in my way.

TextMate (Mac) and Notepad++ (Windows) are both great free code editors (not full IDEs). They do some completion and syntax highlighting, but they don't do as much as Aptana, Visual Studio or Eclipse. You can write your own completions and macros for TextMate, though.

Not exactly what you asked for, but I hope it helps.
Topic gosu shapes color and design By erisdiscord Date 2013-02-24 17:42
There's no way to change it, but you can always draw_quad a shape that fills the whole window. Pass -Float::INFINITY for z to make sure it's drawn below everything.
Topic Regular expressions problem By erisdiscord Date 2013-02-15 00:13
This is more of a general Ruby question, but—

'text[2]_plus[4]'.scan(/\[\d+\]/) #=> ["[2]", "[4]"]
Topic Sapphire - the ultimate Ruby game programming for Windows By erisdiscord Date 2013-01-07 19:29
There's a GitHub app for Windows that should alleviate the headaches if you don't like the command interface. I haven't used it myself, but the Mac app is excellent. Learning Git is a great idea, though, and you'll thank yourself later. C:
Topic Sapphire - the ultimate Ruby game programming for Windows By erisdiscord Date 2013-01-06 16:19
You should put this on GitHub! It's free.

Also, the Ruby parts seem like they would be generally useful outside of the Windows world. Consider making that a separate project so Mac and Linux can play too? C:
Topic Current state of OpenGL? By erisdiscord Date 2012-12-28 21:16
2) I'm pretty sure that's up to your OpenGL library and hardware. Someone please correct me if I'm wrong.

4) Precisely.

I'll leave the other questions to folks who are better equipped to answer them.
Topic Wrong window size By erisdiscord Date 2012-12-12 05:44
It's also a good idea to floor your drawing coordinates if your game uses floats for positioning and stuff. Even with smoothing disabled, drawing a sprite at 0.5, 0.5 is going to have the "pixels" misaligned.

@image.draw @x.floor, @y.floor, @z

or whatever.
Topic Advices for game performance, anyone? By erisdiscord Date 2012-10-16 20:57
Using Chipmunk also means you don't have to write your own spatial hash implementation, though. C:
Topic So how well is gosu doing for iOS development? By erisdiscord Date 2012-10-08 20:12
It's AAC or nothin'.
Topic Really simple 3D modeler By erisdiscord Date 2012-10-04 23:52
Oh hell, I can't believe I forgot Symphony of the Night. But really, who hasn't played that? :D
Topic Really simple 3D modeler By erisdiscord Date 2012-10-02 13:39
It's a pretentious JRPG with giant mecha and the story is incomplete because it was meant to be part of a series. You can probably safely skip it if that doesn't appeal to you. :D

Like the Saturn, where the PlayStation really shined was 2D, but 3D was the hip new thing back then unfortunately. If you want a good PlayStation game, try Tomba or Rayman!
Topic Really simple 3D modeler By erisdiscord Date 2012-10-02 01:12
Man, I'm liking this look too. It kind of reminds me of Xenogears. Did you ever play that?
Topic Current time position and total length of SampleInstance By erisdiscord Date 2012-09-21 03:35
something something O(n) blah blah. 8D
Topic Protecting Ruby code in a published application By erisdiscord Date 2012-08-18 00:39
The only way to really protect that is for the server side to have complete control.
Topic Protecting Ruby code in a published application By erisdiscord Date 2012-08-16 15:39
There's no way to do it that can't be trivially reverse engineered. That's what copyright law is for, though.
Topic Bottomless Mine v.1.0-beta2 By erisdiscord Date 2012-07-17 18:29
Here's a kinda hacky function to get the name of a button from its button id if it helps. For keys that produce printable characters, it returns the character; otherwise, it returns the constant name.

Public domain because it's trivial.

  def button_name id
    unless defined? @button_names
      button_constants = Gosu.constants(false)
                             .grep(/^(?:Gp|Kb|Ms)/)
                             .inject({}) { |h, k| h.merge! Gosu.const_get(k) => k }
     
      @button_names = Hash.new do |names, id|
        ch = button_id_to_char id
        names[id] = (ch and ch.ord > 0x20) ? ch.upcase : button_constants[id]
      end
    end
    @button_names[id]
  end
Topic How do you actually distribute your finished Ruby game? By erisdiscord Date 2012-07-05 23:58
Oh my god, I had not seen that. :D Wow, the arrogance from the developers. That's kind of sad.
Topic How to listen to keys like semicolon and quote? By erisdiscord Date 2012-07-05 03:43
Yes, if you want to use punctuation keys you'll need to have some way for users to configure the keys themselves if you want it to work cross-platform.
Topic How do you actually distribute your finished Ruby game? By erisdiscord Date 2012-07-05 03:40
I definitely wouldn't recommend putting the username and password in the program and connecting to MySQL directly. If you hide your source code, even if you obfuscate it somehow, it's still trivially easy to run the application under a debugger or even open it with a hex editor and find that information. If you encrypt it, you need to also distribute the keys to decrypt, or they can't run your game at all. There's just no way to do something like that securely.

Better to hide the SQL database behind a CGI script (or better still, a web application) that can only add high scores to the table and retrieve them.
Topic How do you actually distribute your finished Ruby game? By erisdiscord Date 2012-07-03 18:46

> If you think that your code is so good that people will steal it, you are a better coder than me. If you think people shouldn't learn by freely looking at your code, then you are a worse person than me :D


This, a thousand times. I think you've summed up my philosophy on, well, pretty much any creative endeavour. I take it one step further and license everything I release permissively, but I won't hold it against anyone who chooses not to take that extra step. C:
Topic Gosu game on Steam? By erisdiscord Date 2012-05-17 03:55
JRuby is written in Java and runs on the Java VM, so any C extension support would most likely have to be a wrapper around JNI.

There is experimental support for C extensions in the latest version, but experimental's the keyword here: most libraries that use it aren't quite working yet and there's no guarantee it won't crash. The more non-trivial a library is (Gosu is very non-trivial; most SWIG-generated bindings are), the less likely it is to work.

Also, I'd be surprised if JRuby's extension support is binary-compatible with MRI; you probably have to recompile. It's pretty hard to actually find any information about it, though.
Topic Gosu game on Steam? By erisdiscord Date 2012-05-16 15:25
I think the reason we've forgotten about it is because Gosu doesn't (and can't easily be made to) work with it.
Topic Is an Audio cache/manager a good idea? By erisdiscord Date 2012-05-14 02:04
Well, that's my advice, but it's up to you to decide what you think is right for your game. Don't let me tell you what to do if you don't agree. :Ɔ
Topic Is an Audio cache/manager a good idea? By erisdiscord Date 2012-05-13 21:38
Some kind of resource manager is always a good idea for a project of any size. I wouldn't personally load every song and sound effect at the beginning, though, unless there are only a few of them.

I might have implemented something like this:

class Audio
  AUDIO_PATH = File.join(File.dirname(__FILE__), 'Audio')
  BGM_PATH   = File.join(AUDIO_PATH, 'BGM')
  SE_PATH    = File.join(AUDIO_PATH, 'SE')
 
  def initialize(source)
    @source = source   # The game window
    @bgm = {}
    @se = {}
  end
 
  # Clear preloaded audio resources.
  def clear
    @bgm.clear
    @se.clear
  end
 
  # Preload the BGM +file+.
  def preloadBGM(file)
    @bgm[file] ||= File.join(BGM_PATH, "#{file}.wav")
  end
 
  # Preload the sound effect +name+.
  def preloadSE(file)
    @se[file] ||= File.join(SE_PATH, "#{file}.wav")
  end
 
  # Play the BGM +file+. If +file+ hasn't been preloaded, it will be loaded
  # on demand the first time it's played.
  def playBGM(file)
    preloadBGM(file).play
  end
 
  # Play the sound effect +file+. If +file+ hasn't been preloaded, it will be
  # loaded on demand the first time it's played.
  def playSE(file)
    preloadSE(file).play
  end
 
end


Call clear at the end of a level, scene change or whatever, then preload any files that you anticipate using.
Topic Gosu game on Steam? By erisdiscord Date 2012-05-02 05:04
See, if I were designing ocra myself, I would have linked with a static libruby, catted a tar archive containing the user-supplied scripts and only the absolutely necessary Ruby libraries to the end of the executable and overridden require with a custom version that searches that archive instead of looking elsewhere on the system. But I'm sure there's a reason I didn't design ocra.
Topic Mouse click detection for overlapping sprites By erisdiscord Date 2012-04-30 17:41
Yeah, I think I might have got the bitmask wrong though for the Texplay example! I think the color Texplay returns is ARGB, not RGBA, so it would really be get_pixel(x, y) >> 24 & 0xff.
Topic Mouse click detection for overlapping sprites By erisdiscord Date 2012-04-30 00:38
Here's a magic incantation that returns an array of boolean values for each pixel. true means the pixel has an alpha of over 50%.

mask = image.to_blob.unpack('L>*').map{|x| (x & 0xff) >= 0x80 }.join(' ')

The array is flat, so index with mask[x + y * image.width]. This is also a very inefficient way to store this information (one pointer to a Ruby object per pixel, plus whatever overhead an Array has), but I'll leave improving on it as an exercise for you. :D

Alternatively, you can use TexPlay, which adds a get_pixel(x, y) method (along with several drawing methods and lots of other nifty image manipulation fun that you probably won't need) and test the transparency that way.

require 'texplay'
class Gosu::Image
  def solid? (x, y); (get_pixel(x, y) & 0xff) >= 0x80; end
end


I'm not sure what the implications are for performance if you do it that way, but it's a lot easier.
Topic Mouse click detection for overlapping sprites By erisdiscord Date 2012-04-30 00:23
I think what OP wants is hit testing that takes transparency into account. I assume they're getting hits on the "wrong" sprite (i.e., not the one it looks like they're clicking) when the transparent region of one is overlapping a non-transparent region of another.

OP: Once you've found your candidates by the usual bounding box method, you'll need to figure out some other way of querying the transparent regions. One way would be to build a bitmask based on the alpha channel and test that. You can get the raw image data by calling Image#to_blob.
Topic Gosu 0.7.43 released By erisdiscord Date 2012-03-21 17:09
<3
Topic Gosu's transform features By erisdiscord Date 2012-02-02 20:42
The C++ methods scale, rotate etc. return a transformation matrix (Gosu::Transform, actually an array of double). You actually want to call Graphics::pushTransform(const Transform&) to apply a transformation, then Graphics::popTransform() when you're done with it.

You can also create arbitrary transformations like skew IIRC, but I'm not an expert on matrix maths.

As implied by the names push and pop, transformations stack, so don't forget to pop everything you push.
Topic How to best use Window#record method By erisdiscord Date 2012-01-28 16:48
Oh, well, that's fine. I guess it's the same problem Gosu has in general, right?
Topic How to best use Window#record method By erisdiscord Date 2012-01-28 04:20
Somewhat related, because a terrible idea has stuck me: is record callable from a thread? Is it meant to be? C: I know that most of Gosu isn't.

It might be cool to have a sort of provider/consumer model for map chunks where one thread generates and managed recorded chunks according to the camera position and the other draws whatever's available. Only for large maps, of course. :D
Topic Additional Mouse Button Support By erisdiscord Date 2012-01-10 23:21
Now you're just being silly. :D
Topic Additional Mouse Button Support By erisdiscord Date 2012-01-09 23:26
KbÖ appears to be a valid identifier in Ruby 1.9.3. C:
Topic Passing around the window variable By erisdiscord Date 2011-12-14 01:55
Ooh, when did that happen? I missed the news somehow. :D
Topic Super Duper Mario By erisdiscord Date 2011-12-09 00:26
Good enough, thanks! C:
Topic Super Duper Mario By erisdiscord Date 2011-12-08 02:41
Foo. I wanted to check this out because it was featured yesterday and I guess I missed the original post. But now I see the download link (and the one for the init script too, since I'm on Mac) has gone 403. Any chance you could reupload elsewhere?

Sorry in advance for practicing thread necromancy.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill