• What are you working on?
    1,001 replies, posted
[QUOTE=nullsquared;15946264]Quick video with buggy scaling portals: [media]http://www.youtube.com/watch?v=R0UJSVid0wM[/media][/QUOTE] A closed beta anytime soon? :D
[QUOTE=Sophei;15946591]can you grab the object through the portal [img]http://imgkk.com/i/2et2r1tl.png[/img] that one. Because i remember in the old engine the object would 'snap' around if you moved the object into a portal while still grabbing it.[/QUOTE] Oh. As of right now, you can't. Perhaps in a later version. [editline]05:17PM[/editline] [QUOTE=nos217;15946482]That looks amazing. Why not blur the edge in the portal? That was texture differences will blend better etc.[/QUOTE] No point to blur the edge. Better to just make it seamless the way it's supposed to be. The "darker" edge you see is actual buggy normals in the portal frame, it can be fixed with a modeling app but my partner svenstaro (does all the art) is not online right now to fix it.
If it's any consolation, the light travelling through the portal in that situation would fuck up in real life too.
I'm currently learning about sdl_net. But I can't find any good tutorials
SDL_Net? Never heard of it. What's the difference?
It's for .net... thats the difference.
I think it's a library he is talking about.
oh, there's sdl_net for networking too?
Just a quick question: How can I get one character from a file and assign it to something? I have been using: [code]file>>string;[/code] to get the whole file, but how can I make it so that "string" only gets the very first character in the file? Or better yet, the first integer?
[code] // first character char c; file >> c; // first integer int i; file >> i; [/code]
But then wouldn't that put the entire file into "i" if the whole file is made up of numbers? [editline]11:02PM[/editline] Since that's what I've been doing all along.
one integer can only hold one integer
[QUOTE=nos217;15947760]But then wouldn't that put the entire file into "i" if the whole file is made up of numbers? [editline]11:02PM[/editline] Since that's what I've been doing all along.[/QUOTE] You mean a file like this? [code] 43958349573454328573275732453225423543253245325435(more integers here)435325 [/code] Then yes. In which case, use a char. Which is technically a number which can go from -127 to 127 if signed or 0-255 if unsigned. But the file will treat it as a single character, so in the above example you'd get '4'. Just remember that '4' != 4. To get the actual number, you can do something like this: [code] char firstDigit; file >> firstDigit; assert(firstDigit >= '0' && firstDigit <= '9'); // make sure it's a number int num = firstDigit - '0'; [/code]
That's exactly what I need. Thanks a lot. [editline]11:07PM[/editline] I'm only using 1 and 0. [editline]11:08PM[/editline] Hey wait actually, I can't do that, my whole project has been relying on those being integers :/. [editline]11:09PM[/editline] Could I use a bool, since booleans are essentially 1 and 0 aren't they? [editline]11:11PM[/editline] This is my loadmap function: [cpp]void loadmap() { std::cout << "Loading map!\n"; std::ifstream mapstream; mapstream.open("map1.map"); for(int yload=0; yload<=59; yload++) { for(int xload=0; xload<=79; xload++) { mapstream>>drawarray[xload][yload]; } } std::cout << "Map successfully loaded wooooo!\n"; mapstream.close(); }[/cpp] See what I mean?
What type is drawarray?
int.
[QUOTE=nullsquared;15947820]In which case, use a char. Which is technically a number which can go from -127 to 127 if signed or 0-255 if unsigned. But the file will treat it as a single character, so in the above example you'd get '4'. [b]Just remember that '4' != 4.[/b] To get the actual number, you can do something like this: [code] char firstDigit; file >> firstDigit; assert(firstDigit >= '0' && firstDigit <= '9'); // make sure it's a number int num = firstDigit [b]- '0'[/b]; [/code][/QUOTE] You're missing certain parts. (You -> nos217, not nullsquared)
What? I'm not using that method at the moment, since I'm using integers not characters.
What does the file look like and the read input?
Here's my readwrite header: [cpp]#ifndef READWRITE_H #define READWRITE_H #include <fstream> void loadmap() { std::cout << "Loading map!\n"; std::ifstream mapstream; mapstream.open("map1.map"); for(int yload=0; yload<=59; yload++) { for(int xload=0; xload<=79; xload++) { mapstream>>drawarray[xload][yload]; } } std::cout << "Map successfully loaded wooooo!\n"; mapstream.close(); } void savemap() { std::ofstream mapstreaml; mapstreaml.open("map1.map"); for(int ysave = 0; ysave <= 59; ysave++) { for(int xsave = 0; xsave <= 79; xsave++) { mapstreaml<<(drawarray[xsave][ysave]); } } mapstreaml.close(); } #endif[/cpp] When I save a map with one filled square at the start and 3 at the end, the file looks like this: [code]100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111[/code] I want each of those bits to equate to one of drawarray[][]. But, when I call loadmap(), it sets drawarray[0][0] to the entire file. I want to stop it doing that.
[QUOTE=nullsquared;15946264]Quick video with buggy scaling portals: [media]http://www.youtube.com/watch?v=R0UJSVid0wM[/media][/QUOTE] Interesting how that might work as a gameplay mechanic. Namely with the player moving through the portals.
It's not hard. Read a char, then convert the char into an int. Bear in mind that the char is gonna be a char, so it will be '1' not 1. So do what everyone has been telling you to do in the last 7 posts and convert it.
Holy shit holy shit holy shit. It works. Thanks a lot guys! [editline]11:44PM[/editline] I just changed "int drawarray[80][60]" in my declarations to "char drawarray[80][60]". I'm so damn stupid. I should've used a boolean actually. [editline]11:44PM[/editline] Now to get on to coding that straight line tool someone suggested :).
I created a simple "grayscale image TO ascii" convertor. [img]http://upload.namelezz.net/downloader.php?file=4991312_successfulconvertion.png[/img] And no, I don't even play Halo 3. This image was one of the first and best results on Google. It's pretty good because all the different parts look "separated".
[QUOTE=AtomiCal;15946893]I'm currently learning about sdl_net. But I can't find any good tutorials[/QUOTE] [url]http://cs-sdl.sourceforge.net/index.php/Main_Page[/url]
I think I'll just rewrite the whole thing [URL=http://www.cubeupload.com][IMG]http://www.cubeupload.com/files/7ffa001.gif[/IMG][/URL] The yellow line kind of shows what it should be (I have no idea where it came from)
Haha what.
Individual lines can be made invisible now. Less eyerape, but I'm still working on the graphics. [img]http://www.kylegar.net/stuff/lines.PNG[/img]
[QUOTE=nos217;15945467]Hehe, is that using the mouse? For me there was a whole world of differency trying to get it to work with the mouse instead of keyboard. [editline]09:16PM[/editline] I mean the map editor. [editline]09:17PM[/editline] Oh yeah and is it actually holding which blocks are being used in an array? [editline]09:17PM[/editline] Sorry I just find it interesting since we're doing roughly the same thing.[/QUOTE] Actually, yeah, I'm using a mouse. What I'm doing is I'm using a generic "grid" system where you can pass a simplified grid position or a pair of coordinates and you'd get the other. When a mouse clicks somewhere, it's coordinates are sent to the "grid helper" which runs through the entire array (that's how I handle simple grid-position-to-coordinate work, I just pass the simplified grid location on and use it as a subscript) and finds the number stored with the least difference and uses that as the "grid" position - which then happily gets passed on to the actual "matrix" controller itself which increments the value at bob[grid value x][grid value y] - to render it, the "draw" function then runs through bob finding out how many squares it has to render (let's say anything with a value over zero) and then makes a dynamic array of type GenericSquare (let's keep it like that, it's another helper function that I wrote that handles rendering and repositioning of blocks according to simplified grid positions) [number of squares which I have to render], and then goes through bob and assigns a position and color to each block in the array of blocks based on the subscript and the value - hopefully the number of blocks I have to render in the dynamic array will match the number of values in bob that indicate they *have* to be rendered. It's doing that for every frame - thank god SFML's drawing functions are bunged out on top of OpenGL. Actually, a better word would be "tile engine".
[img]http://www.kylegar.net/stuff/coollines.PNG[/img] twas a cool bug.
Sorry, you need to Log In to post a reply to this thread.