I'm working on Python :downs:
[img]http://img856.imageshack.us/img856/9522/screenshothj.png[/img]
I bet all you Programming Kings are like "Wow, he's doing that wrong." :v:
Also, can someone explain to me what everything from done=False down means?
I'm just following the examples from a beginning Python/Pygame programming book and I have no idea what it does, just that it has to be there.
Well I suggest that you read PEP 8, your coding style now is really inconsistent and if you stick to PEP 8 then everything will be swell for you and other python programmers.
Your using arrays to pass co-ords etc. to pygame. I'm pretty sure that even though that works you should be passing tuples. I can't think of the reason know right now, but that's how I learnt and everyone does as well. If anything do it because it looks nicer.
[QUOTE=iPope;31600771]Well I suggest that you read PEP 8, your coding style now is really inconsistent and if you stick to PEP 8 then everything will be swell for you and other python programmers.
Your using arrays to pass co-ords etc. to pygame. I'm pretty sure that even though that works you should be passing tuples. I can't think of the reason know right now, but that's how I learnt and everyone does as well. If anything do it because it looks nicer.[/QUOTE]
Tuples conceptually make more sense because here any wonk can add items to a coordinate triple. In a statically typed language you'd actually encode the tuple size in the type.
Does anyone know a good resource on how to do proper networking for a small game (4 players max with almost no other objects that need to be networked)
Wrote a small program to convert Wavefront .obj files into a binary format that I could load straight into a mesh.
The binary output file is bigger than the plaintext input file.
[img]http://a0.twimg.com/profile_images/842219072/sadfrog_normal.jpg[/img]
Feels bad man.
[QUOTE=Dr Magnusson;31601378]The binary output file is bigger than the plaintext input file. [/QUOTE]
[B]
HOW[/B]
[QUOTE=iPope;31600771]Well I suggest that you read PEP 8, your coding style now is really inconsistent and if you stick to PEP 8 then everything will be swell for you and other python programmers.
Your using arrays to pass co-ords etc. to pygame. I'm pretty sure that even though that works you should be passing tuples. I can't think of the reason know right now, but that's how I learnt and everyone does as well. If anything do it because it looks nicer.[/QUOTE]
This is unbelievably pedantic.
Also, newbies shouldn't have to worry about style issues except where it poses a very real problem (i.e. having a function with eight levels of indentation).
[editline]8th August 2011[/editline]
[QUOTE=esalaka;31601396][B]
HOW[/B][/QUOTE]
This. wat.
Also, if you're looking for a simple binary model format (and don't necessarily require Wavefront), try [url=http://lee.fov120.com/iqm/]IQM[/url].
It's simple and logical while still having modern features like skeletal animation and even adjacency data (for geometry shaders). If it doesn't have what you need it's also pretty extensible. The reference implementation is public-domain, although you might not want to use any of it as-is (some of it is a little gnarly). It has compilers for common formats like MD5 and SMD and is one of a minority of formats to have export scripts for Blender 2.5 (Blender threw out their entire API and started over, breaking compatibility with their massive library of older scripts).
It's because it's just a simple cube, and the .obj format uses the faces to reference vertices/texture coordinates/normals/whatever, so while the object file stores each point only once, I have to put it in there once for every time it's used, and since I'm using triangles, each corner is used 8 times.
Anything more complicated than a cube would make the binary output smaller.
[QUOTE=Dr Magnusson;31601490]I have to put it in there once for every time it's used, and since I'm using triangles, each corner is used 8 times.[/QUOTE]
That's stupid. Just use references the same way - by specifying a index into the vertex list (4 bytes max, you could probably get away with 2 or 3) instead of a whole new vertex (12 bytes).
[QUOTE=q3k;31601542]That's stupid. Just use references the same way - by specifying a index into the vertex list (4 bytes max, you could probably get away with 2 or 3) instead of a whole new vertex (12 bytes).[/QUOTE]
I'll optimize later, right now I just want to get stuff working first.
[QUOTE=iPope;31600771]Well I suggest that you read PEP 8, your coding style now is really inconsistent and if you stick to PEP 8 then everything will be swell for you and other python programmers.
Your using arrays to pass co-ords etc. to pygame. I'm pretty sure that even though that works you should be passing tuples. I can't think of the reason know right now, but that's how I learnt and everyone does as well. If anything do it because it looks nicer.[/QUOTE]Okay, thanks. I Googled PEP 8, so I'm reading that right now.
Can you explain "tuples"? Didn't read that anywhere in the book so far.
[QUOTE=q3k;31601542]That's stupid. Just use references the same way - by specifying a index into the vertex list (4 bytes max, you could probably get away with 2 or 3) instead of a whole new vertex (12 bytes).[/QUOTE]
Note that for the specific case of a textured cube you run into the same problem either way because you have to duplicate verts along the model's seams to have different texture coordinates. In most models seams compose only a tiny fraction of the model's edges.
[editline]8th August 2011[/editline]
[QUOTE=TerrorShield;31601584]Okay, thanks. I Googled PEP 8, so I'm reading that right now.
Can you explain "tuples"? Didn't read that anywhere in the book so far.[/QUOTE]
It's the immutable (cannot be changed after initialization) version of a list. A tuple is denoted with regular parenthesis instead of rectangular brackets.
[QUOTE=ROBO_DONUT;31601606]Note that for the specific case of a textured cube you run into the same problem either way because you have to duplicate verts along the model's seams to have different texture coordinates. In most models seams compose only a tiny fraction of the model's edges.[/QUOTE]
Unless you use texels and tfaces (or just have an index into the texel list in your face list). You should really separate texture coordinates from 3d space coordinates, otherwise yes, you do get a lot of redundant vertices.
[QUOTE=q3k;31601708]Unless you use texels and tfaces (or just have an index into the texel list in your face list). You should really separate texture coordinates from 3d space coordinates, otherwise yes, you do get a lot of redundant vertices.[/QUOTE]
This sounds like it would require more processing in your loader/renderer. At least with OpenGL, generally the same index is used for all vertex attributes. I don't think you can have (in the core profile, at least) texture coordinates separate from other vertex attributes without incurring some sort of massive performance hit.
[QUOTE=ROBO_DONUT;31601798]This sounds like it would require more processing in your loader/renderer.[/QUOTE]
Well, it's also easier to load a TGA/BMP than a PNG or JPEG, yet people write loaders for other image formats, right?
You just need to process it while loading, as you would have to convert it to something usable by your renderer. I'd rather lose 20ms while loading than have a bigger file format.
You could also probably hack around it by converting the texel list into a 2D texture usable from your vertex shader, but that's just evil :v:.
[QUOTE=Dr Magnusson;31601378]Wrote a small program to convert Wavefront .obj files into a binary format that I could load straight into a mesh.
The binary output file is bigger than the plaintext input file.
[img]http://a0.twimg.com/profile_images/842219072/sadfrog_normal.jpg[/img]
Feels bad man.[/QUOTE]
A while ago I wrote a similar program, but it still followed the referencing of the .obj format and even expanded a bit on it. For instance, I made floating point numbers references as well. You can take a look at it if you want.
[url=http://codepad.org/CdqqY10U]OBJ -> Bin[/url]
[url=http://codepad.org/Vz6KLLCI]Bin -> OBJ[/url]
[QUOTE=q3k;31601865]Well, it's also easier to load a TGA/BMP than a PNG or JPEG, yet people write loaders for other image formats, right?
You just need to process it while loading, as you would have to convert it to something usable by your renderer. I'd rather lose 20ms while loading than have a bigger file format.
You could also probably hack around it by converting the texel list into a 2D texture usable from your vertex shader, but that's just evil :v:.[/QUOTE]
I'm fairly sure the point was to create a format that could be loaded straight in, otherwise you could just keep using something like .obj
[QUOTE=Overv;31601948]A while ago I wrote a similar program, but it still followed the referencing of the .obj format and even expanded a bit on it. For instance, I made floating point numbers references as well. You can take a look at it if you want.
[url=http://codepad.org/CdqqY10U]OBJ -> Bin[/url]
[url=http://codepad.org/Vz6KLLCI]Bin -> OBJ[/url][/QUOTE]
Overv could you please change your avatar so that it doesn't have that hole in the middle of the forehead?
I twitch every time I see that.
[QUOTE=Darwin226;31602938]Overv could you please change your avatar so that it doesn't have that hole in the middle of the forehead?
I twitch every time I see that.[/QUOTE]
np
Put my dungeon gen a few pages back into use.
It got a bit carried away
[thumb]http://puu.sh/4842[/thumb]
[thumb]http://puu.sh/484P[/thumb]
It looks like white silly string
[QUOTE=danharibo;31603648]It looks like white silly string[/QUOTE]
You sound like great fun at association games.
[QUOTE=esalaka;31546635]how[/QUOTE]
Sorry this took me so long, hadn't notcied your post. It's git add -p, which is just a shortcut from git -i
EC2 may be expensive for the super-high power/ram instances, but when you need a really cheap server that doesn't need to be that powerful, and you need it now then its very useful.
By cheap I mean free for 750 hrs. Renting a vps that has about the same specs (a little better) is much more expensive (I think). It probably isn't the best choice for bigger websites though.
As for what I'm working on, its a program to answer a question of mine. When downloading something through tor, I want to know if me getting terrible speeds is because of my connection, or because of tor.
I want to see if I can get better speeds if I am using something with a line 1000x as powerful as mine. (I download at 250kb/s, it downloads at 25mb/s). My question is, why the fuck is this timing out?
[csharp]
Console.WriteLine("STARTED");
HttpWebRequest request = HttpWebRequest.Create(uri) as HttpWebRequest;
MemoryStream temp = new MemoryStream();
byte[] buffer = new byte[8196];
int pos = 1;
int numread = 0;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
using (Stream sr = response.GetResponseStream())
{
while(numread!=0)
{
numread = sr.Read(buffer,0,buffer.Length);
if(numread!=0)
{
temp.Write(buffer,pos-1,numread);
pos+=numread;
}
}
}
}
[/csharp]
uri is just a new Uri("http://www.google.com");
[url]http://www.notgames.colognegamelab.com/[/url]
Fire up the lawsuit machine
What the shit.
It's in my hometown, too.
[QUOTE=Murkrow;31607183][url]http://www.notgames.colognegamelab.com/[/url]
Fire up the lawsuit machine[/QUOTE]
Window cleaner: The game.
Now you to can experience the fright and horror of being 352 floors up in the air.
I've written the ugliest 300 lines of code in my life that turns this:
[code]((5 (10 20 *) +) x =)[/code]
Into this:
[img]http://localhostr.com/files/Sh0H1aC/capture.png[/img]
That when executed, results in this:
[img]http://localhostr.com/files/a5Ff73k/capture.png[/img]
...not Lisp?
[editline]8th August 2011[/editline]
I know it's an old joke. Just wanted to point out that it does look like Lisp. Even if it uses the reverse notation.
[QUOTE=Dr Magnusson;31609589]I've written the ugliest 300 lines of code in my life that turns this:
[code]((5 (10 20 *) +) x =)[/code]
Into this:
[img]http://localhostr.com/files/Sh0H1aC/capture.png[/img]
That when executed, results in this:
[img]http://localhostr.com/files/a5Ff73k/capture.png[/img][/QUOTE]
...is that a JIT calculator? :o
Sorry, you need to Log In to post a reply to this thread.