Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411273 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 02:10:07 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 165 166 [167] 168 169 ... 279
Print
Author Topic: The happy programmer room  (Read 672852 times)
Geti
Level 10
*****



View Profile WWW
« Reply #3320 on: April 03, 2013, 07:31:46 PM »

We made a pact with the devil yesterday: we started using the EA STL in KAG.

So far it's been great. It's much faster, which is exactly what we wanted it for. Here's hoping no ghoul in a suit comes for our souls in a few years Droop
Logged

Muz
Level 10
*****


View Profile
« Reply #3321 on: April 04, 2013, 11:45:20 PM »

Was doing stuff with databases in my country. Apparently quite a few people legally registered their names with "Mrs" in front. I wonder if I can register my kid with the name of "Dr".
Logged
s_l_m
Level 8
***


Open to collabs


View Profile
« Reply #3322 on: April 05, 2013, 05:51:23 AM »

I hate making collision detection systems, so I am happy that's over with  Grin
Logged

Think happy thoughts.
oahda
Level 10
*****



View Profile
« Reply #3323 on: April 13, 2013, 07:03:54 AM »

Last time I tried to set up SFML 2.0 with Xcode 4.5 in OS X Mountain Lion about a month or two ago I failed miserably. I tried again today.



I am now a happy programmer and all set for the upcoming Ludum Dare! Well, as soon as I install this on my Linux computer as well and set it all up so that I can deploy the application on Max, Linux and Windows all the same.
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3324 on: April 19, 2013, 09:21:53 AM »

Finally I managed to find a good use for C++11 lambdas, and it's awesome Beer!

Code:
void SoundBuffer::Chunk::loadAsync()
{
DEBUG_ASSERT( !isLoaded(), "The Chunk is already loaded" );

//schedule loading in an helper thread
Platform::getSingleton()->getBackgroundQueue().queueTask( [ & ]()
{
onLoad();
} );
}

The BackgroundQueue is an interface to a thread pool (currently only 1 thread) which will execute the function.
The cool stuff is the [&] which basically means that everything is inside that call is executed as if it was a method of SoundManager::Chunk, even though it is executed on a random thread.

And the cool thing is that it took pretty much an hour and 100 lines to write Smiley
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3325 on: April 19, 2013, 01:35:58 PM »

Finally I managed to find a good use for C++11 lambdas, and it's awesome Beer!

Code:
void SoundBuffer::Chunk::loadAsync()
{
DEBUG_ASSERT( !isLoaded(), "The Chunk is already loaded" );

//schedule loading in an helper thread
Platform::getSingleton()->getBackgroundQueue().queueTask( [ & ]()
{
onLoad();
} );
}

The BackgroundQueue is an interface to a thread pool (currently only 1 thread) which will execute the function.
The cool stuff is the [&] which basically means that everything is inside that call is executed as if it was a method of SoundManager::Chunk, even though it is executed on a random thread.

And the cool thing is that it took pretty much an hour and 100 lines to write Smiley

My brain is bleeding. Apoplectic
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3326 on: April 19, 2013, 03:44:26 PM »

My brain is bleeding. Apoplectic

but... but... it is as good as C++ threading can get Epileptic
Logged

Will Vale
Level 4
****



View Profile WWW
« Reply #3327 on: April 19, 2013, 06:46:58 PM »

I dunno, I might want my threading a bit more explicit than that - a static function rather than a member might make it easier to see where the split was between thread-local and shared stuff?

W
Logged
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3328 on: April 20, 2013, 01:18:01 PM »

My brain is bleeding. Apoplectic

but... but... it is as good as C++ threading can get Epileptic

Code:
[] () -> int { return 1; }

Oh god this isn't even C++ anymore!

.. That language is evolving so much right now.

@EDIT
I've actually just looked on lambda explanation for C++11. Quite charming. Might come in handy. One day.
« Last Edit: April 20, 2013, 02:08:15 PM by kamac » Logged

oahda
Level 10
*****



View Profile
« Reply #3329 on: April 20, 2013, 02:24:53 PM »

Xcode supports this stuff just fine, but I'm too lazy to try to fix it up in Linux (though I haven't touched C++ there for over a year, so if it's as easy as installing some gcc package these days, please do tell), and especially not in MinGW for compiling for Windows through Linux with the support (can't be arsed to go through the installation again now that I've got it working) and then finally it would also have to work with the C++ stuff on Android which feels even less plausible - while some C++11 stuff would be great to have, I've been doing just fine with good, old C++ for years and can keep doing so with no problem until the new standard really does become standard. I won't use C++11 features in my upcoming project.
Logged

PyVr
Guest
« Reply #3330 on: April 20, 2013, 05:43:35 PM »

My main game loop:

Code:
GRID->SetCamPos(cameraHandler::camX,cameraHandler::camY);
GRID->Process();
playerController::Process();
cameraHandler::Process();
actorEventHandler::handleProcesses();
commandEffects::loop();
// loop through actors. Update their animations.
typedef std::map<std::string,playActor*>::iterator it_type;
for(it_type iterator = GRID->actors.begin(); iterator != GRID->actors.end(); iterator++)
iterator->second->Process();

Even though it's not 100% done yet, I am glad that it is clean.
Just a suggestion if you can use C++11: auto and for each shall help you so much.
Logged
_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3331 on: April 20, 2013, 05:58:58 PM »

Oh god this isn't even C++ anymore!

.. That language is evolving so much right now.

@EDIT
I've actually just looked on lambda explanation for C++11. Quite charming. Might come in handy. One day.

The lack of anonymous functions was one of my biggest gripes with C++, it was about time they added that, even if it still feels a bit like an hack.
Do learn the C++11 stuff, it makes C++ much less clunky to use Smiley

I might one day restructure the entire event system around lambdas...
that would enable true a-la-Smalltalk transparent message passing, proxying etc, plus you can change the object's behaviour/state just by switching its lambdas sets.

Which is way cleaner than the current fugly "switch( state ) case STATE_WALK..." chains.

I still have to iron out some details though... maybe for the next "serious project".

@Will Vale, a static function has no "this" so you couldn't do that at all?
Anyway, tasks are atomic and asyncrhonous operations, there's no such thing as "thread local" for them.
They operate on main thread's memory. In this case the Sound Chunks are guaranteed to not be shared when that happens (yay refcounting), so there are no sharing problems.

PS: I just discovered that std::async was supposed to do exactly what that thing does, but it is horribly broken (lol!), and it will serialize as soon as the function calling std::async returns and the std::future is destructed unless you manually store the handle somewhere.
So yeah, my effort was not in vain, thanks C++ committee for giving us reasons to reinvent the wheel Coffee
« Last Edit: April 20, 2013, 07:28:53 PM by _Tommo_ » Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3332 on: April 21, 2013, 12:15:28 AM »

My main game loop:

Code:
GRID->SetCamPos(cameraHandler::camX,cameraHandler::camY);
GRID->Process();
playerController::Process();
cameraHandler::Process();
actorEventHandler::handleProcesses();
commandEffects::loop();
// loop through actors. Update their animations.
typedef std::map<std::string,playActor*>::iterator it_type;
for(it_type iterator = GRID->actors.begin(); iterator != GRID->actors.end(); iterator++)
iterator->second->Process();

Even though it's not 100% done yet, I am glad that it is clean.
Just a suggestion if you can use C++11: auto and for each shall help you so much.

That project's for mobiles, and NDK doesn't really support C++11. Only parts of it.

_Tommo_, oh, right. Anonymous functions  Concerned. I never really used them, but I can believe they could be useful in some cases.
Logged

RalenHlaalo
Level 0
***



View Profile WWW
« Reply #3333 on: April 22, 2013, 08:25:19 PM »

Just got an Ogg/Theora video rendered onto a cube with OpenGL Smiley It was actually surprisingly easy.




Edit: Here's a video of it

« Last Edit: April 23, 2013, 11:20:18 AM by RobJinman » Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #3334 on: April 22, 2013, 10:54:23 PM »

I'm a happy programmer today because: my sprite editor now can save and load projects! Evil

It uses the .tar format and .json for the actual spite spec, which means that there's one file per project, and it's all standard format so writing your own tools to process the output of the editor should be a cinch, e.g., Python has built in tar support. The screenshot shows the tar contents on the right for the project on the left. data.json is the actual sprite data, pivot points etc., and prefs.json is just the program specific preferences (like bg colour).

The yellow guy is actually a composite sprite, built by connecting the sub-sprites together.

Logged

rosholger
Level 1
*



View Profile
« Reply #3335 on: April 24, 2013, 12:22:03 PM »

Oh holy crap! just found java operator overloading plugin!!! the main reason i have been thinking about moving over to scala is now obsolete!  Tears of Joy
Logged
oahda
Level 10
*****



View Profile
« Reply #3336 on: April 24, 2013, 01:20:55 PM »

I have now got SFML 2.0 compiling in OS X, Linux and cross-compiling for Windows through the latter as well. The Windows executables have proved functional in Wine and by two native testers so far. I am hopeful. This will be an awesome Ludum Dare. Good night!
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #3337 on: April 24, 2013, 07:01:44 PM »

Oh holy crap! just found java operator overloading plugin!!! the main reason i have been thinking about moving over to scala is now obsolete!  Tears of Joy

uhm, I really wouldn't use that...
you end up with a strange Java that cannot be compiled with anyone not using the plugin and potentially conflicting with future Javas, and there were technical reasons to kill operator overloading:
first, operator overloading makes it easy to spam function calls, which in non-compiled languages are very costly;
second, it encourages to create tons of copies of many small objects because operators should never have side effects on their operands.
Something as simple as

Code:
Vector c = (a + b) * 2.f;

can easily translate to two function calls and two new Vectors being created.
So the Java designer just encouraged (forced?) everyone to write

Code:
Vector c = new Vector(
    (a.x + b.x) * 2.f,
    (a.y + b.y) * 2.f );

Which even if ugly can be many times faster.
In C++ and compiled languages this is a-ok to do because the compiler can easily inline stuff and put temporaries on the stack or just cancel them, so it makes something pretty much like that optimized code.

But dunno, maybe the latest JITs are able to optimize that aggressively... but I wouldn't bet.
Logged

oahda
Level 10
*****



View Profile
« Reply #3338 on: April 24, 2013, 08:46:20 PM »

I was going to say the same thing. I wouldn't dare use a "plugin" to a language unless there was official support for it.
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #3339 on: April 24, 2013, 10:30:03 PM »

I have now got SFML 2.0 compiling in OS X, Linux and cross-compiling for Windows through the latter as well. The Windows executables have proved functional in Wine and by two native testers so far. I am hopeful. This will be an awesome Ludum Dare. Good night!

I did my last LD with SFML, but never again. Last minute issues with people not having the MSVC redist or their card not supporting RenderTextures. It's flash/online for LD for me. I think we got 49th or something in the end due to some cool music we had. But good luck! (Tho I do love SFML and use it for moonman.)
Logged

Pages: 1 ... 165 166 [167] 168 169 ... 279
Print
Jump to:  

Theme orange-lt created by panic