Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
space kobold
Oct 3, 2009


I've been waiting for a thread on Rust to pop up, as I'm far to lazy to have made my own.

I've got a couple of fun little projects going in Rust, the largest of which is slowly shaping into something of a game (that only consists of a terrible animation system/scene manager/ai with behavior trees as of yet). Super thrilled that it's finally hit its big 1.0 (alpha)! Though most of the standard library is marked as unstable and likes to stare threateningly at my codebase with maniacal intent to break any and all of my builds at a moments notice.

Certainly liking the language so far, as someone who primarily codes in C and Lua for fun, C# professionally, and tends to avoid C++ like the plague.

All of the big Rust irc chatrooms on irc.mozilla.org are all super active as well, with people that love to chip in and help with things. So I'd highly recommend parking yourself in one or more if you want to seriously delve into Rust.

Adbot
ADBOT LOVES YOU

space kobold
Oct 3, 2009


Once you get over the initial hurdle of everything bitching at you about lifetimes and learning the ~Rustic~ approach to things, like always returning just a plain bit of value and letting the caller decide if they want to box it (unique pointer to heap allocated memory), stick it on the stack, atomic reference count it, etc, things really start to click and you can appreciate the beauty of what they're trying to do with the language.

Then you get to things like structures holding references to data or non object-like trait objects, and get to start the whole process over again while idly scratching at your head.

The documentation is already loads better, and I'm fully anticipating a much wider array of user friendly tutorials, examples, and eventual books to start pouring out as more and more of the rust standard library gets that wonderful Stable stamp of feature lockin.

Of course they just completely broke most libraries by renaming the core io module to old_io in anticipation of redoing the whole drat thing, so we still have awhile to go yet before we get our true 1.0 release.

space kobold
Oct 3, 2009


I'm currently working on building an Entity Component System for a (potential) game I'm making. Only just started a few days ago, but it's slowly shaping up.

Current usage looks like:
Rust code:
let mut em = EntityManager::new();
let ent = em.create_entity();

em.add_component::<component::Spatial>(ent);
em.add_component::<component::Age>(ent);
// adding the Age component should cause the entity to be registered with the Aging system.
assert!(em.is_managed::<system::Aging>(ent));

// this will age the entity by one second.
em.update(1.0);

let age_component = em.get_component::<component::Age>(ent).unwrap();
// age_component.age should now be 1.0
assert!(age_component.age > 0.9);
assert!(age_component.age < 1.1);

let position = em.get_mut_component::<component::Spatial>(ent).unwrap();
position.x = 10.0;
position.y = -300.0;
Only used four unsafe blocks and some pretty hacky looking macros! :eng99:

edit: link removed, no longer valid.

space kobold fucked around with this message at 20:43 on Mar 9, 2015

space kobold
Oct 3, 2009


I made a huge macro that builds a static list of components, using some unsafe blocks to manipulate the signature for each components array of data.

Bit hacky, but it seems to work. The list is constructed like so:
code:
use std::default::Default;

#[macro_use]
mod macros;

/// trait shared by all components
pub trait Component: 'static+Default {}

/// component representing coordinates in 2d space.
#[derive(Copy, Debug, Default, PartialEq)]
pub struct Spatial {
    pub x: f64,
    pub y: f64,
}
impl Component for Spatial { }

build_component_list!(
    Spatial,
);
edit: link removed, no longer valid.

space kobold fucked around with this message at 20:43 on Mar 9, 2015

space kobold
Oct 3, 2009


blog.rust-lang.org posted:

Rust 1.0: status report and final timeline

Feb 13, 2015 • The Rust Core Team

It’s been five weeks since we released Rust 1.0-alpha! Before this release cycle finishes next week, we want to give a status report and update on the road to 1.0 final.

TL;DR: Rust 1.0 final will be released by May 15, 2015

...

http://blog.rust-lang.org/2015/02/13/Final-1.0-timeline.html

We've got a release date folks!

space kobold
Oct 3, 2009


The best part about it is that everything in it is more or less feature locked and fairly stable, so every single library in existence isn't going to break every other week so long as they're building against the beta.

Adbot
ADBOT LOVES YOU

space kobold
Oct 3, 2009


I've got one dependency that only compiles on the 1.1 nightly, and another dependency that only compiles on the 1.0 beta. Welp.

:negative:

So much for my earlier prediction of things being much more stable and uniform as we approach that big 1.0 release.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply