Don't you hate it when your client program says it's sending the server a value of, say 2, and the server says its reciving a value of 50? And I doubt its the endianness, because both programs are in C#, and both programs use the same classes for reading and writing (base stream MemoryStream, StreamReader, BinaryWriter).
Can someone tell me what this turns into once compiled and [b] cast as an int[/b].
[code]
// little-endian "VBSP"
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'V')
[/code]
I've got "1347633750" from reading it from a map, not sure if that's right.
[QUOTE=Lord Ned;31063036]Can someone tell me what this turns into once compiled and [b] cast as an int[/b].
[code]
// little-endian "VBSP"
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'V')
[/code]
I've got "1347633750" from reading it from a map, not sure if that's right.[/QUOTE]
Yes it is:
[URL="http://www.wolframalpha.com/input/?i=%2880+%3C%3C+24%29+%2B+%2883+%3C%3C+16%29+%2B+%2866+%3C%3C+8%29+%2B+86"]1347633750[/URL]
Also, a signed int is from -(2 ^ 31) to 2 ^ 31 - 1
[QUOTE=Lord Ned;31063036]Can someone tell me what this turns into once compiled and [b] cast as an int[/b].
[code]
// little-endian "VBSP"
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'V')
[/code]
I've got "1347633750" from reading it from a map, not sure if that's right.[/QUOTE]
I load the header and then check the "magic number" with an strcmp. Packing it into an int is smart but it doesn't have any significant advantages, it's still 4 bytes :P
[code]
struct _IBSP_HEADER
{
char Magic[4];
int Version;
_IBSP_LUMPDIRECTORY DirEntries[17];
};
[/code]
Here's the IBSP renderer from my really old engine
[url]http://code.google.com/p/oe-portable-engine/source/browse/trunk/src/Engine/Parsers/BSP.cpp[/url]
I warn you it's pretty fugly, I was obsessed with name-spaces back then.
[QUOTE=Bladezor;31063528]I load the header and then check the "magic number" with an strcmp. Packing it into an int is smart but it doesn't have any significant advantages, it's still 4 bytes :P
[code]
struct _IBSP_HEADER
{
char Magic[4];
int Version;
_IBSP_LUMPDIRECTORY DirEntries[17];
};
[/code]
Here's the IBSP renderer from my really old engine
[url]http://code.google.com/p/oe-portable-engine/source/browse/trunk/src/Engine/Parsers/BSP.cpp[/url]
I warn you it's pretty fugly, I was obsessed with name-spaces back then.[/QUOTE]
[QUOTE=My Laptop]
Michael-Williamss-MacBook-Pro:~ mike$ cd Documents/VBSP
Michael-Williamss-MacBook-Pro:VBSP mike$ ls
magic magic.o strcmp.c
magic.c strcmp strcmp.o
Michael-Williamss-MacBook-Pro:VBSP mike$ cat strcmp.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main( int argc, const char* argv[] )
{
if(strcmp("VBSP", argv[1]) == 0)
printf("Correct.\n");
else
printf("Incorrect.\n");
return 0;
}
Michael-Williamss-MacBook-Pro:VBSP mike$ cat magic.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define VBSP_MAGIC_HEADER() \
(('P' << 24) + ('S' << 16) + ('B' << 8) + 'V')
int main( int argc, const char* argv[] )
{
if(*(int*)(argv[1]) == VBSP_MAGIC_HEADER())
printf("Correct.\n");
else
printf("Incorrect.\n");
return 0;
}
Michael-Williamss-MacBook-Pro:VBSP mike$ gcc -Wall magic.c -o magic
Michael-Williamss-MacBook-Pro:VBSP mike$ gcc -Wall strcmp.c -o strcmp
Michael-Williamss-MacBook-Pro:VBSP mike$ gcc -g -c magic.c
Michael-Williamss-MacBook-Pro:VBSP mike$ gcc -g -c strcmp.c
Michael-Williamss-MacBook-Pro:VBSP mike$ otool -t -V magic.o
magic.o:
(__TEXT,__text) section
_main:
0000000000000000 pushq %rbp
0000000000000001 movq %rsp,%rbp
0000000000000004 subq $0x10,%rsp
0000000000000008 movl %edi,0xfc(%rbp)
000000000000000b movq %rsi,0xf0(%rbp)
000000000000000f movq 0xf0(%rbp),%rax
0000000000000013 addq $0x08,%rax
0000000000000017 movq (%rax),%rax
000000000000001a movl (%rax),%eax
000000000000001c cmpl $0x50534256,%eax
0000000000000021 jne 0x00000031
0000000000000023 leaq LC0(%rip),%rdi
000000000000002a callq _puts
000000000000002f jmp 0x0000003d
0000000000000031 leaq LC1(%rip),%rdi
0000000000000038 callq _puts
000000000000003d movl $_main,%eax
0000000000000042 leave
0000000000000043 ret
Michael-Williamss-MacBook-Pro:VBSP mike$ otool -t -V strcmp.o
strcmp.o:
(__TEXT,__text) section
_main:
0000000000000000 pushq %rbp
0000000000000001 movq %rsp,%rbp
0000000000000004 subq $0x10,%rsp
0000000000000008 movl %edi,0xfc(%rbp)
000000000000000b movq %rsi,0xf0(%rbp)
000000000000000f movq 0xf0(%rbp),%rax
0000000000000013 addq $0x08,%rax
0000000000000017 movq (%rax),%rsi
000000000000001a leaq LC0(%rip),%rdi
0000000000000021 callq _strcmp
0000000000000026 testl %eax,%eax
0000000000000028 jne 0x00000038
000000000000002a leaq LC1(%rip),%rdi
0000000000000031 callq _puts
0000000000000036 jmp 0x00000044
0000000000000038 leaq LC2(%rip),%rdi
000000000000003f callq _puts
0000000000000044 movl $_main,%eax
0000000000000049 leave
000000000000004a ret
[/QUOTE]
What's that?
looks like code
[QUOTE=TheCloak;31064056]looks like code[/QUOTE]
[img]http://img717.imageshack.us/img717/513/identifyingcodechimitos.jpg[/img]
(Made special just for you)
why the demotivational
So while I was making my space shooter game I decided to play around with shaders...
[img]http://dl.dropbox.com/u/4081391/trippinballs.gif[/img]
[img]http://www.facepunch.com/fp/emoot/psypop.gif[/img]
So I'm still working on this simple game of mine but I keep running into huge problems because of my lack of knowledge of matrices and basic 3d math. Does anybody know any books on the markets or perhaps some other way to get a basic understanding of the math involved in a 3d game?
[QUOTE=DevBug;31063903]What's that?[/QUOTE]
looks like the C source code file, with the compiled assembly below it. It looks like it checks if a BSP is valid or something.
[IMG]http://i.imgur.com/0pmBl.jpg[/IMG]
Also, I sorta came up with an idea for a file sharing application. It works only on a LAN network, and it's basically a whiteboard + dropbox thing.
Edit: Meh, I don't like it anymore.
[QUOTE=Capsup;31066769]So I'm still working on this simple game of mine but I keep running into huge problems because of my lack of knowledge of matrices and basic 3d math. Does anybody know any books on the markets or perhaps some other way to get a basic understanding of the math involved in a 3d game?[/QUOTE]
You will get much better results here:
[url]http://www.facepunch.com/threads/1092921-What-do-you-need-help-with-V.-3.0[/url]
[QUOTE=DevBug;31063442]Yes it is:
[URL="http://www.wolframalpha.com/input/?i=%2880+%3C%3C+24%29+%2B+%2883+%3C%3C+16%29+%2B+%2866+%3C%3C+8%29+%2B+86"]1347633750[/URL]
Also, a signed int is from -(2 ^ 31) to 2 ^ 31 - 1[/QUOTE]
[QUOTE=Bladezor;31063528]I load the header and then check the "magic number" with an strcmp. Packing it into an int is smart but it doesn't have any significant advantages, it's still 4 bytes :P
[code]
struct _IBSP_HEADER
{
char Magic[4];
int Version;
_IBSP_LUMPDIRECTORY DirEntries[17];
};
[/code]
Here's the IBSP renderer from my really old engine
[url]http://code.google.com/p/oe-portable-engine/source/browse/trunk/src/Engine/Parsers/BSP.cpp[/url]
I warn you it's pretty fugly, I was obsessed with name-spaces back then.[/QUOTE]
Thanks!
I'm having a strange problem loading my vertex/plane lump. (Using Source BSP Version 20) - I loaded all of the lumps correctly (as far as I can tell), and to find the number of planes I do:
bspheader.lumps[1].filelength / 20; //20 bytes a Plane
I then use a BinaryStream to read it in a loop, and sucessfully fill out the plane struct. (Using C#, can't easily make a pointer and cast it to the struct unfortunately.)
However, when looking at it in debugging, it's deciding that there are more planes than there should be in the map. The end ones are filled with semi-junk, planes saying the normal is "0, 0, 0", or that the distance from the origin is "1024" and -1024. I don't have brushes anywhere near that far out in my test case.
When I do the same for the Vertex lump and divide by 12, it gets me ~50 vertexes when I only have 6 6 sided brushes in my map. At worst case senario it should be 8*6 or 48 vertexes. Then since it merges vertexs you can take off 8, and that would get you 40 vertexes, and that's exactly what I have... + 10 vertexes filled with "0, 0, 0". I'm not sure if I'm reading the lumps wrong, doing the math wrong, or if the BSP is storing extra misc data.
I just got an idea for a mildly useful application/extension, if anybody wants something to do, do read.
Basically it's a web browser (or a browser extension) that lets you enter the server IP and the hostname you want to use for connections. Basically it would be useful for testing before domain propagation or for testing how the site would work on a public, online server before it even is public or offline.
Basically you'd enter an IP like, say, 192.168.0.14, which would be your test server, and also the domain, like thisdomaintotallyworksbecauseofwildcards.workrum.net.
Though there probably already is something like that and I just never found it
[QUOTE=Murkrow;31069338]I just got an idea for a mildly useful application/extension, if anybody wants something to do, do read.
Basically it's a web browser (or a browser extension) that lets you enter the server IP and the hostname you want to use for connections. Basically it would be useful for testing before domain propagation or for testing how the site would work on a public, online server before it even is public or offline.
Basically you'd enter an IP like, say, 192.168.0.14, which would be your test server, and also the domain, like thisdomaintotallyworksbecauseofwildcards.workrum.net.
Though there probably already is something like that and I just never found it[/QUOTE]
Can't you do this with the hosts file?
Okay then
I just got an idea for a mildly useful application/extension, if anybody wants something to do, do read.
Basically it's a notepad that can only edit the hosts file
[QUOTE=Lord Ned;31068981]Thanks!
I'm having a strange problem loading my vertex/plane lump. (Using Source BSP Version 20) - I loaded all of the lumps correctly (as far as I can tell), and to find the number of planes I do:
bspheader.lumps[1].filelength / 20; //20 bytes a Plane
[/QUOTE]
Plane lump is 40 bytes.
normalized vector
distance
type (for axial checks)
[img]http://dl.dropbox.com/u/23989104/ka50.png[/img]
Meh. Every face has the same normal, else it looks shitty.
How do I implement smoothing groups :/
[editline]12th July 2011[/editline]
Also, the app crashes ntdll when closed, anybody know what causes this? Debug stops at "ntdll!TpWaitForAlpcCompletion()" :v:
[QUOTE=WeltEnSTurm;31071724][img]http://dl.dropbox.com/u/23989104/ka50.png[/img]
Meh. Every face has the same normal, else it looks shitty.
How do I implement smoothing groups :/[/QUOTE]
Vertex normals.
[QUOTE=ROBO_DONUT;31073057]Vertex normals.[/QUOTE]
How do I find the correct vertex normals for a smoothing group specified in an .obj file?
I found out I was off one again by specifying texture coordinates and normals AFTER I added the vertex, not before. Now that's fixed and as long as normals are specified, everything looks fine. These SuperBible GLTools are odd :v:
[QUOTE=DevBug;31063903]What's that?[/QUOTE]
I don't really see anything significant. I'm not saying don't do it, but if you're having trouble strcmp is just as good. Sure it's a few more x86 instructions but it's all on load time so who cares I'm sure a string comparison isn't going to destroy your map load time lol
Does anyone know of any papers on implementing a fast SSS type effect in DX? I'm looking for an effect to make the terrain in one of my games feel alive, so the surface of the terrain is black, but a soft blue light glows from the bottom, making it look like skin or some kind of exotic ballistics gel.
well, i'm trying to go by DarkBasic Professional's tutorials, and there's one where you just have stars that fly from right to left on the screen. i've got that working pretty good, but in the "suggestions" it says that it's simple to make it go from left to right or up to down and i have no idea how to do this
but all in all i'm working on stars, lots of stars
[QUOTE=WeltEnSTurm;31073405]How do I find the correct vertex normals for a smoothing group specified in an .obj file?[/QUOTE]
Is this an editing program or just a loader?
I think it's the exporter's job to assign the correct vertex normals, either smooth or un-smooth.
[QUOTE=NorthernGate;31075107]Does anyone know of any papers on implementing a fast SSS type effect in DX? I'm looking for an effect to make the terrain in one of my games feel alive, so the surface of the terrain is black, but a soft blue light glows from the bottom, making it look like skin or some kind of exotic ballistics gel.[/QUOTE]
I'm not an expert, nor can I link you to a paper on the subject, but I think the usual approach goes like this:
1. First Pass: Texture-space lighting
1A. Vertex shader outputs raw UV coordinates. The first implication of this is that UV coordinates must be unique. For the specific case of terrain, where textures repeat over and over, you're going to need to generate a second set of UV coordinates dynamically for the region around the player (should be simple -- it's just a matter of scaling/translating the raw x- and y- coordinates). The second implication is that UV coordinates should be uniform scale with respect to world space (i.e. don't dedicate half your texture area to one tiny detail, nor have one huge chunk of model occupy a small part of your texture space). Without uniform scale, you won't get uniform scattering.
1B. Fragment shader computes lighting as usual. Don't apply surface color yet, this happens in the next step.
1C. Render this out to a texture-size framebuffer object.
2. Second pass: Render with blurred lighting
2A. Your vertex shader is simply going to be the usual transformations to screen space.
2B. Fragment shader combines lighting with surface details, but samples the lighting surface generated in the first pass multiple times and computes a weighted average. Sampling and blurring is a big topic in computer graphics, so you should read up on that if you haven't already. Note that most materials don't scatter all colors of light equally.
2C. Render to screen.
This is texture space "fake" subsurface scattering. IIRC, it pioneered in the Matrix films (so you know it still looks damn good).
True SSS is often prohibitively expensive to render in real-time, except in special cases.
More shader fun. This time I'm ripping off copyrighted games like Limbo. oh well who cares
[media]http://www.youtube.com/watch?v=SACKcWkY_0A[/media]
I made the game engine flexible enough that i can completely do the effect on the lua side.
[code]
local fbo2 = CreateFrameBufferObject( "fbo2", 1024, 768 );
function PreParallaxDraw()
ToggleShader( 1 );
SetShaderInt( "state_Lighting", 0 );
SetShaderInt( "state_Grayscale", 1 );
SetShaderInt( "state_Bloom", 1 );
end
function PostParallaxDraw()
end
function PreWorldDraw()
SetShaderInt( "state_Lighting", 1 );
local tx, ty = GetCameraPos();
BeginFBO( fbo2 );
Translate( tx, ty );
end
function PostWorldDraw()
local px, py = GetEntityPos( GetPlayerEntity() );
local by = GetPlayerBobY();
local direction = GetEntityFacing( GetPlayerEntity() );
local flip = false;
local ox = 0;
if( direction < 0 ) then
flip = true;
ox = 54;
end
SetShaderInt( "state_Lighting", 0 );
DrawTexture( "graphics/huey/hueyrighteyes.png", px + ox, py + by, .75, 0, flip );
EndFBO();
SetShaderInt( "state_Blur", 1 );
SetShaderFloat( "BlurFactor", .0004 );
DrawTexture( "fbo2", 0, 0, 1, 0, false, true );
SetShaderInt( "state_Blur", 0 );
SetShaderInt( "state_Lighting", 1 );
end
[/code]
Original without shaders:
[img]http://img6.imageshack.us/img6/3773/hueybeforelimbo.png[/img]
In other news, why is garry using the VB .net icon for the programming subforum? ([img]http://www.facepunch.com/fp/forums/240.png[/img])
Is he trying to make us angry
[editline]df[/editline]
[QUOTE=Quark:;31076155]That is the Visual Studio icon, not the VB.NET icon. This is the VB.NET icon:
[t]http://dailybyte.in/wp-content/uploads/2011/03/Visual-Basic-Icon.png[/t][/QUOTE]
shit
[QUOTE=NorthernGate;31075107]Does anyone know of any papers on implementing a fast SSS type effect in DX? I'm looking for an effect to make the terrain in one of my games feel alive, so the surface of the terrain is black, but a soft blue light glows from the bottom, making it look like skin or some kind of exotic ballistics gel.[/QUOTE]
[url]http://http.developer.nvidia.com/GPUGems/gpugems_ch16.html[/url]
I've never seen it done on terrain but I'm willing to bet it's pretty expensive. You might be able to get away with some clever blending, self illuminating textures and some "noise" layer that's texture shifted according to the cameras position
Didn't notice ROBO's post, that's definitely a better method
[QUOTE=Dehodson;31076071]In other news, why is garry using the VB .net icon for the programming subforum? ([img]http://www.facepunch.com/fp/forums/240.png[/img])
Is he trying to make us angry[/QUOTE]
That is the Visual Studio icon, not the VB.NET icon. This is the VB.NET icon:
[t]http://dailybyte.in/wp-content/uploads/2011/03/Visual-Basic-Icon.png[/t]
Sorry, you need to Log In to post a reply to this thread.