News for hackers. Stuff that matters.
Re:Building Street Fighter II in Ruby [video] by mmanfrin on Tuesday June 16, 2015 @07:33PM (#9729315)
It is really fun to see games coded in a language you know (and is not used for gamedev) -- completely new way of programming/thinking.

There is another great video similar to this of Tom Dalling coding a flappy bird clone using Gosu:

https://www.youtube.com/watch?v=QtIlyU2Br3o

Re:Building Street Fighter II in Ruby [video] by pjmlp on Wednesday June 17, 2015 @07:56AM (#9731178)
That is how C and Pascal got to displace Assembly, and C++ eventually displaced C in game development.

By having devs that instead of following "it cannot be done", persisted and eventually were able to release something in those languages that others wanted to play.

Having watched this cycle a few times, I always look forward to see higher level programming languages used in broader contexts.

However for game development, maybe Crystal instead of Ruby would still be a better option, in terms of raw performance and distribution.

Re:Building Street Fighter II in Ruby [video] by MadRabbit on Wednesday June 17, 2015 @08:04AM (#9731208)
considering rubymotion, i think ruby is still a feasible option though
Re:Building Street Fighter II in Ruby [video] by gurkendoktor on Thursday June 18, 2015 @01:32AM (#9736983)
RubyMotion support for Ruby/Gosu is on the way too (it does not work automatically): https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1194

RubyMotion just badly needs a .NET/IronRuby port, or anything else that'll work well on Windows... :(

Re:Building Street Fighter II in Ruby [video] by pjmlp on Wednesday June 17, 2015 @08:06AM (#9731217)
Yes, assuming something similar ever becomes available outside the Apple world. AFAIK they only focus on those systems.

But yeah, I imagine compiling Ruby is not much dissimilar than compiling Dylan.

Re:Building Street Fighter II in Ruby [video] by vidarh on Wednesday June 17, 2015 @08:58AM (#9731460)
I don't know Dylan, but compiling Ruby is a nightmare. As such it's also a fun challenge (working on "as static as possible" Ruby compiler).

Actually, compiling Ruby is not that bad, horrible grammar (from the perspective of having to write a parser - as a user o the language I like it) notwithstanding.

Compiling Ruby into efficient code is a nightmare.

The problem is largely that there's a total lack of delineation of application read/load time and runtime, coupled with the ease of being able to mutate the object model.

E.g. in theory on return from any method statement the entire world might have been transformed. 2 + 2 = 4 one moment, only for 2 + 2 to have side effects and return 5 the next...

The "quick and dirty" way of compiling Ruby is to accept that you'll need expensive dynamic message call invocations all over the place.

Optimizing beyond that is a lot of work to ensure you can handle it when people start playing silly games. The jRuby Truffle backend is probably the best bet at the moment (Chris Seaton who did the initial work on that is on HN). If I ever get that far with mine, I'll be stealing lots of ideas fro there...

Re:Building Street Fighter II in Ruby [video] by pjmlp on Wednesday June 17, 2015 @09:56AM (#9731752)
Dylan is a Lisp with Algol like syntax targeted for systems programming with a REPL, AOT compiler and IDE like environment.

So what you are telling about Ruby is also an issue in Dylan, given its Lisp heritage and flexibility.

Re:Building Street Fighter II in Ruby [video] by MadRabbit on Tuesday June 16, 2015 @08:44PM (#9729537)
looks awesome, thanks for the link!
Re:Building Street Fighter II in Ruby [video] by agentultra on Wednesday June 17, 2015 @10:04AM (#9731800)
Very cool!

It's actually stunningly common to use high-level languages with managed run-times in games these days. Most indie and small-studio games we play today were built using one engine or another. The graphics pipeline in Unity, Gamemaker, etc might be heavily optimized but the majority of the game is written in an interpreted or managed language run-time like Lua or C#.

You can write 3D simulations with a decent frame-rate in Python. You just need a lot of help with the "hot" spots be calling out to C and C++ libraries for support. I've been experimenting with writing little 3D engines in Cython + Python + SDL2. It does end up taking a load more memory and performance can drop drastically if you're not consciously thinking about your data-flow. The trick I've found is to avoid most of the features that make Python great in those critical sections... plain old data structures, weak references, pack your data together and transform it once (ie: avoid copies).

However it's great for prototyping and toying with new ideas. Python is vastly more forgiving when you don't know up-front how you're going to structure your data flows.

But in the end I just end up going back to C99 at some point anyway.

Writing games in Ruby shouldn't be weird. It's cool.

Re:Building Street Fighter II in Ruby [video] by keyle on Tuesday June 16, 2015 @09:46PM (#9729687)
Very cool Nikolay. I also dig the git-wayback machine briefly showcased.

https://github.com/MadRabbit/git-wayback-machine

Re:Building Street Fighter II in Ruby [video] by senthilnayagam on Wednesday June 17, 2015 @12:47AM (#9730130)
thanks for the find, tried it found a bug and fixed it too :)
Re:Building Street Fighter II in Ruby [video] by MadRabbit on Wednesday June 17, 2015 @03:19AM (#9730424)
hey Senthil, thanks for the fix! just rolled out a new version to rubygems :)
Re:Building Street Fighter II in Ruby [video] by whistlerbrk on Tuesday June 16, 2015 @09:03PM (#9729593)
Fantastic tutorial, I really like his presentation style of progressively walking through the commits. Great work.
Re:Building Street Fighter II in Ruby [video] by minhtran on Wednesday June 17, 2015 @05:24AM (#9730743)
Do you have plan to add the code when 2 players hit each other?
Re:Building Street Fighter II in Ruby [video] by omouse on Wednesday June 17, 2015 @12:42PM (#9733225)
I was just gonna say; the starting portion is to get something displayed, next step is collision detection and the victory conditions.
Re:Building Street Fighter II in Ruby [video] by MadRabbit on Wednesday June 17, 2015 @08:02AM (#9731205)
when i have time for it, yes. that would be my next sprint on the project
Re:Building Street Fighter II in Ruby [video] by hellbanner on Tuesday June 16, 2015 @11:43PM (#9729967)
Cool stuff! Coding attack sequences, combos and reading commands like quarter-circles is a fun exercise, too. You have to balance between precision and ease of use.

Interesting strategies arise when this glitches:

http://wiki.shoryuken.com/E._Honda_(ST)#Stored_Oicho (Street fighter 2)

Re:Building Street Fighter II in Ruby [video] by ivan_ah on Wednesday June 17, 2015 @12:37AM (#9730093)
Very cool and readable.

For something even cooler (but less readable) here is SF alpha, in js: https://github.com/gamedev8/js-sfa (very faithful to the SF alpha game mechanics)

Re:Building Street Fighter II in Ruby [video] by mikeskim on Wednesday June 17, 2015 @12:58AM (#9730149)
this game feels nothing like street fighter alpha to anyone who has played sf competitively. it might look like it though.
Re:Building Street Fighter II in Ruby [video] by MadRabbit on Wednesday June 17, 2015 @12:43AM (#9730117)
yeah i saw that one. it's alright. i'd do the sprites mapping in css with `clip` though :)
Re:Building Street Fighter II in Ruby [video] by BilalBudhani on Wednesday June 17, 2015 @02:40AM (#9730347)
I used to be a die hard fan of this game in my early teenage days and now Ruby is my most favorite. It would be a lot of fun building this game and connecting to some of my old memories. Thanks Nikolay.
Re:Building Street Fighter II in Ruby [video] by MadRabbit on Wednesday June 17, 2015 @03:10AM (#9730403)
hey, no problem. send me a pull request! ;)
Re:Building Street Fighter II in Ruby [video] by Rainymood on Wednesday June 17, 2015 @03:04AM (#9730389)
Awesome! Please finish this up I have always been so intrigued on game design, especially fighting games.
Re:Building Street Fighter II in Ruby [video] by amorphid on Tuesday June 16, 2015 @08:49PM (#9729551)
Hey Nikolay, now write it in Bash!
Re:Building Street Fighter II in Ruby [video] by ekianjo on Tuesday June 16, 2015 @10:59PM (#9729863)
Bash would be really painful :)
Re:Building Street Fighter II in Ruby [video] by mc_hammer on Wednesday June 17, 2015 @09:55AM (#9731749)
good watch

i liked the explanation of reducing draw() to 1 sprite per call and the little formula that went along with it; ive never seen that. make a video about just tricks used in the industry!

Re:Building Street Fighter II in Ruby [video] by lanebrain on Wednesday June 17, 2015 @04:13AM (#9730548)
Very cool! Well done Nikolay. Cheers!
Re:Building Street Fighter II in Ruby [video] by axx on Wednesday June 17, 2015 @08:21AM (#9731283)
Very cool, thanks for sharing! :)
Re:Building Street Fighter II in Ruby [video] by angeloxlr8 on Tuesday June 16, 2015 @09:13PM (#9729616)
this is very awesome, big fan of the presentation technique
[dead]
Re:Building Street Fighter II in Ruby [video] by Plough_Jogger on Tuesday June 16, 2015 @09:19PM (#9729632)
Difficult to do with a language that isn't Turing complete.
Re:Building Street Fighter II in Ruby [video] by esaym on Tuesday June 16, 2015 @10:47PM (#9729836)
You can at least make a raid 4 simulator in SQL: (from http://www.baarf.com/ ) http://www.miracleas.com/BAARF/raid.zip
Re:Building Street Fighter II in Ruby [video] by tlarkworthy on Tuesday June 16, 2015 @10:02PM (#9729736)
It is though. You just write the results of a query back in the database in a loop (along with the current commands from the player).
Re:Building Street Fighter II in Ruby [video] by hobs on Tuesday June 16, 2015 @10:37PM (#9729816)
Re:Building Street Fighter II in Ruby [video] by untog on Tuesday June 16, 2015 @10:11PM (#9729766)
Nah, needs to be written in CSS or I'll never be impressed.
Re:Building Street Fighter II in Ruby [video] by MadRabbit on Tuesday June 16, 2015 @10:17PM (#9729778)
it's actually easier to write it in css than in ruby as it has all the animations toolset already in place
Re:Building Street Fighter II in Ruby [video] by andrewdon on Tuesday June 16, 2015 @09:44PM (#9729682)
the link is dead
Re:Building Street Fighter II in Ruby [video] by MaulingMonkey on Wednesday June 17, 2015 @03:21AM (#9730430)
Works here (tm).

Releated links which may work for you if the article link is still dead:

https://youtu.be/_whiCEywodw https://github.com/MadRabbit/ruby-fighter