The Dink Network

Raycating

January 13th 2013, 02:31 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
HAs anybody tried writing a raycating algorithm in dinkC?
After reading this I think it might be possible to make an untextured version... but it would be painful to write, probably slow... and kind of pointless XD
January 13th 2013, 02:43 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Oh, I forgot you can't do proper math in dinC >-<
January 13th 2013, 03:16 PM
goblins.gif
If someone was determined enough it "might" be possible. As far as I know though, Dink doesn't have proper drawing scripts, so one would have to make their own using sprites and/or trim. Sounds very painful.

As for proper math, the different lines can be separated. Things like Sqrt and precise division might be feasible, but if I'm not mistaken variables would need to be stored at multiplied values and then divided any time they are used, to make calculations more accurate since Dink can't deal with decimals.

If it is possible, it would be a whole lot harder to do than in a real programming language. And I don't think people will take advantage of the idea much since it's so complex to do in Dink and also so different from the normal game play.

Thanks for the link though, it's a very good read.
January 13th 2013, 04:12 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Yeah you could place sprites 1px wide and 420px (i think that's the size of the playing area) high and then trim it in the script (you can do that right? Haven't used dinkC in years).

And the math would be hell without squareroot or exponents.. and lack of floats.

It would be really cool though
January 13th 2013, 06:22 PM
fairy.gif
Someone
Peasant He/Him Australia
 
My deterrent for trying something 3d/pseudo 3d is lack of sine function in dinkc. Unless sine is added or there is a decent approximation we can do in dinkc I don't think it is possible. With sine it could probably be done. Without sine a crappy version is probably possible but it would be really really bizarre and might make people feel sick trying to play it!
January 13th 2013, 06:31 PM
duck.gif
Didn't redink1 add some math functions to DinkC, including sine? The DinkC reference covers them.
January 13th 2013, 08:25 PM
goblins.gif
Yes, trim can be adjusted for in script, so that's probably how you'd make your own drawing code.

As for sin, cos, etc functions they are listed in one Dink reference I have and not the other. I haven't used them personally but my guess is they exist and work but return/take a whole number. Therefore It is probably possible to do... Just a lot of effort.
January 13th 2013, 09:09 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
I remember the trig functions being in the reDink engine, and perhaps in one of the early 1.08 versions, but as Dink doesn't have floats, the only thing it'd return would be 1, 0, or -1.

A function math_cos(int &angle, int &mult); (ditto with sin, tan, etc.) which would multiply by &mult before converting to an integer would be more useful. Sadly, it's not there. Shouldn't be too difficult to add, though.
January 14th 2013, 02:24 AM
custom_iplaydink.gif
Iplaydink
Peasant He/Him Sweden
Hmm.. 
Also the maximum spawnable sprites (like 400, right?) is not enough for one for every x-value.. You'd have to lower the resulotion..