Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - MorleyDev

Pages: 1 ... 68 69 [70] 71 72 ... 161
1036
General Discussion / Re: Things that made you sad today thread.
« on: September 06, 2014, 05:05:53 am »
Need root canal. Molar dying. Molars are annoying bastards where the best treatment option apparently isn't covered by the NHS. But removing the tooth or a sub-par treatment that doesn't maximise the odds of keeping the tooth is covered by the NHS. I'd rather not lose the tooth, since I'm somewhat attached to it. It's in my face. I like being able to chew with both sides of my mouth.

*sigh* I've had some free treatments on the NHS over the years, including a free mouth guard for teeth grinding and stuff that'd cost over £100 privately, so in terms of "First World Problems" having to pay for one of my dental treatments may count.

But still, it's annoying. I've already had problems with my teeth earlier this year when a wisdom tooth got infected, and the pain at the moment is definitely a fraction of that pain. But any infection in the same general area as the brain is something that needs treatment. Back on antibiotics to clear that part up temporarily, at least.

And then I need to decide whether to get an obvious silver crown, or a less obvious white one. Guess which one'll cost me money, and which one is on the NHS. At least if I go for the silver crown, it's a molar so not particularly visible.

1037
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: September 05, 2014, 01:49:43 am »
On the other hand, if you're in Software Development then it's not unreasonable for you to be in it because you enjoy the job. You'd be programming anyway, regardless of whether you were employed or not, and all they do by paying you is get you to focus on their problems instead (which ideally should be of interest to you).

The amount of money you make is a factor when looking at a job, but by no means the only factor. And if they stop giving you interesting problems to solve, or if the work just stops interesting you, or if you stop continuously learning and developing yourself, then it's a good time to switch jobs (Or become a manager and accept that you're exchanging programming for stability and higher pay).

Oracle from this point of view could be a great learning opportunity which would help you score even better jobs in the future, even if you're only there for a year or two.

1038
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 30, 2014, 06:08:24 am »
Nifty. I've ordered an Oculus Rift recently, so should get to play with it sometime around October. Now, if only I were a patient man :(

1039
Other Games / Re: How did you last *own*?
« on: August 25, 2014, 07:46:08 am »
Fire up TF2, start running around with a charge + half-zatoichi Demoman. Encounter a soldier, jump in the air to dodge a rocket, which proceeds to launch me straight at the Soldier. Whilst in the air, initiate the charge and then decapitate the soldier in a single swing.

Even the guy playing the Soldier had to comment on how I managed to ride his rocket. Not bad considering it happened entirely by blind luck xD

1040
General Discussion / Re: Abortion father opt-out rule
« on: August 17, 2014, 07:12:58 pm »
In the UK, and it was an agreement reached by him and my mother. Legally they just changed the child support agreement so he didn't pay, and the "gtfo" was a verbal agreement. He still had "Parental Responsibility" due to them being married when I was born, but never exercised it so practically the result was the same.

1041
General Discussion / Re: Abortion father opt-out rule
« on: August 17, 2014, 07:10:52 pm »
My father more or less did this when I was about 5, giving up visitation rights and basically any say in my life whatsoever and not paying child support. Now, bare that in mind when I say I am in favour of the right of either or both parents to disavow any responsibility to the child, but in doing so they also disavow any right to the child. Indeed, I'm fine with this as a possibility after the child is even born. Mother or father can abandon their right to the child, if both do then well, that's called putting the child up for adoption.

Best thing some people can do for their child is to gtfo of it's life.

1042
General Discussion / Re: When Kickstarter goes wrong?
« on: August 15, 2014, 05:06:46 pm »
Honestly, it's no different from the webcomic scene 10 years ago. And with about as many breakthroughs who get big for a time. And with some of those people using it to enter more 'professional' areas as a follow-up. Hmm, actually there a lot of parallels...

But I don't know of that many kids who actually aspire to be a streamer professionally. Oddly enough, it seems the LPers and the like who actually are fun and interesting tend to start off just seeing it as a hobby, something to do and if they get money and attention or to practice their editing and film making skills hey even better. Probably something to do with them not coming across as desperate attention whores as much xD

Asking for money to do it via kickstarter is just silly though. We have Patreon for that :) Wonder how many "when patreon goes wrong" we can find...

1043
So I dern terk er jerb! :) Yeah, turns out I'm actually employable. Graduate web developer position, start on Monday. So that's a thing that's happening ^^

1044
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 14, 2014, 03:07:48 pm »
Heh, I'm using up to maybe 7 under some circumstances (some of them have defaults). But that made me appreciate closures in some programming languages and functions inside functions in gcc.

Well there's a reason I call it a rule of thumb and not a rule or law :) Always exceptions, often with number crunching or rendering (Like if you have to pass in the texture, source area, position, origin and angle). Parameter objects can help simplify functions sometimes, but the parameters need a clear and obvious logical grouping otherwise you're just making things worse.

1045
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 14, 2014, 01:03:17 pm »
Parameters have a readability cost sure, I've found a good rule of thumb is that if function has more than 3 parameters it's probably doing too much.

I'm not saying pass around the class, I'm saying the constantly accessing the timer from various points in the code seems entirely superfluous in the first place, that it is simpler and easier to just pass the deltatime itself instead of a bunch of repetitious and needless code that deals with the timer. You only need to pay attention to the timer in your game loop, everything else is integration by a time step. The way it seemed the clock was being described as used was that the various subsystems (such as animations) would be using it directly, the point I've been trying to make is that seems to overly complicate those subsystems when really the game loop should be the only place that uses timings directly.

So a game loop could look like (uses c++11 and std::chrono but just mentally swap all the chrono stuff with SDL_GetTicks or your preferred timing library):
Code: [Select]
const std::chrono::microseconds updateRate(10000);
const std::chrono::microseconds drawRate(8333);

const auto startTime = std::chrono::system_clock::now();
auto nextUpdate = startTime + updateRate;
auto nextDraw = startTime;

while (game.isAlive()) {
std::this_thread::sleep_until(std::min(nextUpdate, nextDraw));

const auto currentTime = std::chrono::system_clock::now();
while (game.isAlive() && nextUpdate <= currentTime) {
        game.update(std::chrono::microseconds(updateRate));
nextUpdate += updateRate;
}

        if (nextDraw <= currentTime) {
        game.draw();
                nextDraw = currentTime + drawRate;
}
}

1046
General Discussion / Re: When Kickstarter goes wrong?
« on: August 14, 2014, 07:15:58 am »

1047
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 13, 2014, 06:16:25 am »
There's an idea I like, which is to listen to the code. If you find yourself doing something and the code resists, there's a reason for it. Sometimes it means your code design needs to evolve, sometimes it means your idea needs to evolve. So if you're doing something you don't like here, it's often a good idea to stop, step back and consider what that means.

Out of curiosity, why do they need the clock in the first place? I mean, by the looks of things the clock gets the total number of ticks the game has been running for, not the number of ticks the game needs to be updated by. The latter seems like the more relevant information for a frame update.

Look at it this way, let's call the thing that manages sprites your SpriteController. And say it has an update function that takes a dt:

Telling it spriteController.update() is completely hiding the dependency on time, whilst spriteController.update(clock) tells it this code relies on the clock but it's still not clear why or how that'll be used, and it means the update itself is more complicated. spriteController.update(deltatime) immediately reveals that this function will call update on all the sprites by a given deltatime, which is the information that the spriteController would of been pulling out of the clock in the 2nd example and thus that update is simpler.

Also, if I remember correctly the preference in games is for the rendering pass to be a read-only view of the game state, and for animations to be handled by the game logic pass (which operates with a fixed time-step).

1048
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 12, 2014, 07:50:11 pm »
Well here it's more value-injection. I mean, the updating logic rarely needs to know more than how much time has passed since the last update (so what value to integrate by). You'll be trapping the value of the last update constantly with that clock global DJ posted, whilst with a parameter it's easy to work with a fixed time-step, and to experiment with and change that time-step when it's a parameter that comes in from the top, whilst also making it clear to the developer what the consequences of that change will be since it's less likely to propogate to unexpected places.

I mean, the global can exist at the top. std::chrono::system_clock::now() is effectively a global that exists at the top, but that kind of timing isn't really a concern of the code inside the update loop and it seems that it's overly complicating things to push it down (either via a global or injected dependency). A value object (the deltatime) seems the simplest solution. Sure, you could make that global but you lose nothing by making it a parameter, whilst keeping the information a function needs function-local and so gaining clarity.

Games are definitely trickier to 'clean code'. I do think it can be done, for example often you're passing the engine instance around to get at something through the engine so may as well just pass that thing through instead. If what you want is some event queue or data store or renderer or audio interface, you don't lose anything by respecting the law of demeter and giving it that instead of the engine itself. But really a truly perfectly anything is impossible, you need some state at some point after all :)

I've had some good success using an actor approach (each update handler can be thought of as a subset of actors that always responds to a "timestep" event, each render handler can be seen as a subset that always responds to a "render" event) and even doing that in a multithreaded manner. Helps keep things self-contained and maintain a good separation of responsibilities. But that's only been with small arcade-style games. 

I do tend to just go for a global logger though, logging is definitely the kind of thing I think you can break the rules for. Maybe I'll change my mind on the future with that, but for now xD

1049
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 12, 2014, 06:06:39 pm »
It's not a testability thing inherently, I just find globals less readable so would generally advocate avoiding them. My argument against them is that they force the brain to have to stop reading the code and think about something more than what's immediately in front of the developer, namely what this magical off-screen global does. It's a context switch that slows the brain down and makes understanding the function a tiny bit more effort than it needs to be. A parameter is explicitly introduced to a function and obvious, that context switch never happens and so the code is easier to read.

It's like a sentence that See A then returns to the original but still relies on the jumped-to segment. It kinda forces my brain to go "wuh?", have to stop and think. Which wastes time and energy that could be better used. Here a global seems to be an over-engineered solution that does way more than is needed with no real benefit.

So I'd argue the global is the "overly complicated design pattern", and the parameter is the "simpler design". I mean, if the code already uses this global no point going through and refactoring everything en-masse. But if not, and it's a choice between the two, I'd argue the no-global route makes the code easier to both write and read overall.

A: jumps to another part of the page or another page

1050
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 12, 2014, 05:37:58 pm »
If that's what you need, why not just pass the delta-time into the functions directly from your update loop, instead of sneaking it in through some global or dependency? If the code's update relies on a delta-time, give it that delta-time. Tell the code to update with a given dt, don't ask what the dt is.

So yeah, the global approach kinda smells to me.

Pages: 1 ... 68 69 [70] 71 72 ... 161