Melly
|
|
« on: October 09, 2008, 04:12:28 AM » |
|
TUTORIAL REQUESTS GO HERE. I request a C++ game-making tutorial!Please? Alec said he'd do it.
|
|
« Last Edit: October 10, 2008, 02:14:45 PM by Derek »
|
Logged
|
|
|
|
diwil
|
|
« Reply #1 on: October 09, 2008, 05:52:42 AM » |
|
I'll have enough time in a couple of weeks, and I'll start my YouTube video-tutorial series that'll base on my engine. Everything will be exposed! And hopefully, by the end of it, people will be able to make a lightning-fast, flexible 2D engine/API/framework. ...Maybe.
|
|
|
Logged
|
|
|
|
Hideous
|
|
« Reply #2 on: October 09, 2008, 07:17:36 AM » |
|
Moosader has a cool Allegro platform tutorial on YouTube. Except her map editor breaks for a lot of people, apparently.
|
|
|
Logged
|
|
|
|
___
Vice President of Marketing, Romeo Pie Software
Level 10
|
|
« Reply #3 on: October 09, 2008, 07:30:22 AM » |
|
Yes. I've spent months trying to figure out the best way to make an engine properly. Weeeeee!
|
|
|
Logged
|
|
|
|
FARTRON
|
|
« Reply #4 on: October 09, 2008, 07:33:10 AM » |
|
I'd definitely like to see more tutorials on tile engines and such, whatever the language.
|
|
|
Logged
|
Everything that was once directly lived has receded into a representation. - debord
|
|
|
increpare
Guest
|
|
« Reply #5 on: October 09, 2008, 07:36:34 AM » |
|
I've been meaning to start a game-loop thread for a while...(not specifically c++, though).
(my c++ isn't confident or neat enough to give a tutorial in).
Can you already do games stuff in plain ol' C melly?
Fartron: what sort of tile engines are you thinking about? There are already plenty of tile engine tutorials on the web, though; someone's probably already written something to suit your needs.
|
|
|
Logged
|
|
|
|
Hideous
|
|
« Reply #6 on: October 09, 2008, 07:46:31 AM » |
|
I'd like to see a tetris tutorial in c++, actually. Thinking about how the rotation would work has had my brain stumped for a long time.
|
|
|
Logged
|
|
|
|
Cymon
|
|
« Reply #7 on: October 09, 2008, 07:52:44 AM » |
|
I hate requests like then when I'm contemplating the same thing. And Hideous. I don't know if it would help you, but you can always peek at my code for alleytris, tho the rotation aspect ended up being a bit obfuscated.
|
|
|
Logged
|
|
|
|
Hideous
|
|
« Reply #8 on: October 09, 2008, 07:58:48 AM » |
|
I actually did look at alleytris before, but didn't really learn anything from it.
|
|
|
Logged
|
|
|
|
FARTRON
|
|
« Reply #9 on: October 09, 2008, 08:52:12 AM » |
|
Fartron: what sort of tile engines are you thinking about? There are already plenty of tile engine tutorials on the web, though; someone's probably already written something to suit your needs.
There aren't a lot of good ones. I guess I'm picturing something on the general side, the ins-and-outs of designing engines. I want to have a better idea of how to make them from scratch in various languages, and with various goals (roguelike, platformer, topdown shooter, etc) which I don't get from a lot of the copy-paste tutorials I've seen.
|
|
|
Logged
|
Everything that was once directly lived has receded into a representation. - debord
|
|
|
muku
|
|
« Reply #10 on: October 09, 2008, 08:55:14 AM » |
|
Rotation for Tetris pieces is pretty easy. If you have the coordinates of each each block in the piece in a list, you just go through the list and transform every pair of coordinates like:
(x, y) -> (-y, x)
That corresponds to a 90 degree rotation.
That's the gist of it, at least.
|
|
|
Logged
|
|
|
|
Melly
|
|
« Reply #11 on: October 09, 2008, 01:39:00 PM » |
|
Can you already do games stuff in plain ol' C melly?
Nope.
|
|
|
Logged
|
|
|
|
Cymon
|
|
« Reply #12 on: October 09, 2008, 06:16:07 PM » |
|
I actually did look at alleytris before, but didn't really learn anything from it.
Can't blame you for that. Rotation for Tetris pieces is pretty easy. If you have the coordinates of each each block in the piece in a list, you just go through the list and transform every pair of coordinates like:
(x, y) -> (-y, x)
That corresponds to a 90 degree rotation.
That's the gist of it, at least.
It's not quite that easy. Or at least if it is I went the long way on Alleytris. The problem with that idea is it rotates around a center point at the corner. For the panda of it I'll try to recreate the thought process that ended in the rx function in alleytris. What you need to do is adjust how you're reading the data, so when you write it the normal way it appears rotated. In otherwords for a 4x4 block 90 o clockwise rotation means you start in the lower left corner and read bottom to top. For 180 o start in the lower right and read right to left, bottom to top. For 270 o start in the upper left and read top to bottom, right to left. You following so far? So when I was writing alleytris I started doing some drawings and ended up with this table and stared at it until I got the last line: X,Y | 90 | 180 | 270 | (0,0) | (0,4) | (4,4) | (4,0) | (1,0) | (0,3) | (3,4) | (4,1) | (1,1) | (1,3) | (3,3) | (3,1) | (4,4) | (4,0) | (0,0) | (4,0) | (x,y) | (y,4-x) | (4-x,4-y) | (4-y,x) |
So I figured I needed 2 rotations functions which would take the rotation given (which by then I had simplified to 0,1,2,and 3) and the x, y coordinate and return either the x or y. At first I used a case statement, and that's when I noticed the similarity between rx (for rotation x) and ry (for rotation y), that was that ry(rot,x,y) was the same as rx(rot+1,x,y). So deleted ry (which in retrospect I should have kept and just rewritten ry to call rx) and changed all calls to ry to calls to rx. Then someone on the cprogramming forums pointed out a way to do away with the case statement and I ended up with the current version of rx : int rx (int r, int y, int x) { /* Used for piece rotation. */ int n;
n = (r % 2 ? y : x); if(r / 2) n = 3 - n; return n; } clip() and drawpiece() use rx to read the data rotated as it draws the piece. Now you know why alleytris was not as instructive. It was the tail end of a long thought process which works, but doesn't educate much. So even if alleytris wasn't informative I hope this was.
|
|
|
Logged
|
|
|
|
muku
|
|
« Reply #13 on: October 09, 2008, 06:23:44 PM » |
|
I actually did look at alleytris before, but didn't really learn anything from it.
Can't blame you for that. Rotation for Tetris pieces is pretty easy. If you have the coordinates of each each block in the piece in a list, you just go through the list and transform every pair of coordinates like:
(x, y) -> (-y, x)
That corresponds to a 90 degree rotation.
That's the gist of it, at least.
It's not quite that easy. Or at least if it is I went the long way on Alleytris. The problem with that idea is it rotates around a center point at the corner. It rotates the piece around (0,0), so if you lay out your pieces so that they have their center at (or around) (0,0), you should be fine. Alternatively, rotating around an arbitrary point is as simple as translating, applying above rotation formula, and translating back. Also, if you don't want to calculate the formulae for rotating by 180 and 270 degrees, you can simply call your 90 degree rotation function multiple times.
|
|
|
Logged
|
|
|
|
|
Hideous
|
|
« Reply #15 on: October 11, 2008, 04:25:19 AM » |
|
I request an SFML tutorial. Because I need to switch to something faster/more working than allegro.
|
|
|
Logged
|
|
|
|
Mr. Yes
|
|
« Reply #16 on: October 11, 2008, 04:47:13 AM » |
|
I request an SFML tutorial. Because I need to switch to something faster/more working than allegro.
YES. I would like this, too! Though I'm not sure how many people here use it.
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #17 on: October 11, 2008, 05:24:27 AM » |
|
I request an SFML tutorial. Because I need to switch to something faster/more working than allegro.
Faster than allegro? What were you doing that was slowing allegro down so much? Also: what wasn't working with it for you? Also: have you checked out the official sfml tutorials yet?
|
|
« Last Edit: October 11, 2008, 06:01:45 AM by increpare »
|
Logged
|
|
|
|
Hideous
|
|
« Reply #18 on: October 11, 2008, 05:35:17 AM » |
|
I just noticed that allegro is slow, that's all. And my programs haven't worked for two people thus far.
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #19 on: October 11, 2008, 06:11:57 AM » |
|
I just noticed that allegro is slow, that's all. Really? I'm surprised at this. Unless you're doing quite complicated things it should be reasonably zippy. What sort of stuff were you doing? (allegro does have its own troubles but, for me, speed was never one of them (even back on my old pentium 75)). What I mean to say is that it's unfortunate that you're having these troubles. And my programs haven't worked for two people thus far. I haven't ever had portability issues with allegro in particular, and I have used it reasonably extensively. Has anyone else? That said, until the new version of allegro is out, for performance-intensive things I'm going to go with SDK. Though, I'm very tempted to switch to GLFW, because I'm only using opengl, but...I'll resist the urge to change in favour of actually getting the game written
|
|
|
Logged
|
|
|
|
|