Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Rewrite of SFML in Google's Golang  (Read 6904 times)

0 Members and 1 Guest are viewing this topic.

foobarbaz

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Rewrite of SFML in Google's Golang
« on: September 21, 2013, 10:46:23 pm »
Hey all! So I changed my name (I'm DrSuperSocks, but tedsta includes my actual name (Teddy), is shorter, and a 19-year-old shouldn't have an alias that sounds like a 13-year-old's).

EDIT:

I originally posted my whole game engine, which uses a rewrite of the Graphics module of SFML I did. But I realize now that my game engine isn't relevant to any of you, and the only thing I was really showing off was my rewrite of SFML. So, here is my rewrite of SFML in Golang. It took 3 days to write the code, then another 3 or 4 days to get the code to actually work ;) Parts of it still feel clunky, as C++ doesn't translate perfectly to Golang. The two biggest issues are the lack of const reference and inheritance.

So far, I've only rewritten a good chunk of the graphics module. That may be as far as I go, unless I need more features out of SFML.

Check it out here: https://github.com/tedsta/gosfml

PS: There are existing SFML bindings for Go, which I was originally using, but I wanted to be able to touch the variables in primitives, like Vector2.
« Last Edit: September 22, 2013, 03:37:41 am by tedsta »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9720
    • View Profile
    • development blog
    • Email
Re: Rewrite of SFML in Google's Golang
« Reply #1 on: October 04, 2013, 06:44:30 pm »
Oh that topic changed, luckily I haven't written my blog post on it yet. ;D

If you can provide the necessary details you might get added to the Official Bindings Website.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

netpoetica

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Rewrite of SFML in Google's Golang
« Reply #2 on: October 18, 2013, 05:52:54 am »
This is super :) would love to see a examples folder or examples repo to compliment this.

Some detail in the README about your approach would also be nice

Additionally, you may want to keep a running log in the README of problems you find

Cheers!

foobarbaz

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Rewrite of SFML in Google's Golang
« Reply #3 on: October 18, 2013, 10:22:18 pm »
Oh, I didn't realize people cared, I haven't checked the forums in a while. Haha.

I'd totally be down to write a pong example, I'll do that this weekend. Also, if you want to see how I'm personally using it, the rendering portion of my engine uses it: https://github.com/tedsta/fission/tree/master/rendering. I'm writing a game in Go to see if it's suitable for game development. So far it's been alright, but I'm heavily considering switching back to C++ as two of my buddies at the university just joined the team, and we all main in C++, so having them try to learn a new language might not be so effective. At first I was just toying around, but the game quickly evolved into something we actually want to finish.

netpoetica

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Rewrite of SFML in Google's Golang
« Reply #4 on: October 20, 2013, 04:14:11 pm »
This is all very cool! Any reason for using SFML only for graphic and not events/input? And an example pong would be awesome - even some more basic NeHe examples would be cool.

I love the idea of being able to write cross-platform games w/ Go, the language has a very expressive & modern feel that I think will help prevent some of the developer distraction that C++ and it's enormous syntax bring into the process (I imagine dev time + compile time being drastically better for game dev in Go, even if performance is a little weaker).

Your port here is very future-facing, because although SFML dev seem to have been slightly opposed to OpenGL ES (if you check these forums), the desolation of the PC and console gaming industry (desolation prob an exaggeration) and growth of mobile gaming will force SFML author to support ES or become irrelevant (and soon). The competitiveness of the gaming industry nowadays doesn't allow most game developers the 3-6 years they need to create impressive, immersive experiences, and languages like C++ are not necessarily great for fast-paced, iterative development. EDIT: what I mean here is that when SFML3 w/ ES comes around, you will probably find more Go people interestedin SFML, and you may be in a good position to be a leader in that front.

As far as your friends who use C++ not learning go - I think since you guys are in University, now is the best time to try new languages :) if they were married w/ kids and trying to find time to learn Go while changing endless diapers, then I would see the benefit of sticking to what you know. Additionally, if you guys write your code modularly enough, you should be able to port to C/C++ very easily if Go starts to feel too weak.

Anyhow, I'll keep an eye on your repo and once I get a little bit of code operational I should be able to contribute some. Additionally, I am curious for more detail about why you chose to rewrite instead of using the bindings from krepa
« Last Edit: October 20, 2013, 04:20:46 pm by netpoetica »

foobarbaz

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Rewrite of SFML in Google's Golang
« Reply #5 on: October 22, 2013, 02:12:09 pm »
Thanks! I like feeling cool  8)

SFML is only used for graphics because I was just toying around at first, and forgot to implement SFML's events/input. Good point. I'll try to get that done soon. I also need to benchmark this against the SFML Go bindings https://github.com/drhodes/go-sfml. I'll post the results back here.

If anyone knows of Spine, that recently kickstarted 2D skeletal animation software, I got it working with my game engine as well. Haven't committed yet, but you can expect it in a few days after I apply the polish. A big round of applause to the guy who wrote this (https://github.com/ajhager/spine), he did a fantastic job adapting the C spine runtime. I'm hoping I can convince the spine devs to officially support Go.

I was pretty busy this weekend, but I finally got around to writing that pong sample.
https://github.com/tedsta/gosfml/blob/master/examples/pong/main.go

After a few more days of dev, we've decided to most likely push forward with Go. A big reason we were thinking about switching was also because my friend is in the final interview stages with Microsoft, where he'll be working with C++. But we got our 4th and final member on the team, and he votes Go, which makes the vote for Go win 3 to 1.

I'll be writing a short tutorial on how to set up gosfml sometime this week, as installing go-gl and go-glfw3 is a huge pain on Windows, and a little easier on Linux.