Lurker > Sahuagin

LurkerFAQs, Active DB, Database 1 ( 03.09.2017-09.16.2017 ), DB2, DB3, DB4, DB5, DB6, DB7, DB8, DB9, DB10, DB11, DB12, Clear
Board List
Page List: 1 ... 8, 9, 10, 11, 12
TopicChallenge: Cook a hamburger without using ANY metal
Sahuagin
04/06/17 9:33:15 PM
#23
if it was a life and death situation I could borrow my family's ceramic stove and just cook it right on the burner
---
TopicTrump signs bill to allow Hunters to KILL SLEEPING BEARS and BABY WOLVES!!!
Sahuagin
04/06/17 9:30:46 PM
#3
they can hunt bears into extinction for all I care
---
TopicI'll forever be salty that SubWay doesn't have a drive-thru.
Sahuagin
04/06/17 9:29:46 PM
#38
man would I love a subway with a drive-thru...

I don't get how anyone could call it low quality though... I mean it's fresh bread with fresh lettuce, tomato, pickles, olives, onions, green peppers, spinach, etc. on it. not like it can be different?

although I do recall trying Mr Sub one time, and yeah, *that* was pretty low quality. but IIRC it was a seafood sandwich (almost the only kind I get) and their mix was really crappy salty shredded crab or something. Subway has fantastic imitation crab meat in white sauce.
---
TopicAny intermediate programmers here?
Sahuagin
04/06/17 8:42:49 PM
#31
jamieyello3 posted...
I added

spriteBatch.End();
spriteBatch.Draw(...);
spriteBatch.Begin();


well... that's obviously going to fail the way that's written. begin has to be called before draw is called. it would need to be "end begin draw end begin" to inject it into the middle of an already running spritebatch, but that wasn't really meant as a solution, just as an indication of the problem.

there's a lot of different ways to organize the draw calls and textures, and I'm not sure I even know what the "best" way would be. either you have to wrap more of your draw calls in shorter-term begins and ends, or you have to use more surfaces.
---
TopicHelp me understand your reasoning in solving the following easy problem
Sahuagin
04/05/17 9:37:57 PM
#65
the number of possibilities of having two children (or flipping two coins) is 4.

the question is really: how many possiblities does the phrase "at least one of them is a girl" exclude?

"at least one of them is a girl" translates into "they are not both boys"

"they are not both boys" excludes exactly 1 of the 4 possibilities

the chance is 1/3

people that say 1/2 are mistaking "at least one of them is a girl" to be as much information as knowing "the first child is a girl" (or "the second child is a girl"; the ambiguity is an indication of the lack of information)
---
TopicAny intermediate programmers here?
Sahuagin
04/05/17 2:46:39 AM
#28
Magus 10 posted...
So he's telling spriteBatch to render the same texture in several different places. By the time End is called, it iterates through each place it was told to Draw and draws the texture (which at this point is not changing) at each one.

yeah you got it. I only got it because you identified the method and rendertarget thing first.

thanks for the fun times, I'm the only programmer I know IRL so it's nice to have threads like this every now and then
---
TopicAny intermediate programmers here?
Sahuagin
04/05/17 2:25:47 AM
#25
ok, I went through it a bit more even though I should be sleeping.

you're kind of right.

what it is is that spritebatch queues up its draws. he calls LocalSpriteBatch.End();, which processes all those calls to the render target, but he then draws the rendertarget with the other spritebatch and keeps that one running. he queues up all the rendertarget draws that way, but he destroys the rendertarget each time before the spritebatch ends. when he finally calls end on the outer spritebatch, it runs through its queue and draws only the rendertarget in its final state in each case.

this needs to be fixed by calling end and begin on the spritebatch more often. (it would also be fixed by, like you said, using separate render targets). for example, if you do this at the bottom of that draw method:

spriteBatch.End();
spriteBatch.Begin();
spriteBatch.Draw(renderTarget, position, sourceRectangle, Color.White, rotation, origin, scale, effects, layerDepth);
spriteBatch.End();
spriteBatch.Begin();


it fixes the problem (because the spritebatch now draws the render target immediately), although some of the other graphics get lost (mostly the central area).

it's good to keep in mind that calling SpriteBatch.Draw does not actually draw anything, but rather *enqueues* a draw operation. it's calling *End* that actually does the drawing and if too much stuff has changed in the mean time, stuff like this happens.

gonna go to bed now...
---
TopicAny intermediate programmers here?
Sahuagin
04/05/17 1:56:00 AM
#24
I think you may just be blocking the issue from being visible by doing that (whoa does that ever eat memory fast).

He seems to be drawing all images to all frames, instead of each image to its own frame. (if you add two different images, they both appear on both frames). but I can't tell exactly where or what it is causing it because the code is so messy and I'm too tired. if it manages to remain unsolved till the weekend I will probably tackle it on saturday.
---
TopicAny intermediate programmers here?
Sahuagin
04/05/17 1:19:50 AM
#22
Magus 10 posted...
That sounds fun.

rule of thumb is to always make structs immutable. (basically in C# a struct is a "user primitive", so should be thought of as immutable values anyway; you don't change properties of an integer for example. (immutability is just a good thing in general as well.))

for some reason they didn't follow their own advice with Vector2 (maybe for performance reasons...?). OP would probably have encountered this problem, but he's using public fields which avoids it since he's accessing the field directly. (though I haven't been completely through his code yet so it may be lurking there somewhere)

it gets annoying though, because to properly change X as above you have to do

someObject.SomeProperty = new Vector2(5, someObject.SomeProperty.Y);


which is a pain. solution I usually use is to write a few extension methods and then it's not so bad:

public static Vector2 SetX(this Vector2 pVector2, float pX) {
return new Vector2(pX, pVector2.Y);
}

and then you can at least write:

someObject.SomeProperty = someObject.SomeProperty.SetX(5);

---
TopicAny intermediate programmers here?
Sahuagin
04/05/17 12:50:18 AM
#20
np

one of the trickier problems you get from structs having value semantics is what happens if you allow them to be mutable, and then expose one as a property. ex:


class SomeClass {
...
public Vector2 SomeProperty { get; set; }
...
}

...
var someObject = new SomeClass();
someObject.SomeProperty.X = 5; // oops?


since SomeProperty returns a copy of the value and not an object, assigning a value to the property of the copied value does nothing.
---
TopicAny intermediate programmers here?
Sahuagin
04/05/17 12:33:24 AM
#18
Magus 10 posted...
You'd want to do something like C.Position = new Vector2(C.X, C.Y);, and the same thing with Origin.

Vector2 is a struct not a class, it has value semantics (note that struct in C# does not mean what it means in C/C++)
---
TopicAgree/Disagree: Nothing deserves a 10/10.
Sahuagin
04/04/17 9:09:20 PM
#4
you don't need perfection, you just need to round up

if you allow the rating to be a real number or something, so that you have infinite available precision, then maybe you wouldn't ever get a perfect 10, but as long as it's just integers, you for sure can have 10/10. it's just the uppermost category, not "perfection".
---
TopicShare your favorite Steam game with PotD!
Sahuagin
04/03/17 11:43:06 PM
#6
shadowsword87 posted...
Euro Truck Simulator 2

"Overwhelmingly Positive - 97% of the 64,420 user reviews for this game are positive."

holy geez, I always though it'd be fun to try one of those
---
TopicAny intermediate programmers here?
Sahuagin
04/03/17 11:33:18 PM
#11
In AddFrame method of AnimationSetFull2D class you have these lines:

//Update animation data
AnimationSetClass tempAnimation = new AnimationSetClass(NumberOfLimbs, NumberOfFrames);
tempAnimation = (AnimationSetClass)Animation.Clone(0, 1);

Animation = (AnimationSetClass)tempAnimation.Clone();


you create a new AnimationSetClass, but then throw it away, copying the one in Animation, and then clone that one again back into Animation. This may (or may not) be related to your problem. This is roughly equivalent to something like:

Animation = Animation.Clone(0, 1);
or
Animation = Animation.Clone(0, 1).Clone();

The AddLimb method has a similar sequence.
---
TopicAny intermediate programmers here?
Sahuagin
04/03/17 11:26:14 PM
#10
you have a lot of Microsoft.Xna.Framework.Input.Keys, possibly because it's otherwise ambiguous. you can use a line like this to disambiguate:

using Keys = Microsoft.Xna.Framework.Input.Keys;

or if you need to use both the windows and XNA ones:


using WinKeys = System.Windows.Forms.Keys;
using XNAKeys = Microsoft.Xna.Framework.Input.Keys;

---
TopicAny intermediate programmers here?
Sahuagin
04/03/17 11:19:36 PM
#9
jamieyello3 posted...
I think the one thing that doesn't apply here though, I only want to make the end user have to use a single CS file that contains everything they need. That's why I have more than one class in the single file.

what you would do is make a class library project and then you can reference it later from any program you make
---
TopicAny intermediate programmers here?
Sahuagin
04/03/17 10:58:03 PM
#5
some random advice:

try to use same line braces instead of K&R. saves vertical space allowing you to read more code more easily.

for hooking up an event, note that this:


gameForm.DragEnter += new DragEventHandler(fmr_DragEnter);

...

private void frm_DragEnter(object sender, DragEventArgs e) {
// code
}


can be reduced to:

gameForm.DragEnter += (s, e) => {
// code
};


try to force yourself to have one class per file

seal a class if you have no reason to inherit from it

don't use public fields, use auto properties or properties with a private field and try to make the members readonly if possible

especially don't have public array fields. use a private list and then put add and remove methods on your class.

sorry if this just sounds like nagging or just makes things feel even more complex than they already do.

another one is, try not to write:

if (condition) {
// huge block of code
}


write:

if (!condition)
return;

// rest of code

---
TopicAny intermediate programmers here?
Sahuagin
04/03/17 10:42:19 PM
#4
havin a look...

I don't see an obvious reason why your clone methods wouldn't be working so far. do you have an example of why you think they aren't?
---
TopicShare your favorite Steam game with PotD!
Sahuagin
04/03/17 10:33:46 PM
#2
Current Favorite:
"The Legend of Heroes: Trails in the Sky" (weirdly named)

haven't enjoyed a JRPG so much in something like 20 years. the combat could be better, but the writing is phenomenal.

Other favorites and things worth mentioning include:

Might and Magic X (really UPlay though)

Crashlands (a bit simple, but very good)

Hotline Miami (fastest paced action game I've ever played)

EU4 and Stellaris (love/hate)

Age of Wonders games

Dark Souls 1-3 (every gamer should play these)

Endless Legend (I keep trying every 4x game I find (except Civ 6 for now since it's so god damn expensive...) but this is the one I keep coming back to)

(the other Endless games are worth playing, too, particularly Dungeon of the Endless)

Valkyria Chronicles (extremely good J strategy game; a little like first-person fire emblem. or maybe turn-based wing commander on the ground?)

BG:EE/BG2:EE/IWD:EE/etc. will always love infinity engine games

Serious Sam games, Borderlands games

Wolfenstein: The New Order and Doom 2016 (every gamer should play these)

FTL, Jets n Guns, Rimworld

Creeper World 1-3 (and possibly Particle Fleet but haven't actually played it yet)
---
TopicWhen I say "Dark Lord" who do you think of first?
Sahuagin
04/03/17 8:32:32 PM
#53
actually, now that I think of it, the main thing that the phrase "Dark Lord" reminds me of is the scene in the simpsons when they're at a heavy metal concert, and there's a half-inflated demon ballon, and they salute their "half-inflated 'dark lord'".
---
TopicGul Dukat is the best character on DS9 (spoilers)
Sahuagin
04/03/17 8:23:15 PM
#10
Love Garak and Dukat. Also Weyoun.
---
TopicWhat is your favorite of these top 10 Simpsons episode (Seasons 1-10)
Sahuagin
04/03/17 1:21:00 AM
#6
probably Homer at the Bat. the others are good, but that's gotta be the best one.
---
Topic12 Classic Games (FFVII, Donkey Kong, SF II) up for Video Game Hall of Fame...
Sahuagin
03/31/17 10:28:48 PM
#27
TopicWhen I say "Dark Lord" who do you think of first?
Sahuagin
03/31/17 10:24:04 PM
#21
TopicITT: Music!
Sahuagin
02/20/17 4:36:12 AM
#37
Lokarin posted...
doll face/illusion

that is pretty great, thanks
---
TopicWhat is your all-time favorite ARCADE CABINET game you ever played? #2
Sahuagin
01/05/17 10:08:04 PM
#88
shipwreckers posted...
Sahuagin!!! Where the hell have you been? It's been ages since I've seen you on PotD (though I may simply not have been observant enough).

you must be thinking of someone else? I'm here all the time, and I don't know anyone well enough to be worthy of that reaction...
---
TopicITT: I post 2 VGM every day
Sahuagin
01/04/17 5:07:31 AM
#8
MechaKirby posted...
Super Mario Bros. 3 (SNES) - Airship

good pick, although it's not quite the same without the thunderclaps and cannon sounds
---
TopicITT: I post 2 VGM every day
Sahuagin
01/01/17 5:11:55 PM
#2
Board List
Page List: 1 ... 8, 9, 10, 11, 12