Page 9 of 20 FirstFirst ... 456789101112131419 ... LastLast
Results 121 to 135 of 307

Thread: Coder's Hang-out

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    Quote Originally Posted by kohlrak
    i made an edit while you posted, just read up on it.

    As for your problem... Might help to use string...

    Download Links:
    Links are hidden from guests. Please register to be able to view these links. Then do all the cases... And for each letter, you make the morse code letter appear in the string with something like Download Links:
    Links are hidden from guests. Please register to be able to view these links. Might be an easier way to go at that, but that's how i'd take that one on. lol Now getting the string into a char array, ask PKT or someone for that. I always had trouble with that. Just take all the values and put them in a dynamically made array like below....

    Download Links:
    Links are hidden from guests. Please register to be able to view these links. Note strings dont' directly convert to char array or chars. So.... Like i said, ask for that one, but don't ask me. lol
    hmm. You see I think they want me to use a strcpy fucntion, and they don't want it done that I put 1 value for 1 value if you know what I mean, I think they want me to be able to take a value from a array and point it to another value from another value, I'll try and post it later

  2. #2
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Well, nowadays processors are pretty fast. 1 GHz ~ 1 billion operations per second.
    You are aware that the while loop is pretty freaking fast, aren't you? I mean, it's almost at machine code level, taking up two clock cycles at most.

    BTW, what IS the trick, then? Stop being so mysterious about it.

    EDIT: I checked out its implementation in g++. Definitely more complicated than a simple while. And yes, it does have that as well, several instances, at that. So it's speed truly is lower than a non-object version. But it's more robust, that's for certain.
    Download the library source from here, check in the libg++/src/ directory for Strings.h and Strings.cc
    ftp://ftp.mirrorservice.org/sites/so....8.1.3.tar.bz2
    Last edited by pkt-zer0; 26th-December-2005 at 21:53.

  3. #3
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by pkt-zer0
    Well, nowadays processors are pretty fast. 1 GHz ~ 1 billion operations per second.
    You are aware that the while loop is pretty freaking fast, aren't you? I mean, it's almost at machine code level, taking up two clock cycles at most.
    Not as fast as you think... lol 1ghz... based on my 2.5 i'd have to say that's about 1000 increments and printing them out per second.

    BTW, what IS the trick, then? Stop being so mysterious about it.
    If i knew i wouldn't ask. =p

    EDIT: I checked out its implementation in g++. Definitely more complicated than a simple while. And yes, it does have that as well, several instances, at that. So it's speed truly is lower than a non-object version. But it's more robust, that's for certain.
    Download the library source from here, check in the libg++/src/ directory for Strings.h and Strings.cc
    ftp://ftp.mirrorservice.org/sites/so....8.1.3.tar.bz2
    Is it commented at all? And is it filled with a bunch of nonsence global variablse like "_t" then have a "_T" then have "_Tc" and "_tC" and another "_TC"? X'D

  4. #4
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    Not as fast as you think... lol 1ghz... based on my 2.5 i'd have to say that's about 1000 increments and printing them out per second.
    Actually, faster. Try repeating a single operation in a loop (without printing it to screen), and timing it with GetTickCount, maybe. It IS fast, believe me. I mean, C code executes in virtually 0 seconds, unless there's something involving a peripheral (screen, harddrive). So yeah, the CPU and memory are hella fast.

    Quote Originally Posted by kohlrak
    Is it commented at all? And is it filled with a bunch of nonsence global variablse like "_t" then have a "_T" then have "_Tc" and "_tC" and another "_TC"? X'D
    Well, it's an open source project, meaning anyone could modify it, so yeah, it's pretty well commented. It is more readable (and more compact) then most code I produce, anyway.

  5. #5
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by pkt-zer0
    Actually, faster. Try repeating a single operation in a loop (without printing it to screen), and timing it with GetTickCount, maybe. It IS fast, believe me. I mean, C code executes in virtually 0 seconds, unless there's something involving a peripheral (screen, harddrive). So yeah, the CPU and memory are hella fast.
    You forget, when you're talkin' FPS and stuffs, ick... A second is like forever, especially if you're like me with ADHD. lol

    Well, it's an open source project, meaning anyone could modify it, so yeah, it's pretty well commented. It is more readable (and more compact) then most code I produce, anyway.
    The more compact, the better... well.. the less code the better. lol

    Another good one, how much does calling a function slow down a computer verses a macros? And how much more space does it take on the compy? And! Another one, how much more does it take to call from a DLL?

    As for pointies... I have a good challenge for you if you ever get bored PKT. Write a source code that when compilled and run, it'll copy itself from the ram and write it to a file and save it as ".ram". Chances are it'll crash alot... but i have a funny feeling we might get something intresting from it... Who knows what we'd learn if it succeeded?

    EDIT: Reminds me of looking at the direct X API. lol

    EDIT2: Hm... I wonder how you can really output anything to the screen if C++ has no functions of it's own... And i wonder how a hello program would look in ASM... i got a disassembler here but it only opens ".com" files. lol

    EDIT3: Holy crap... I managed to open up an exe file in this thing and... o.o Dude, it looks like somthing i once saw in visual C++ 6.0 when debugging a file one time...
    Last edited by kohlrak; 28th-December-2005 at 07:33.

  6. #6
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    You forget, when you're talkin' FPS and stuffs, ick... A second is like forever, especially if you're like me with ADHD. lol
    Yeah, but it makes a difference, computing 1000 of 10 billion operations a second. If you raise the times you execute the loop high enough, it will take more than a second. But it's interesting to see how high it goes.

    Quote Originally Posted by kohlrak
    Another good one, how much does calling a function slow down a computer verses a macros? And how much more space does it take on the compy? And! Another one, how much more does it take to call from a DLL?
    Macros are simply text replaced with other text in the code, during compile time. So it doesn't slow anything at all, only what's executed within. With functions, the return address and values go on the stack, so your only problem would be that filling, and the program crashing. Don't' worry, it's pretty large, for this purpose at least, but going into infinite recursion crashes it, recursion itself eats up pretty much of the stack, as well. With the stack being the part of the memory that's accessed with the greatest speed, that's not quite good.
    DLLs are Dynamically Linked Libraries, meaning they get linked run-time, more precisely on start. I don't think that's much slower (obviously you'll get smaller executable sizes than including the libraries in the EXE itself), but version incompatibilities could be a problem sometimes.

    Quote Originally Posted by kohlrak
    As for pointies... I have a good challenge for you if you ever get bored PKT. Write a source code that when compilled and run, it'll copy itself from the ram and write it to a file and save it as ".ram". Chances are it'll crash alot... but i have a funny feeling we might get something intresting from it... Who knows what we'd learn if it succeeded?
    I'm not sure if Windows would let me do that, kinda like it wouldn't let me access the video memory directly, still, worth a try. Anyway, the code is obviously there in the EXE file in some form. I'm not sure if it's self-extracting, or uncompressed.
    Download Links:
    Links are hidden from guests. Please register to be able to view these links. Arrgh, doesn't work. Tried copying memory from an array containing a sample string, and it wouldn't let me go much further than the end of the array. Gotta learn the Windows API sometime.

    Quote Originally Posted by kohlrak
    EDIT2: Hm... I wonder how you can really output anything to the screen if C++ has no functions of it's own...
    C was designed for portability. Since not all computers even have a screen, you don't get standard methods for output. The good thing is you could even code for whatever weird sort of terminal you'd like.

    Quote Originally Posted by kohlrak
    EDIT3: Holy crap... I managed to open up an exe file in this thing and... o.o Dude, it looks like somthing i once saw in visual C++ 6.0 when debugging a file one time...
    Yep, Assembler is nice. Even nicer if you understand what things do.
    BTW, here's some code a guy I know wrote. He's pretty into low-level coding, so yeah. Beware.

  7. #7
    Join Date
    Jan 2005
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Why would anyone want to program in assembly anymore? Any speed losses from C/C++ (if there are any...) are negligible considering the portability, readability, and reusability of higher level code.

  8. #8
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    meh, of all things, i realized Microsoft word uses both OCX and DLLs. lol

  9. #9
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    hmm, I think I'm going to have to ask a question, at the moment, my morse code program has a menu that work from number presses, (unfortunatly it cuts out of the program if you do not select a correct program) also I have 3 sets of chars arrays in place (alphabet, numeric, and morse) The morse is set in sets of 4 (with spaces if the code is less then 4 characters long) I am curious how to get it so that it selects 4 charecters of morse from one letter? I'll try not to post my code as I don't Want an answer, just a few pointers

  10. #10
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    You mean, how to identify each letter with it's corresponding morse code?
    You could write a function (if you've learnt about them, that is), that does the conversion.
    Or, and I'd say this is simpler, have the character's ASCII codes identify the correct block of the morse code array. So that the code['o'] would store the "---" string, and code['s'] would store "...", and so on.
    Then you could simply just read the next character, and you'd immediately know the position of the corresponding morse code in the array.

  11. #11
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    Ok people, show some good inverse kinematics tutorials. I've looked at this one for a while now and I partly understand how it's done. But my math skills are almost completely gone so I kinda need some help here...

    The concept shown in the link above seems pretty easy, but I can't figure out for life how to calculate the angles in the triangle and how what to do after that... -___-

    Please help me!

  12. #12
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    c� = a�+b�-2ab*cos γ
    And you also have
    a/b = sin α / sin β

    A, B, C are vertices of a triangle, a, b, c are the edges opposite them, α, β, γ are the angles at the corresponding vertex.
    I do not know much about IK, but doesn't that mean something like that you have a few fixed joints, some moveable ones, the distance of the joints are set, and then you start moving a joint, and the rest move according to preset rules (joint's angle must not exceed certain limits, and so on)

  13. #13
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    Yeah you are pretty correct. This is a pretty darn good idea of what IK is and exactly what I'm trying to achive here:
    http://www.enedahl.com/index.asp?page=shockwave_ik

    Quite awesome if you ask me. Oh and thanks for the formulas. I'm sure they will help me when I try to decipher the "tutorial" I posted in my last post.

  14. #14
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Yep, I got it. Pretty neat. But, that it's being done in Shockwave shows that it's not too complex, thankfully. If free joints weren't connected to fixed ones, however, you'd have a bit more trouble than calculating triangles on your hand.

  15. #15
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    I've found another method that I'm gonna try to get working. Because the one I posted above will only work if the leg consist of two parts. I might want to use more.

    Check this out: http://freespace.virgin.net/hugo.elias/models/m_ik.htm

    Yet again, I understand the concept but I don't remember shit when it comes to math... How do I calculate the force vector? And how do I calculate the dot product?

Similar Threads

  1. Visit The Hang Out!
    By Georgyw5k in forum Free 4 All
    Replies: 5
    Last Post: 28th-November-2003, 05:18
  2. Do You Hang Up On Advertisement Callers?
    By ((KvN)) in forum Free 4 All
    Replies: 52
    Last Post: 21st-July-2003, 11:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About Us

We are the oldest retro gaming forum on the internet. The goal of our community is the complete preservation of all retro video games. Started in 2001 as EmuParadise Forums, our community has grown over the past 18 years into one of the biggest gaming platforms on the internet.

Social