• What Are You Working On? V13
    5,003 replies, posted
Finally found a use for the DS's second screen :buddy: steroscopic projection: [img]http://img213.imageshack.us/img213/5796/90301625.jpg[/img] top screen goes on the left, bottom screen on the right - you hold the DS sideways. Each screen shows a different image to each eye, giving an illusion of depth. You can adjust focal length, lateral separation etc. Sauce if anyone wants a go: [code] sep = 10 focallength = 100 angoffset = math.atan(sep / focallength) px = 0 py = 0 pz = -100 pang = 0 ppitch = 0 files = System.listDirectory(System.currentDirectory().."/data") table.remove(files, 1) table.remove(files, 1) lines = true cursorpos = 1 function pointToScreen(x, y, z) if z > 0 and z < 250 then screenx = 128 + 144*y/z if screenx > 0 and screenx < 256 then screeny = 96 + 144*x/z if screeny > 0 and screeny < 192 then return screenx, screeny else return false end else return false end else return false end end function rotate2d(x, y, ang) cs = math.cos(ang) sn = math.sin(ang) return x*cs+y*sn, y*cs-x*sn end red = Color.new(31, 0, 0) green = Color.new(0, 31, 0) while true do while not Keys.held.Select do Controls.read() if Keys.newPress.Up then cursorpos = cursorpos - 1 if cursorpos < 1 then cursorpos = #files end end if Keys.newPress.Down then cursorpos = cursorpos + 1 if cursorpos > #files then cursorpos = 1 end end startDrawing() for i, v in ipairs(files) do screen.print(SCREEN_UP, 5, i*10-8, files[i].name) end screen.print(SCREEN_UP, 1, cursorpos*10-8, ">") screen.print(SCREEN_UP, 128, 182, "Press SELECT") stopDrawing() end triangles = false if string.lower(string.sub(files[cursorpos].name, -4, -1)) == ".obj" then points = {} for line in io.lines("data/"..files[cursorpos].name) do if string.sub(line, 1, 1) == "v" then table.insert(points, {}) for co in string.gmatch(line, "%s%a*[%d.]+") do table.insert(points[#points], tonumber(string.sub(co, string.find(co, "%d")))) end end end else dofile("data/"..files[cursorpos].name) end while not Keys.held.B do Controls.read() if Stylus.held and heldold then pang = pang - Stylus.deltaY / 50 ppitch = ppitch - Stylus.deltaX / 50 end if Keys.held.R then if Keys.newPress.Up then sep = sep - 1 angoffset = math.atan(sep/focallength) elseif Keys.newPress.Down then sep = sep + 1 angoffset = math.atan(sep/focallength) elseif Keys.newPress.Right then focallength = focallength + 5 angoffset = math.atan(sep/focallength) elseif Keys.newPress.Left then focallength = focallength - 5 angoffset = math.atan(sep/focallength) end elseif Keys.held.Right then px = px + 3 * math.sin(pang) pz = pz + 3 * math.cos(pang) elseif Keys.held.Left then px = px - 3 * math.sin(pang) pz = pz - 3 * math.cos(pang) elseif Keys.held.Up then px = px - 3 * math.cos(pang) pz = pz + 3 * math.sin(pang) elseif Keys.held.Down then px = px + 3 * math.cos(pang) pz = pz - 3 * math.sin(pang) end if Keys.newPress.Start then lines = not lines end sepx = sep * math.cos(pang) sepz = sep * math.sin(pang) startDrawing() screen.drawLine(SCREEN_UP, 128, 0, 128, 196, green) screen.drawLine(SCREEN_UP, 0, 96, 256, 96, green) screen.drawLine(SCREEN_DOWN, 128, 0, 128, 196, green) screen.drawLine(SCREEN_DOWN, 0, 96, 256, 96, green) if lines then if triangles then i = 1 while i < #points-1 do va = points[i] x, z = rotate2d(va[1]-px+sepx, va[3]-pz+sepz, -pang-angoffset) y, z = rotate2d(va[2], z, -ppitch) xa, ya = pointToScreen(x, y, z) if xa then vb = points[i+1] x, z = rotate2d(vb[1]-px+sepx, vb[3]-pz+sepz, -pang-angoffset) y, z = rotate2d(vb[2], z, -ppitch) xb, yb = pointToScreen(x, y, z) if xb then vc = points[i+1] x, z = rotate2d(vc[1]-px+sepx, vc[3]-pz+sepz, -pang-angoffset) y, z = rotate2d(vc[2], z, -ppitch) xc, yc = pointToScreen(x, y, z) if xc then screen.drawLine(SCREEN_DOWN, xa, ya, xb, yb, red) screen.drawLine(SCREEN_DOWN, xc, yc, xb, yb, red) screen.drawLine(SCREEN_DOWN, xa, ya, xc, yc, red) end end end x, z = rotate2d(va[1]-px-sepx, va[3]-pz-sepz, -pang+angoffset) y, z = rotate2d(va[2], z, -ppitch) xa, ya = pointToScreen(x, y, z) if xa then x, z = rotate2d(vb[1]-px-sepx, vb[3]-pz-sepz, -pang+angoffset) y, z = rotate2d(vb[2], z, -ppitch) xb, yb = pointToScreen(x, y, z) if xb then screen.drawLine(SCREEN_UP, xa, ya, xb, yb, red) end end i = i + 3 end else i = 1 while i < #points do va = points[i] x, z = rotate2d(va[1]-px+sepx, va[3]-pz+sepz, -pang-angoffset) y, z = rotate2d(va[2], z, -ppitch) xa, ya = pointToScreen(x, y, z) if xa then vb = points[i+1] x, z = rotate2d(vb[1]-px+sepx, vb[3]-pz+sepz, -pang-angoffset) y, z = rotate2d(vb[2], z, -ppitch) xb, yb = pointToScreen(x, y, z) if xb then screen.drawLine(SCREEN_DOWN, xa, ya, xb, yb, red) end end x, z = rotate2d(va[1]-px-sepx, va[3]-pz-sepz, -pang+angoffset) y, z = rotate2d(va[2], z, -ppitch) xa, ya = pointToScreen(x, y, z) if xa then x, z = rotate2d(vb[1]-px-sepx, vb[3]-pz-sepz, -pang+angoffset) y, z = rotate2d(vb[2], z, -ppitch) xb, yb = pointToScreen(x, y, z) if xb then screen.drawLine(SCREEN_UP, xa, ya, xb, yb, red) end end i = i + 2 end end else for i, v in ipairs(points) do x, z = rotate2d(v[1]-px-sepx, v[3]-pz-sepz, -pang+angoffset) y, z = rotate2d(v[2], z, -ppitch) x, y = pointToScreen(x, y, z) if x then screen.drawRect(SCREEN_UP, x, y, x, y, red) end x, z = rotate2d(v[1]-px+sepx, v[3]-pz+sepz, -pang-angoffset) y, z = rotate2d(v[2], z, -ppitch) x, y = pointToScreen(x, y, z) if x then screen.drawRect(SCREEN_DOWN, x, y, x, y, red) end end end screen.print(SCREEN_UP, 2, 2, "FPS: "..NB_FPS) screen.print(SCREEN_DOWN, 2, 2, "FPS: "..NB_FPS) screen.print(SCREEN_UP, 2, 12, "SEP: "..sep) screen.print(SCREEN_DOWN, 2, 12, "SEP: "..sep) screen.print(SCREEN_UP, 2, 22, "FLN: "..focallength) screen.print(SCREEN_DOWN, 2, 22, "FLN: "..focallength) stopDrawing() heldold = Stylus.held end end [/code]
[QUOTE=r0b0tsquid;25724096]Finally found a use for the DS's second screen :buddy: steroscopic projection[/QUOTE] 3D on the DS
Something like that :v:
Should one use stencil shadows or shadow maps nowadays?
Stencil shadows will always give a much higher quality result, shadow maps are easier to implement. Up to you really.
[QUOTE=Richy19;25724177]3D on the DS[/QUOTE] Next up: It's revealed that the 3DS actually works like this
Wow, I've been on holiday for 5 days and I've missed like 15 pages. Took fucking ages to read through it all, but worth it. There are some really cool things going on in here.
[QUOTE=yngndrw;25725439]Stencil shadows will always give a much higher quality result, shadow maps are easier to implement. Up to you really.[/QUOTE] Stencil shadows actually seem easier to me. I don't like the matrix math shadow maps require.
[QUOTE=esalaka;25725448]Next up: It's revealed that the 3DS actually works like this[/QUOTE] It pretty much does. It just has both images on the same screen so you don't go cross-eyed :v: [editline]29th October 2010[/editline] [img[http://img819.imageshack.us/img819/6581/screenty.png[/img] Now on PSP! [editline]29th October 2010[/editline] [img[http://img819.imageshack.us/img819/6581/screenty.png[/img] Now on PSP! [editline]29th October 2010[/editline] [img]http://img819.imageshack.us/img819/6581/screenty.png[/img] Whoah. I'll be glad when the edit button's back. [editline]29th October 2010[/editline] [img]http://img819.imageshack.us/img819/6581/screenty.png[/img] Whoah. I'll be glad when the edit button's back.
Writing a local simulated client-server connection so I can change to multiplayer later on.
Dug up some old terrain generation stuff :D [img]http://img163.imageshack.us/img163/3855/screent.png[/img]
Where's the edit button gone, anyway? It was here yesterday, wasn't it?
It's gone? :ohdear: Nope, still there.
Oh, yeah, there it is. Wonder what r0b0tsquid was talking about.
How effective is your DIY 3DS? I don't have one, but it seems really cool.
All this matrix math stuff is really hard for me to understand if I don't see it in practice. Are there any programs that could for example load a 3D model and let me add matrices to it and see how it affects the projection realtime?
I'm kind of interested to see how matrices are applied in programming because I fucking love matrices.
[QUOTE=Sh33p;25731831]I'm kind of interested to see how matrices are applied in programming because I fucking love matrices.[/QUOTE] They do some amazing shit with rotations. I don't have a clue how they work but I find it incredible that a 4x4 matrix can do so much cool shit, and then you multiply them together and it does both the things... IN THE ORDER OF THE MULTIPLICATION!? I don't even want to know how they work. To me, matrices are magical boxes which do extraordinary things.
I haven't really been programming too much today, but right now I changed the master score server. Before it was a C++ program which is retarded because I'd have to run the program on my computer 24/7. Which would mean keeping my computer on 24/7. Fuck no. Now it's controlled over my website and using sfml's http part of the networking library, don't have to run anything at all, and it should be up majority of the time. [img]http://i53.tinypic.com/2d0yij8.jpg[/img] Gonna fix some bugs, polish the game a little more, and then an update should be available soon. :) [b]Edit[/b] Since the picture doesn't really explain, the left side (high scores) show the top 10 scores (greatest to least). The right side (all scores) shows EVERY score, greatest to least. ;)
Are you depressed or something, why so much grey? Put some colour into your game. [editline]30th October 2010[/editline] It's all the same shade of grey too, you have 4 colours in your entire game, white, black, red and grey?
[QUOTE=r4nk_;25732838]Are you depressed or something, why so much grey? Put some colour into your game. [editline]30th October 2010[/editline] It's all the same shade of grey too, you have 4 colours in your entire game, white, black, red and grey?[/QUOTE] Cuz I can't blend colors together fur shit.
[QUOTE=xAustechx;25732669]Now it's controlled over my website and using sfml's http part of the networking library, don't have to run anything at all, and it should be up majority of the time. [/QUOTE] That's pretty bitchin, well done [QUOTE=xAustechx;25732886]Cuz I can't blend colors together fur shit.[/QUOTE] Design your interface/style in photoshop, where you can quickly sketch up multiple prototypes and once you have a good one transfer it to images and code? That's how I do it atleast
Working on some dynamic lighting [IMG]http://i54.tinypic.com/14cskdh.png[/IMG] Green represents the light (will add fade and make a more sensible colour later) The bottom two points of the red shape are the corners of whatever object would be causing a shadow (havent gotten around to the actual shape-light collision properly yet, but shouldnt take long) Red shape represents area that is cut out of circle (shadow)
[QUOTE=r4nk_;25732898]That's pretty bitchin, well done Design your interface/style in photoshop, where you can quickly sketch up multiple prototypes and once you have a good one transfer it to images and code? That's how I do it atleast[/QUOTE] Thanks : ) Also good idea. I'll try it.
-snip- (Wrong Thread)
[QUOTE=r4nk_;25722340]Looking great, nice to see a rouglike with some graphics up in this bitch[/QUOTE] Plus, external tileset support.
[QUOTE=xAustechx;25732669]I haven't really been programming too much today, but right now I changed the master score server. Before it was a C++ program which is retarded because I'd have to run the program on my computer 24/7. Which would mean keeping my computer on 24/7. Fuck no. Now it's controlled over my website and using sfml's http part of the networking library, don't have to run anything at all, and it should be up majority of the time. Gonna fix some bugs, polish the game a little more, and then an update should be available soon. :[/QUOTE] 1. Learn something (anything). 2. Use it for everything. 3. ... 4. PROFIT! Something new, please.
[QUOTE=Rohans;25734187]1. Learn something (anything). 2. Use it for everything. 3. ... 4. PROFIT! Something new, please.[/QUOTE] Nice agreeing with yourself. Did it cross your mind that he's NOT doing this for your amusement?
[QUOTE=Rohans;25734187]1. Learn something (anything). 2. Use it for everything. 3. ... 4. PROFIT! Something new, please.[/QUOTE] Uh, what? 0.o Edit: Nice one post, did you make an account just to talk about me? :D [media]http://i53.tinypic.com/1zwz2uv.jpg[/media]
Not much to see but im thinking a hack'n'slash game. Think its doable? its my first sfml/c++ project. btw Joshy isnt about is he? i have a grid :v: just there to help me with the positioning and because i wanted to :P [img]http://img823.imageshack.us/img823/6080/50830761.png[/img] Also strange how the FPS has dropped about 1/3 on linux compared to windows
Sorry, you need to Log In to post a reply to this thread.