Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

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

March 28, 2024, 11:05:35 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 147 148 [149] 150 151 ... 279
Print
Author Topic: The happy programmer room  (Read 672954 times)
Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #2960 on: November 08, 2012, 05:36:05 AM »

My personal moment of astonishment: Parallel programming has gotten so much easier with C++11. After approx. 20 minutes of reading I got the world loading in parallel while server and clients can continue chatting. It's a fricking one-liner.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
zalzane
Level 5
*****


View Profile
« Reply #2961 on: November 08, 2012, 04:52:42 PM »

what, did they finally add async to c++ or something?
Logged
George Michaels
Level 0
***


I like big butts and I can not lie


View Profile
« Reply #2962 on: November 08, 2012, 05:20:56 PM »

what, did they finally add async to c++ or something?
They added a general thread api across all compilers
Logged

Yeah, that.
Muz
Level 10
*****


View Profile
« Reply #2963 on: November 08, 2012, 08:32:10 PM »

Sweet, my app loaded 81 images from the internet onto the same page. I can flip through it with two fingers without any lag at all on an old Galaxy S+. Tested it with 8x8 px images and it can stretch it out to full screen, and still runs with the same speed with all that image processing. I love how it's actually easier than flipping through a real paper gallery.

Pretty much the most technically awesome thing I've personally worked with, though much of the memory/disk optimization was built into Android and third party libraries. Take that, iOS Tongue
Logged
B_ill
Level 0
***


View Profile WWW
« Reply #2964 on: November 08, 2012, 09:09:02 PM »

My artist completely redid the menu graphics...but he managed to keep all the buttons in the same exact place and same exact size even though everything looks completely different now so it was simply a matter of dragging and dropping the new assets in and not having to reposition or reengineer anything. Hurray!
Logged

Game Programmer and Designer
Latest Release: Chemical Cubes for Android and Kindle Fire (iOS coming soon)
a0x
Level 0
**



View Profile WWW
« Reply #2965 on: November 08, 2012, 11:58:18 PM »

Just got finished with making my own Vector and Matrix classes, and I think I'm finally getting the hang of the math behind it. It really makes things so much more intuitive (once you get it).

Now I just gotta tackle 3D orientation and quaternions Undecided
Logged
impulse9
Guest
« Reply #2966 on: November 10, 2012, 01:51:50 PM »

Just implemented the scrolling speech bubble thing:

Logged
Dr. Cooldude
Guest
« Reply #2967 on: November 10, 2012, 02:03:14 PM »

Just implemented the scrolling speech bubble thing:


Nice! Mind telling how you did this? I'm currently working with some dialogue stuff myself, so I'm kind of curious Smiley
Logged
kacper_weiland
Level 0
**



View Profile
« Reply #2968 on: November 10, 2012, 02:17:42 PM »

I'm working on my prototype and I'm sooooo fucking happy. I love you guys. :*
Logged
impulse9
Guest
« Reply #2969 on: November 10, 2012, 02:40:22 PM »

Nice! Mind telling how you did this? I'm currently working with some dialogue stuff myself, so I'm kind of curious Smiley

Thanks! Smiley It's not perfected, still. I used a couple of sequenced variables, together with some constants. Every bubble has a TTL (time to live), computed as:
Code:
ttl = line_count * (KEEPALIVE + 18) + INTROTIME + FADETIME;

Where line_count * (KEEPALIVE + 18) represents the time (more precisely, number of logic cycles) required to scroll the text (18 represents line spacing), INTROTIME is time required to begin scrolling and FADETIME is time required for the bubble to wait until it is faded away.

So basically, the bubble gets created (it does some simple word wrapping and calculates a few variables in the process), does its thing, and gets destroyed once ttl is equal to 0.

This is the bubble logic function, it moves the offset sequentially:

Code:
void OxScene :: SpeechBubble :: DoLogic()
{
ttl--;

if (ttl >= FADETIME)
{
if (seqintro > 0)
seqintro--;
else
{
seq++;

if (seq > KEEPALIVE + 18)
seq = 0;
else if (seq > KEEPALIVE && offset < max_offset)
offset++;
}

}
}

This is the rendering function. It uses my engine's API to draw stuff but the code should be self-explanatory. I have two surfaces, bubbleSurface (containing pre-rendered bubble graphics) and textSurface (containing pre-rendered text).

Code:
void OxScene :: SpeechBubble :: DoDrawing(OxSurface* canvas, int x, int y)
{
OxSurface* buffer = new OxSurface(WIDTH, h);
buffer->ClearToMask();

buffer->render->Surface(bubbleSurface, 0, 0);

OxSurface* textDisplay = new OxSurface(WIDTH-20, h-26);
textDisplay->ClearToMask();
textDisplay->render->Surface(textSurface, 0, -offset);
buffer->render->Surface(textDisplay, 10, 10);

delete textDisplay;

if (ttl > 127)
canvas->render->Surface(buffer, x, y);
else
canvas->render->BlendSurface(buffer, x, y, 128, 128, 128, (unsigned char)(ttl*2));

delete buffer;
}

The way I ensure that the same bubble is not re-created is a bit naive. I check if there already is a bubble that uses the same x and y as origin. It's a bit dumb but since my NPC's won't be able to walk around, it sort of makes sense. And it is a lot easier to code than using some ID system.

This is the code that adds a new bubble. I have an "array of bubbles" to keep track of them.

Code:
void OxScene :: AddSpeechBubble(OxPrimitive* primitive, std::string text)
{
if (!text.size())
return;

for (SpeechBubbleArray::iterator it = bubbles->begin(); it != bubbles->end(); ++it)
{
if ((*it)->originalX == primitive->x && (*it)->originalY == primitive->y)
{
// bubble already exists, refresh it
(*it)->Regenerate();
return;
}
}

// add a new bubble
bubbles->push_back(new SpeechBubble(primitive, text));
}

And here is the "outer" logic, taking care of proper disposal:

Code:
for (SpeechBubbleArray::iterator it = bubbles->begin(); it != bubbles->end(); )
{
(*it)->DoLogic();
if (!(*it)->ttl) // destroy the bubble
{
delete *it;
it = bubbles->erase(it);
}
else // increment the iterator
++it;
}

(They are also destroyed in the Scene destructor, in case any of them are left on quit.)
« Last Edit: November 11, 2012, 07:41:17 AM by impulse9 » Logged
Graham-
Level 10
*****


ftw


View Profile
« Reply #2970 on: November 11, 2012, 02:56:04 AM »

I think I understand Git now.

Great success  Coffee

No one understands Git.
Logged
rivon
Level 10
*****



View Profile
« Reply #2971 on: November 11, 2012, 03:54:47 AM »

Linus does Smiley
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #2972 on: November 11, 2012, 04:27:13 AM »

GOt text rendering on my vita engine working. luckily I was able to re-use a portion of the sony game engine 2D code with some modifications.
Logged

Quarry
Level 10
*****


View Profile
« Reply #2973 on: November 11, 2012, 05:19:48 AM »

Does vita use OGL?
Logged
Graham-
Level 10
*****


ftw


View Profile
« Reply #2974 on: November 11, 2012, 05:20:23 AM »

Linus does Smiley

Whoa, whoa. Fucking Linus. He understands everything.
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #2975 on: November 11, 2012, 05:43:02 AM »

Reimplemented all the collision detection/resolution stuff that was quick hacky special cases (if circle with ball, some code, and so on) as special cases of SAT that're fed into a general SAT solver netting resolution vector. Took an hour before bed because everything is nicely separated. More stable than original implementation and 100x easier to add shapes to. Fuck yes.
Logged

Quarry
Level 10
*****


View Profile
« Reply #2976 on: November 11, 2012, 05:46:28 AM »

What about speed?
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #2977 on: November 11, 2012, 05:56:26 AM »

http://grab.by/hriW without debug overlay
http://grab.by/hrj0 with debug overlay (note the fps shitting itself) (yes I know the box is pushed slightly into the tilemap, the velocities aren't set back yet, so its heading towards mach 3)

 Shrug

Good enough for me wrt Java. I'm putting a framework together of all the functionality I need for making a game, and Java/Scala is what I've found is quickest to write it in. It'll get ported to C++ later down the line when KAG's done and we have some time to build the framework we'll be using for the next half decade at least (considering crimson (the engine KAG's built on) is ~5 years old now and is high on bloat and low on features, we're planning on turning that around).
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #2978 on: November 11, 2012, 06:06:21 AM »

Does vita use OGL?


to a degree. Let's call it VitaGL.

it;s mostly the same but they have their own implementation of things like vertex buffers.
Logged

impulse9
Guest
« Reply #2979 on: November 11, 2012, 07:15:56 AM »

I'm not sure if it's annoying to read text like this or not.  Shrug



Also the gif kind of screws up the timing a bit.
Logged
Pages: 1 ... 147 148 [149] 150 151 ... 279
Print
Jump to:  

Theme orange-lt created by panic