Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 280 281 [282] 283 284 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 902664 times)

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4215 on: March 15, 2013, 05:48:54 am »

MagmaMcFry: Try doing the 3D thing again with a smoother heightmap! By smooth, I mean really smooth. Like the initial displacement being less than 1.
Er, which one? The green thing or the moon thing? And what do you mean by really smooth? I can tweak resolution, change the exponent, blur the heightmap, or simply decrease the altitude multiplier. Which of those do you want to see?
Logged

Soadreqm

  • Bay Watcher
  • I'm okay with this. I'm okay with a lot of things.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4216 on: March 15, 2013, 07:20:58 am »

If you're a new programmer, it's not a force of habit. If I see you do it one more time, I'm going to post in 72 point font not to do it again.

Hey, at least they're not strings. :D

Well, booleans are like this:

false = false

true = true

Apparently, in at least some versions of Python, you can set True = False.
Logged

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4217 on: March 15, 2013, 07:39:30 am »

I'm surprised at how common it is to make values that represent true/false (I.E a boolean) integers for new programmers :P mostly because I started with that...
I wonder if his professor was majorly a C programmer?
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4218 on: March 15, 2013, 08:11:17 am »

MagmaMcFry: Try doing the 3D thing again with a smoother heightmap! By smooth, I mean really smooth. Like the initial displacement being less than 1.
Er, which one? The green thing or the moon thing? And what do you mean by really smooth? I can tweak resolution, change the exponent, blur the heightmap, or simply decrease the altitude multiplier. Which of those do you want to see?
I thought diamond square worked with a displacement value each step. :S
Just make the max heights and the min heights have a smaller difference, see if it looks less like an asteroid, re the moon thingy.

I'm surprised at how common it is to make values that represent true/false (I.E a boolean) integers for new programmers :P mostly because I started with that...
I wonder if his professor was majorly a C programmer?
Doesn't C have true and false too?
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4219 on: March 15, 2013, 08:26:53 am »

MagmaMcFry: Try doing the 3D thing again with a smoother heightmap! By smooth, I mean really smooth. Like the initial displacement being less than 1.
Er, which one? The green thing or the moon thing? And what do you mean by really smooth? I can tweak resolution, change the exponent, blur the heightmap, or simply decrease the altitude multiplier. Which of those do you want to see?
I thought diamond square worked with a displacement value each step. :S
Just make the max heights and the min heights have a smaller difference, see if it looks less like an asteroid, re the moon thingy.
Spoiler: SCREENSHOTS (click to show/hide)


Quote
I'm surprised at how common it is to make values that represent true/false (I.E a boolean) integers for new programmers :P mostly because I started with that...
I wonder if his professor was majorly a C programmer?
Doesn't C have true and false too?
Nope, true and false are C++ keywords.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4220 on: March 15, 2013, 10:08:24 am »

Question:

Which one would be faster for large (>=1 GB) data?

1. Reading and writing in one or more threads, and encrypting the data in another thread (at the same time), in small blocks of memory.
:: reasoning: page faults prevent one from using large amounts of RAM. Multithreading lets a user to read, encrypt, and write at the same time.
2. Reading large blocks of memory into RAM (0.3 GB ~ 1 GB), using multiple threads to encrypt it, then outputting it again.
:: reasoning: RAM I/O is orders of magnitude faster than hard drive I/O. Multithreading and disk I/O also are more efficient in large batches.

I think the operation being done is block encryption.

Someone asked a question and me and a different person have different answers XD
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4221 on: March 15, 2013, 10:11:15 am »

Question:

Which one would be faster for large (>=1 GB) data?

1. Reading and writing in one or more threads, and encrypting the data in another thread (at the same time), in small blocks of memory.
:: reasoning: page faults prevent one from using large amounts of RAM. Multithreading lets a user to read, encrypt, and write at the same time.
2. Reading large blocks of memory into RAM (0.3 GB ~ 1 GB), using multiple threads to encrypt it, then outputting it again.
:: reasoning: RAM I/O is orders of magnitude faster than hard drive I/O. Multithreading and disk I/O also are more efficient in large batches.

I think the operation being done is block encryption.

Someone asked a question and me and a different person have different answers XD

Probably #2 for speed, disk IO is serial anyway, having multiple processes access it won't speed up the reading. If you have small amounts of RAM (on a phone or something) you might want to go for #1 as it seems more robust.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4222 on: March 15, 2013, 10:16:44 am »

I kind of miss programming like this:

Code: [Select]
go :- hypothesize(Animal),
      write('I guess that the animal is: '),
      write(Animal),
      nl,
      undo.

hypothesize(cheetah)   :- cheetah, !.
hypothesize(tiger)     :- tiger, !.
hypothesize(giraffe)   :- giraffe, !.
hypothesize(zebra)     :- zebra, !.
hypothesize(ostrich)   :- ostrich, !.
hypothesize(penguin)   :- penguin, !.
hypothesize(albatross) :- albatross, !.
hypothesize(unknown).

cheetah :- mammal,
           carnivore,
           verify(has_tawny_color),
           verify(has_dark_spots).
tiger :- mammal, 
         carnivore,
         verify(has_tawny_color),
         verify(has_black_stripes).
giraffe :- ungulate,
           verify(has_long_neck),
           verify(has_long_legs).
zebra :- ungulate, 
         verify(has_black_stripes).

ostrich :- bird, 
           verify(does_not_fly),
           verify(has_long_neck).
penguin :- bird,
           verify(does_not_fly),
           verify(swims),
           verify(is_black_and_white).
albatross :- bird,
             verify(appears_in_story_Ancient_Mariner),
             verify(flys_well).

mammal    :- verify(has_hair), !.
mammal    :- verify(gives_milk).
bird      :- verify(has_feathers), !.
bird      :- verify(flys),
             verify(lays_eggs).
carnivore :- verify(eats_meat), !.
carnivore :- verify(has_pointed_teeth),
             verify(has_claws),
             verify(has_forward_eyes).
ungulate :- mammal,
            verify(has_hooves), !.
ungulate :- mammal,
            verify(chews_cud).

ask(Question) :-
    write('Does the animal have the following attribute: '),
    write(Question),
    write('? '),
    read(Response),
    nl,
    ( (Response == yes ; Response == y)
      ->
       assert(yes(Question)) ;
       assert(no(Question)), fail).

:- dynamic yes/1,no/1.

verify(S) :-
   (yes(S)
    ->
    true ;
    (no(S)
     ->
     fail ;
     ask(S))).

undo :- retract(yes(_)),fail.
undo :- retract(no(_)),fail.
undo.
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #4223 on: March 15, 2013, 10:49:58 am »

Question:

Which one would be faster for large (>=1 GB) data?

1. Reading and writing in one or more threads, and encrypting the data in another thread (at the same time), in small blocks of memory.
:: reasoning: page faults prevent one from using large amounts of RAM. Multithreading lets a user to read, encrypt, and write at the same time.
2. Reading large blocks of memory into RAM (0.3 GB ~ 1 GB), using multiple threads to encrypt it, then outputting it again.
:: reasoning: RAM I/O is orders of magnitude faster than hard drive I/O. Multithreading and disk I/O also are more efficient in large batches.

I think the operation being done is block encryption.

Someone asked a question and me and a different person have different answers XD

Probably #2 for speed, disk IO is serial anyway, having multiple processes access it won't speed up the reading. If you have small amounts of RAM (on a phone or something) you might want to go for #1 as it seems more robust.


Disk IO for most hardware actually does benefit from multi-threading if you are dealing with many files. Reading/writing a single file is unlikely to use your disks/controllers full bandwidth. You can see a x2 to x4 read/write performance increase with 8 threads. But I wouldn't go over 8 threads.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4224 on: March 15, 2013, 11:13:19 am »

I kind of miss programming like this:
..snip...
What I like about Prolog is that the more you try to force it to be more procedural, the more the word "fail" appears. XD
Logged

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4225 on: March 16, 2013, 06:29:02 am »

So, I started a new project, well not really a *new* project,  I was helping a guy work on a game 2-3 years ago, but back then I was doing 3D models for it,  got in contact with him and he wanted me to make a few more models for it, but saw that he really needed a programmer, so I offered to do the programming instead.
So I'm putting my current/old project on hold until I help finish this, because not only should it make me some money (hopefully) but when I finish it'll be a good little something in my portfolio.

It's on the source engine; which I know little about, and I have to use Visual Studio which I've never used before.

Finally got it all set up, and wow, the Source engine is really a clusterfuck, there's just so much to it.  I'm sure I can figure this all out though, doesn't seem to hard, just looks a bit daunting at first because of its size. 

right now I'm working on the xp/level system, then after that is the inventory system and saving the character to a file, all which should be rather easy-ish.  The real hard part is I might have to redesign the combat, or have someone to help me with that, because the combat in game at the moment is all placeholder.

Spoiler (click to show/hide)
« Last Edit: March 16, 2013, 06:33:43 am by Valid_Dark »
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4226 on: March 16, 2013, 08:05:11 am »

Code: [Select]
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(2911): error C2065: '__CREATE_IMAGE2D_ERR' : undeclared identifier
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(2965): error C2065: '__CREATE_GL_TEXTURE_2D_ERR' : undeclared identifier
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(3107): error C2065: '__CREATE_IMAGE3D_ERR' : undeclared identifier
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(3160): error C2065: '__CREATE_GL_TEXTURE_3D_ERR' : undeclared identifier
1>gpgpu_virtualPipes.cpp(166): warning C4018: '<' : signed/unsigned mismatch
1>  main.cpp
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(2911): error C2065: '__CREATE_IMAGE2D_ERR' : undeclared identifier
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(2965): error C2065: '__CREATE_GL_TEXTURE_2D_ERR' : undeclared identifier
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(3107): error C2065: '__CREATE_IMAGE3D_ERR' : undeclared identifier
1>C:\Program Files (x86)\AMD_APP\include\CL/cl.hpp(3160): error C2065: '__CREATE_GL_TEXTURE_3D_ERR' : undeclared identifier


A set of errors from a simple

#define CL_VERSION_1_0                              1
#undef CL_VERSION_1_1
#undef CL_VERSION_1_2


I am continuing my efforts to make my program portable, but they are foiled yet again!
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4227 on: March 16, 2013, 02:08:38 pm »

That sucks  :-\
I guess that leaves you with two options then:
1. Find and install an older version of the APP SDK, or an alternative SDK like Intel's.
2. Forgo the C++ wrapper and use the C api directly.

Technically there's a third option: Telling compatibility to sod off and lock your application to 1.2 and the hardware that supports it, but that's not very helpful if you actually need this to run on other people's computers.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4228 on: March 16, 2013, 09:07:58 pm »

My own PC can only run 1.1 :P
The weird thing is it runs OpenCL without a hiccup. Also, no mention of clRetainDevice in the error messages. Maybe I should go ask stackoverflow? :S
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4229 on: March 17, 2013, 10:34:47 pm »

I'm surprised at how common it is to make values that represent true/false (I.E a boolean) integers for new programmers :P mostly because I started with that...
I wonder if his professor was majorly a C programmer?
Doesn't C have true and false too?
Nope, true and false are C++ keywords.

Well... It does, actually. C99 introduced the stdbool.h header, which defines bool, true, and false.
« Last Edit: March 18, 2013, 01:03:47 am by Mego »
Logged
Pages: 1 ... 280 281 [282] 283 284 ... 796