InfiniteStateMachine
|
|
« Reply #800 on: November 12, 2012, 08:56:05 PM » |
|
calibrating a robotic camera and getting it ready for face tracking
|
|
|
Logged
|
|
|
|
fractilegames
|
|
« Reply #801 on: November 13, 2012, 10:27:44 AM » |
|
Setting up a menu page in my game for browsing levels created and shared by other players.
|
|
|
Logged
|
|
|
|
JMickle
|
|
« Reply #802 on: January 22, 2013, 02:15:38 PM » |
|
resurrecting this thread because it should live. i'm programming some AI and I was wondering if this function: private function los():Boolean { var output:Boolean; if (!onCamera) return false; if (FP.world.collideLine("solid", x, y, Assets.PLAYER.x, Assets.PLAYER.y)) { return false; } if (FP.world.collideLine("door", x, y, Assets.PLAYER.x, Assets.PLAYER.y)) { return false; } return true; } (in as3) would definitely skip out if it fails the onCamera line because I don't want it going through the rest if it fails that first call.
|
|
|
Logged
|
|
|
|
EdgeOfProphecy
|
|
« Reply #803 on: January 22, 2013, 02:40:14 PM » |
|
An Android ListView whose cells contain ImageViews whose images are asynchronously downloaded.
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #804 on: January 22, 2013, 02:45:51 PM » |
|
resurrecting this thread because it should live. i'm programming some AI and I was wondering if this function: private function los():Boolean { var output:Boolean; if (!onCamera) return false; if (FP.world.collideLine("solid", x, y, Assets.PLAYER.x, Assets.PLAYER.y)) { return false; } if (FP.world.collideLine("door", x, y, Assets.PLAYER.x, Assets.PLAYER.y)) { return false; } return true; } (in as3) would definitely skip out if it fails the onCamera line because I don't want it going through the rest if it fails that first call. well trace it and you'll know. But I would think it does ...
|
|
|
Logged
|
|
|
|
roc
|
|
« Reply #805 on: January 23, 2013, 11:07:44 AM » |
|
I am punishing myself for spending too much time tweaking the lookahead on some tile map streaming code by starting on a GUI with libgdx's scene2dui stuff. Turns out to be a pretty crappy punishment because, like the rest of libgdx, I'm finding it okay to work with! resurrecting this thread because it should live. i'm programming some AI and I was wondering if this function: private function los():Boolean { var output:Boolean; if (!onCamera) return false; if (FP.world.collideLine("solid", x, y, Assets.PLAYER.x, Assets.PLAYER.y)) { return false; } if (FP.world.collideLine("door", x, y, Assets.PLAYER.x, Assets.PLAYER.y)) { return false; } return true; } (in as3) would definitely skip out if it fails the onCamera line because I don't want it going through the rest if it fails that first call. Yeah you're good. Dunno if this is a place for tips but if you're interested: private function los():Boolean { return onCamera && !FP.world.collideLine("solid", x, y, Assets.PLAYER.x, Assets.PLAYER.y) && !FP.world.collideLine("door", x, y, Assets.PLAYER.x, Assets.PLAYER.y); } Will bail out on the first expression that evaluates to false (AS3 has short-circuiting). It also doesn't add any extra code branches, but that's more of a readability concern here and tbh your method is plenty readable as is. Android ListView ImageViews asynchronous
condolences
|
|
|
Logged
|
|
|
|
Crimsontide
|
|
« Reply #806 on: January 23, 2013, 11:10:45 AM » |
|
calibrating a robotic camera and getting it ready for face tracking
Interesting, whats the end goal/application?
|
|
|
Logged
|
|
|
|
EdgeOfProphecy
|
|
« Reply #807 on: January 23, 2013, 11:18:25 AM » |
|
Android ListView ImageViews asynchronous
condolences Hahaha, thanks. I managed to get it working last night, so I'm pretty pleased. The threading security that Android does (UI thread vs. worker threads) makes me tear my hair out, though. Haven't gotten used to it yet.
|
|
|
Logged
|
|
|
|
solkar
|
|
« Reply #808 on: January 24, 2013, 12:04:16 PM » |
|
Split a picture into several tiles and use it as background for the cards. You can see the process.
|
|
|
Logged
|
|
|
|
Code_Assassin
|
|
« Reply #809 on: January 24, 2013, 05:04:07 PM » |
|
Quick application in WPF for me keeping up with my reading schedule.
|
|
|
Logged
|
|
|
|
EdgeOfProphecy
|
|
« Reply #810 on: January 24, 2013, 05:06:12 PM » |
|
General memory management strategy for the loading and unloading of bitmaps. Because there was none. And now we're out of memory.
Who would have thought!?
|
|
|
Logged
|
|
|
|
RalenHlaalo
|
|
« Reply #811 on: January 26, 2013, 05:20:59 AM » |
|
What do y'all think of my #1GAM project? http://robjinman.com/article.jsp?id=41I just need to implement a 'best times' feature on the difficulty selection screen, and then port the game to Windows.
|
|
« Last Edit: January 26, 2013, 04:49:51 PM by RobJinman »
|
Logged
|
|
|
|
impulse9
Guest
|
|
« Reply #812 on: January 26, 2013, 08:48:14 AM » |
|
A polymorphic state machine thingy. bool Engine :: Process() { State* nextState = NULL;
bool quit = state->Process(&nextState);
if (nextState) { delete state; state = nextState; state->e = this; }
return quit; }
|
|
|
Logged
|
|
|
|
|
Oskuro
|
|
« Reply #814 on: February 13, 2013, 11:38:01 AM » |
|
Freaking document encryption/decryption over SSL sockets. Oh, you meant game related? Suffering from massive programming burnout right now
|
|
|
Logged
|
|
|
|
Martin 2BAM
|
|
« Reply #815 on: February 13, 2013, 11:43:24 AM » |
|
"Abstract" Graph data structures in AS3. Trying to figure out a way to make them extensible (Graph, nodes and arcs), keep auto-completion and avoid having to cast everything all the time. I miss C++ templates
|
|
|
Logged
|
|
|
|
kamac
|
|
« Reply #816 on: February 13, 2013, 11:51:21 AM » |
|
Processes adding. For event editor which is built-in to mission editor which is built-in to the game itself. It's tough.
|
|
|
Logged
|
|
|
|
impulse9
Guest
|
|
« Reply #817 on: February 13, 2013, 12:15:12 PM » |
|
Animation randomization at the startup of the scene. The code looks silly but it works. // randomize animation starting points // this breaks the monotony when similar animations are displayed next to eachother
int prevAnimAt = -1; // don't change this int fs = 0; // or this
for (OxLevel::LevelObjectArray::iterator it = objects->begin(); it != objects->end(); ++it) { OxObject::Object* obj = it->second; OxMetadata::MetaObject* metaObj = obj->GetMeta();
if (metaObj->GetType() == OxMetadata::MetaObject::OBJECT_ANIMATION) { OxObject::Animation* objAnim = (OxObject::Animation*)obj;
// Exploit locality - ID's that are next to each other have a high chance of // being next to each other in the world as well (because of the nature of the // editing). Don't allow this iteration to have the same animAt value as the previous // one. Sometimes animations have shorter sequences so this loop could in theory // run forever (but only if some animation only contains a single frame). // A failsafe is implemented anyway, just to ensure this doesn't actually happen.
int newAnimAt = OxEngine::GetRandomInt(metaObj->GetAnimations()->GetSize(0)-1);
// check if previous hit matches current
if (prevAnimAt != newAnimAt || fs > 5) // failsafe: if we didn't get it in 5 hits, we probably won't get it { // all is well objAnim->animAt = newAnimAt;
// remember this value for next iteration prevAnimAt = newAnimAt;
// set failsafe flag to 0 fs = 0; } else { // oops - we got the same value twice! // roll the loop back until we get a more satisfying result --it;
fs++; // increment the failsafe flag } } }
|
|
|
Logged
|
|
|
|
ThemsAllTook
|
|
« Reply #818 on: February 13, 2013, 01:05:41 PM » |
|
Surely you can do better than the fs counter. How about this? int newAnimAt = OxEngine::GetRandomInt(metaObj->GetAnimations()->GetSize(0)-2); // Note -2 instead of -1 if (newAnimAt >= prevAnimAt) { newAnimAt++; }
That way you're guaranteed to get a random value that's different from the previous one. You'll probably want to initialize prevAnimAt to something other than -1 though. The only way this breaks down is if you only have one animation, which can easily be special cased.
|
|
|
Logged
|
|
|
|
impulse9
Guest
|
|
« Reply #819 on: February 13, 2013, 01:16:55 PM » |
|
Well, basically, this call returns the size of the animation array - how many frames the animation has (an object can have multiple animations, hence the 0 for the first animation - which is all the animation object has): metaObj->GetAnimations()->GetSize(0) So in case the size is 1, it will try to find a random value between 0 and -1. My random generator code doesn't handle this well and returns (unsigned int)(-n) which is obviously not very good. But of course I can just add a special case for sizes of 1. Thanks for the idea, it is pretty neat. Edit: Well I rewrote it like this: int prevAnimAt = 9999;
for (OxLevel::LevelObjectArray::iterator it = objects->begin(); it != objects->end(); ++it) { OxObject::Object* obj = it->second; OxMetadata::MetaObject* metaObj = obj->GetMeta();
if (metaObj->GetType() == OxMetadata::MetaObject::OBJECT_ANIMATION) { OxObject::Animation* objAnim = (OxObject::Animation*)obj;
const unsigned int animsCount = metaObj->GetAnimations()->GetSize(0);
int newAnimAt = 0;
if (animsCount > 1) { newAnimAt = OxEngine::GetRandomInt(animsCount-2);
if (newAnimAt >= prevAnimAt) newAnimAt++; }
prevAnimAt = newAnimAt;
objAnim->animAt = newAnimAt; } }
It seems to be working nicely. Animations can have different number of frames but in that case they are desynchronised already anyway and the algorithm handles this properly. This approach is probably a bit less random than mine though. Maybe not. Who knows. I've done some brain-storming and I must say this is actually pretty clever. Thanks again.
|
|
« Last Edit: February 14, 2013, 03:36:57 AM by impulse9 »
|
Logged
|
|
|
|
|