Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411507 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 26, 2024, 02:01:27 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 212 213 [214] 215 216 ... 279
Print
Author Topic: The happy programmer room  (Read 678480 times)
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4260 on: February 22, 2016, 07:48:42 AM »

If you are trying to tweak code to figure out how something works and have to recompile often then 5 mins is a lifetime.

Why did you quote that portion of my post though? I was saying I find templated code harder to read (especially when it involves things like allocation traits etc). In regards too OOP. That's a can of worms but over-utilizing inheritance is also a good way to make code hard to read.
Logged

zilluss
Level 1
*



View Profile
« Reply #4261 on: February 22, 2016, 08:24:46 AM »

I actually just wanted to add that if one chooses to use templates for (algebraic) value types, he/she should hide the fact that the type is templated to achieve an easier to maintain codebase. Somwhere along writing the text I changed the whole thing and got off track. Sorry for that. I personally don't like templates either because they add much to the syntax noise C++ already suffers from (AND their are hard to read and maintain).

The 5 mins were an arbitrary number. My point was that if you sacrifice readabilty for compile time, that's a premature optimization. Computer time is cheap, dev time is expensive.
Logged

@zilluss | Devlog  Hand Point Right
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4262 on: February 22, 2016, 08:32:34 AM »

Ah gotcha. I agree.

Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4263 on: February 22, 2016, 09:23:11 AM »

My happy moment. I'm starting to get to that point where making an game in the unreal engine involves me spending time actually working on the game rather than reading documentation and figuring out how all their systems work.

It's a great engine but it requires a sizable investment in time to get up to speed.

Here's a little video of what I got going on with it in the last month or so



Logged

randomThrowAway
Level 0
***


View Profile
« Reply #4264 on: February 23, 2016, 09:13:29 AM »

It's probably trivial for you guys but I just cleared a huge roadblock using Threads, now my server actually waits for player's moves and resumes calculations exactly at the point I want it to. Three hours ago I only had a vague idea what Threads are all about, let's say it was an interesting ride.

Now on to break stuff and see what happens  Cheesy
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4265 on: February 23, 2016, 10:08:10 AM »

Threads are always hard Smiley

What was your issue that you solved?
Logged

randomThrowAway
Level 0
***


View Profile
« Reply #4266 on: February 23, 2016, 11:51:05 AM »

I made a local multiplayer combat prototype for my game which worked well, but then I started re building it with a server / client architecture. Well, I've never done any network programming so it wasn't immediately obvious to me that the server really didn't want to wait for the players to send their input before doing it's own moves / calculations: I was able to get the server to wait, but then it would stop accepting messages.

In the end I now have the fight run on its own (server-) thread, wait when it's the player's turn, then the player send their move to the server which notifies that fighting thread to resume. It wasn't clear to me that the server thread could still access and manipulate the fight object even though there was a waiting thread in it, so I was mentally going in circles for quite some time, I guess I read waiting as "frozen" internally or something.
Logged
randomThrowAway
Level 0
***


View Profile
« Reply #4267 on: February 28, 2016, 02:32:56 AM »

Speaking of which, yesterday I had the worst day in my short programmer life bringing it to true multiplayer; I spent over 15 hours trying to fix a bug in my, can you call it inter-thread-messaging setup? It drove me crazy, I just knew it should work from a logic POV but on the other hand I didn't fully trust myself since I'm new to this. I teared the whole thing down thrice, once I re build it even without threading, which struck me as kinda genius (aka desperate) at that time, but alas it didn't change a thing. I printed every step, every variable with annotations, I knew exactly where the error started (not happened, that was easy) after a couple of hours but couldn't make sense of it: An object that was instantiated by multiple threads seemingly always changed one (but only one) of its arrays to be the same as the first object's that was instantiated during the server's up-time.

Long story short I fixed it within 5 minutes of getting up this morning. It was a typo, when checking the array of instantiated objects so I can pass them to the correct thread / connection, I didn't update the sendObject() with the correct objects[bla] but with a placeholder I made, to be removed later. The object's other fields were "wrong" too, which could have been a hint, but since I'm just setting it up, they were wrong in as not having the values passed into it the right way - but the values themselves were nonetheless "correct" as in looked the same as if they were.

Oh well, now I'll try to remember how I build it thread-less because the error would have prevented it from working in the first place, so maybe it will work now and something good came out of it.
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4268 on: February 28, 2016, 06:38:00 AM »

Ah the solving it in 5 mins after you wakeup situation Smiley

congrats on solving your issue
Logged

powly
Level 4
****



View Profile WWW
« Reply #4269 on: March 15, 2016, 10:05:30 AM »

I think my matrix class is (almost) all cool now, after relearning me some curiously recurring templates and some new initializer list stuff.

Edit: Got even the small details sorted out now. Hopefully this is the last time I delve into the subject, it's been a few times already but I haven't really been happy with the previous solutions.
« Last Edit: March 16, 2016, 10:37:44 AM by powly » Logged
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #4270 on: March 16, 2016, 12:05:30 PM »

I needed to calculate smooth vertex normals for an arbitrary trimesh. The seemingly obvious approach would be to calculate face normals first with cross product (easy), then average the normals of all faces that share each vertex. I quickly found that this produces incorrect results in all but the best cases, though; smaller triangles contributed just as much to the average as larger ones, so vertex normals leaned toward the higher-resolution side if the triangles around them were at all uneven.

I tried a lot of different approaches, read a bunch of stack overflow posts, thought about it for a while, and couldn't quite come up with the right answer on my own. Eventually, I had the idea to look at an open source 3D modeling program's implementation and base my code on it. After navigating through the Blender source code and deciphering it a bit, my computed normals are now perfect!

Logged

powly
Level 4
****



View Profile WWW
« Reply #4271 on: March 16, 2016, 03:04:30 PM »

I thought it was the standard approach to not average adjacent triangle normals but directly sum the cross products and normalize in a separate pass -- exactly to overcome the triangle tessellation dependency. What's the Blender solution?
Logged
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #4272 on: March 16, 2016, 04:42:14 PM »

It's similar, but the difference is that the normal sum is weighted by the angular spread of each triangle. The formula is to normalize the two edge vectors that contribute to the vertex on that triangle, take their dot product, then multiply the contributing triangle normal by the acos of that value. It was one of the ideas I had to make this work, but I couldn't quite figure out the exact math on my own.
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #4273 on: March 17, 2016, 05:25:07 PM »

thank god I have seen those posts, and thank you!! Who, Me?
Logged

adrimoreno
Level 0
*



View Profile WWW
« Reply #4274 on: March 31, 2016, 02:30:13 AM »

Apply basic high school maths and physics in methods like this one makes me feel happy  Smiley

Logged


@adriwicked - Programmer & Game Designer at @TeamGotham_
shellbot
Guest
« Reply #4275 on: April 04, 2016, 06:30:35 PM »

Particles work perfectly in my engine without having to screw around with one million things...
Looks like I might open source this after all Grin
Logged
Bricabrac
Level 2
**


Fail again. Fail better.


View Profile
« Reply #4276 on: April 12, 2016, 01:39:02 AM »

I'm happy because I tried using Stencyl yesterday, and ... It's much easier than I tought!
Every command just make sense. I never did any real coding before, but I think years of Rpgmaker helped me learn programming logic.
I'll try to make a simple Tetris clone, to better understand collisions and such.
Logged

Selling Sunlight - Wandering Merchant RPG
bittwyst
Level 1
*


Twitter: @bittwyst


View Profile WWW
« Reply #4277 on: May 05, 2016, 05:09:50 AM »

I implemented an unlimited undo/rewind feature for my sokoban variant. And it actually seems to work like it's supposed to.
Logged

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #4278 on: May 05, 2016, 09:35:42 AM »

I implemented an unlimited undo/rewind feature for my sokoban variant. And it actually seems to work like it's supposed to.

What was your approach? I know of a few different ways to implement this, with various pros and cons. One game I play does it by repeating the player's sequence of moves (minus one) from the beginning of the room on each undo, which ensures nothing can desync, but it can get a bit slow at times when each turn takes a while to process and/or there are a lot of them.
Logged

bittwyst
Level 1
*


Twitter: @bittwyst


View Profile WWW
« Reply #4279 on: May 05, 2016, 11:37:08 AM »

I implemented an unlimited undo/rewind feature for my sokoban variant. And it actually seems to work like it's supposed to.

What was your approach? I know of a few different ways to implement this, with various pros and cons. One game I play does it by repeating the player's sequence of moves (minus one) from the beginning of the room on each undo, which ensures nothing can desync, but it can get a bit slow at times when each turn takes a while to process and/or there are a lot of them.
I defined a LevelState class, which stores the states of the player and other pieces, and copies of the map arrays. Then after every move I add the LevelState to an UndoList. Luckily my game is simple enough that just putting each thing back in the right place is enough to accurately recreate the state.
Logged

Pages: 1 ... 212 213 [214] 215 216 ... 279
Print
Jump to:  

Theme orange-lt created by panic