|
echinopsis posted:dont post
|
# ? Jan 14, 2015 12:11 |
|
|
# ? Apr 18, 2024 20:11 |
|
screenshot of my starfield (made in the most moronic way possible, but makes it look super awesome and work even better) and the beginnings of my procedural level gen.
|
# ? Jan 14, 2015 13:08 |
|
Doc Block posted:You have to keep track of which direction you're casting the ray in relative to the world. If the ray was going left and up when it hit then round both X and Y down to get the correct tile coordinates. If it was going right and up, then round X up and Y down. If it was going left and down then round X down and Y up. If the ray was going right and down, round both X and Y up. hmm, well I know the angle that the ray was cast at and I know whether my intersection is vertical or horizontal (X or Y is always a whole number) but it doesn't seem to be adding up. a ray moving at an angle of 234 degrees should be going left and down (I pointed my player in that direction and went forward and that's what happened to my coordinates) but flooring x and ceiling y doesn't give me a valid tile and it draws Tazz. I set up the whole set: code:
graphics are hard
|
# ? Jan 14, 2015 20:59 |
|
is it possible for rotation + angle to be outside 0-360 degrees? i haven't looked at the full code yet how is the tilemap laid out, exactly? looking at the floors and ceils in that piece of code i'd switch around the ones in the x-coordinate, since it kind of looks like a ray going from the origin to the right (an angle between -180 degs and +180 degs) will look at the texture on the right-hand side of the tile, since it's getting ceil'd, and vice versa
|
# ? Jan 14, 2015 21:39 |
|
hows my spare time project doing? glad you asked! https://kyber.ninja is looking a lot better. I've spent some (tens of) hours on it and finally fixed the horrible database I first made, improved a lot of stuff and have been gathering the latest relevant news to the site to have content. it's waiting to be bumrushed by hundreds of active users any minute now!. it also got some more memory and a new free "home" behind cloudflare. thanks cloudflare! It might be a piece of poo poo php/bootstrap forum but at least it's mine!
|
# ? Jan 14, 2015 21:45 |
|
computer toucher posted:hows my spare time project doing? glad you asked! https://kyber.ninja is looking a lot better. I've spent some (tens of) hours on it and finally fixed the horrible database I first made, improved a lot of stuff and have been gathering the latest relevant news to the site to have content. it's waiting to be bumrushed by hundreds of active users any minute now!. it also got some more memory and a new free "home" behind cloudflare. thanks cloudflare! what is it and should i be an admin
|
# ? Jan 14, 2015 21:53 |
|
echinopsis posted:what is it and should i be an admin it's a web site for infosec stuff I made from scratch to teach myself some server & webapp janitoring. I got inspired on a SANS pentesting course to learn this poo poo to better be able to break it (when it's legitimate or asked for). Maybe if you register and post good poo poo and work hard some day you might get the office near the corner office?
|
# ? Jan 14, 2015 22:01 |
|
i know nothing about any of that poo poo
|
# ? Jan 14, 2015 22:13 |
|
echinopsis posted:nothing
|
# ? Jan 14, 2015 22:14 |
|
tl;dr: just read this for how to do a ray casting engine with multiple textures. There's also this series which doesn't have code samples but explains the math on how to do multi-height walls, as well as textured floors and ceilings.
Doc Block fucked around with this message at 04:32 on Jan 15, 2015 |
# ? Jan 14, 2015 22:37 |
|
i want to write a raycaster now
|
# ? Jan 14, 2015 22:52 |
|
LOL I tried to download PyGame so I could help out Luigy Thirty (he rewrote the article's raycaster in Python) and the PyGame website is not only eye-gougingly ugly, the whole site is broken as gently caress. There isn't a single download that's post-2010. Welp.
|
# ? Jan 14, 2015 22:56 |
|
pip install pygame hth
|
# ? Jan 14, 2015 23:01 |
|
Thx except that's broken, I don't have SDL installed. LOL this is some lovely Linux and/or Ruby dependency hell poo poo. edit: brew install sdl etc will hopefully fix it. I hope you appreciate that I'm dirtying my precious Appel Mackintosh eyeMac with awful Linux-version of DirectDraw so I can install PyGame so I can help you out, Luigy Thirty
|
# ? Jan 14, 2015 23:02 |
|
thats actually the same version on the site, guess they perfected it in 2009 and there's nothing more to be done
|
# ? Jan 14, 2015 23:05 |
|
e: double
Luigi Thirty fucked around with this message at 01:15 on Jan 15, 2015 |
# ? Jan 14, 2015 23:16 |
|
Doc Block posted:LOL I tried to download PyGame so I could help out Luigy Thirty (he rewrote the article's raycaster in Python) and the PyGame website is not only eye-gougingly ugly, the whole site is broken as gently caress. There isn't a single download that's post-2010. Welp. someone had (badly) ported it from JavaScript to Python, I cleaned up some of the code they made and pasted it into a new repo and yeah, that makes sense considering I figured out my X or Y was always off by one but I couldn't make the connection to that being the next tile the ray would pass through. I can go hook that up later
|
# ? Jan 14, 2015 23:31 |
|
Reading through your Python code, it seems you are casting two separate rays or some poo poo, IDK. I hate "Pythonic" code, it's always so unclear.
|
# ? Jan 15, 2015 00:05 |
|
What the code should do is just have the raycaster return the X and Y of the block it hit, so you don't have the big if-else statement checking the angle of the ray. Especially since for some cases it won't ever be right.
|
# ? Jan 15, 2015 00:08 |
|
I didn't touch the actual ray casting itself other than making it semi-readable instead of unreadable.
|
# ? Jan 15, 2015 00:31 |
|
Luigi Thirty posted:hmm, well I know the angle that the ray was cast at and I know whether my intersection is vertical or horizontal (X or Y is always a whole number) but it doesn't seem to be adding up. a ray moving at an angle of 234 degrees should be going left and down (I pointed my player in that direction and went forward and that's what happened to my coordinates) but flooring x and ceiling y doesn't give me a valid tile and it draws Tazz. I set up the whole set: ok I changed this code:
|
# ? Jan 15, 2015 00:40 |
|
Doc Block posted:What the code should do is just have the raycaster return the X and Y of the block it hit, so you don't have the big if-else statement checking the angle of the ray. Especially since for some cases it won't ever be right. aha, i dug through it and it figures this out when retrieving wall height but doesn't save it anywhere. now it writes down the tile that the point is inside and the texture lookup system checks that to find the texture. Tazz has been banished. Luigi Thirty fucked around with this message at 02:12 on Jan 15, 2015 |
# ? Jan 15, 2015 02:10 |
|
Ok, good. Still, this renderer really sucks and is super slow.
|
# ? Jan 15, 2015 02:25 |
|
it is extremely slow but i haven't broken out the profiler on it. it sure does look like 1994 though
Luigi Thirty fucked around with this message at 02:35 on Jan 15, 2015 |
# ? Jan 15, 2015 02:33 |
|
Creating a new array of Point objects for every slice is probably a big one. Having the map etc be a 2D array instead of a 1D array. Does any of it use NumPy/CPython/Whatever math or is it all Python? The fact that moving drops the framerate down to about 12, and then it shoots back up to 28-30 when I let go is also LOL tastic.
|
# ? Jan 15, 2015 02:43 |
|
using numpy for the math would probably be a million times faster since it has support for things like statically typed multidimensional arrays. the original python implementation of the map was a dict full of tuples containing an int lol
Luigi Thirty fucked around with this message at 02:53 on Jan 15, 2015 |
# ? Jan 15, 2015 02:50 |
|
Doc Block posted:Reading through your Python code, it seems you are casting two separate rays or some poo poo, IDK. I hate "Pythonic" code, it's always so unclear. curious why is pythonic code so unclear to you when pythonic code means basically clarity
|
# ? Jan 15, 2015 03:26 |
|
maybe the problem is you can't read?
|
# ? Jan 15, 2015 03:26 |
|
echinopsis posted:curious why is pythonic code so unclear to you when pythonic code means basically clarity pythonic is a dumb adjective but yeah saving some special cases (I'm looking at for-else bullshit) python code is supposed to be clear instead of too clever
|
# ? Jan 15, 2015 03:51 |
|
since when? when i was learning python a few years ago pythonic basically meant "the clever solution" and all "pythonic" code that i saw was full of lambdas and maps and poo poo when there didn't need to be.
|
# ? Jan 15, 2015 04:14 |
|
well isn't that pythonic? don't you think? a little too pythonic?
|
# ? Jan 15, 2015 04:15 |
|
still dont get lambdas at allllll
|
# ? Jan 15, 2015 04:15 |
|
Trig Discipline posted:well isn't that pythonic? don't you think? lol Jonny 290 posted:still dont get lambdas at allllll
|
# ? Jan 15, 2015 04:16 |
|
yeah my brain keeps bouncing off of large chunks of functional programming going nopenopenopenope
|
# ? Jan 15, 2015 04:17 |
|
Doc Block posted:since when? when i was learning python a few years ago pythonic basically meant "the clever solution" and all "pythonic" code that i saw was full of lambdas and maps and poo poo when there didn't need to be. since forever man. go read pythonic means "not clever". http://blog.startifact.com/posts/older/what-is-pythonic.html tjats from 2005 pythonic means it should be very clear. python by itself makes this easy coz python is the best and is very easy to read and understand quote:To be Pythonic is to use the Python constructs and datastructures with clean, readable idioms. It is Pythonic is to exploit dynamic typing for instance, and it's definitely not Pythonic to introduce static-type style verbosity into the picture where not needed. To be Pythonic is to avoid surprising experienced Python programmers with unfamiliar ways to accomplish a task.
|
# ? Jan 15, 2015 04:18 |
|
you aren't expected to understand this
|
# ? Jan 15, 2015 04:20 |
|
Jonny 290 posted:still dont get lambdas at allllll functional programming doesn't work with my brain. saw somebody on twitter or wherever say that functional programming fits their mental model better and i was like
|
# ? Jan 15, 2015 04:21 |
|
echinopsis posted:since forever man. go read nowhere does it say pythonic means very clear. while the article doesn't outright encourage writing unreadable code, it only says that it should be written the way an "experienced" python programmer would write it, and also that you should use every imaginable language feature. so yeah, try to be clever and figure out a way that particular thing could be done with lambdas or something instead of a simple for-each block.
|
# ? Jan 15, 2015 04:31 |
|
what you're describing goes against everything I understand pythonic to mean, maybe I'm wrong but I suspect it's you who is wrong
|
# ? Jan 15, 2015 04:42 |
|
|
# ? Apr 18, 2024 20:11 |
|
ok here. it's just function sugar evidentlycode:
|
# ? Jan 15, 2015 04:57 |