Page 1 of 2
A rendering program in lua
Posted: Sat Sep 21, 2013 5:42 pm
by robly18
So I've been thinking about a problem which I won't discuss right now because it's of no relevance, but how I have been trying to solve it.
So here's what happened... I made a basic rendering software. You have a dot on a screen, and you can use code to make it move around. So far I made a basic physics engine with bouncy balls.
Anyway, I just thought I'd ask for an opinion on it. It's actually the first time I've done anything like it and I'd like feedback!
http://notepad.cc/robrender1
Plug this code into this:
http://www.lua.org/cgi-bin/demo
Right now the physics are... Buggy, to say the least. But I'm working on improving them.
So, give me your opinion! How's my rendering code skills?
Re: A rendering program in lua
Posted: Sat Sep 21, 2013 6:20 pm
by A Random Player
robly18 wrote:So I've been thinking about a problem which I won't discuss right now because it's of no relevance, but how I have been trying to solve it.
So here's what happened... I made a basic rendering software. You have a dot on a screen, and you can use code to make it move around. So far I made a basic physics engine with bouncy balls.
Anyway, I just thought I'd ask for an opinion on it. It's actually the first time I've done anything like it and I'd like feedback!
http://notepad.cc/robrender1
Plug this code into this:
http://www.lua.org/cgi-bin/demo
Right now the physics are... Buggy, to say the least. But I'm working on improving them.
So, give me your opinion! How's my rendering code skills?
Heh, cool! Though using a grid to display continuous data isn't exactly ideal

Re: A rendering program in lua
Posted: Sat Sep 21, 2013 7:31 pm
by robly18
A Random Player wrote:robly18 wrote:So I've been thinking about a problem which I won't discuss right now because it's of no relevance, but how I have been trying to solve it.
So here's what happened... I made a basic rendering software. You have a dot on a screen, and you can use code to make it move around. So far I made a basic physics engine with bouncy balls.
Anyway, I just thought I'd ask for an opinion on it. It's actually the first time I've done anything like it and I'd like feedback!
http://notepad.cc/robrender1
Plug this code into this:
http://www.lua.org/cgi-bin/demo
Right now the physics are... Buggy, to say the least. But I'm working on improving them.
So, give me your opinion! How's my rendering code skills?
Heh, cool! Though using a grid to display continuous data isn't exactly ideal

Well, how do you suggest I make a way to display the information reasonably in the form of ASCII?
Re: A rendering program in lua
Posted: Sat Sep 21, 2013 9:08 pm
by A Random Player
robly18 wrote:A Random Player wrote:robly18 wrote:So I've been thinking about a problem which I won't discuss right now because it's of no relevance, but how I have been trying to solve it.
So here's what happened... I made a basic rendering software. You have a dot on a screen, and you can use code to make it move around. So far I made a basic physics engine with bouncy balls.
Anyway, I just thought I'd ask for an opinion on it. It's actually the first time I've done anything like it and I'd like feedback!
http://notepad.cc/robrender1
Plug this code into this:
http://www.lua.org/cgi-bin/demo
Right now the physics are... Buggy, to say the least. But I'm working on improving them.
So, give me your opinion! How's my rendering code skills?
Heh, cool! Though using a grid to display continuous data isn't exactly ideal

Well, how do you suggest I make a way to display the information reasonably in the form of ASCII?
Print the positions?

6
9
11
12
12
11
9
6
2
Other than that, not sure. You could try to use a larger box, or try a "graph paper" approach, plotting position vs time:
But that's quite complicated. You could rotate CCW 90°, and get this:
which looks (and is coded) somewhat better. In this case, you just need to concatenate a certain number of spaces.
But these methods can only show motion in one dimension. To keep two dimensions, I would try putting a border around the boxes, or maybe other "landmarks", so our eyes can easily move between the pictures and see the locations of the ball:
Code: Select all
+-------+
| |
| \ / |
| |
| x |
| |
| / \ |
|O |
+-------+
+-------+
| |
| \ / |
| |
| x |
| O |
| / \ |
| |
+-------+
+-------+
| |
| \ / |
| |
| Ox |
| |
| / \ |
| |
+-------+
+-------+
| |
| \ / |
| |
| O |
| |
| / \ |
| |
+-------+
+-------+
| |
| \ / |
| |
| x |
| O |
| / \ |
| |
+-------+
Most of all, try sticking to integer positions and velocities, unless you have a very large resolution screen (in which case it's probably better to copy to notepad to view it)
(After reviewing it in notepad, I have to say that it looks somewhat better. I guess the tiny output box is slightly to blame.)
Re: A rendering program in lua
Posted: Sun Sep 22, 2013 8:24 am
by robly18
Hm. I like the landmarks idea. However, the position over time is something I'd rather not do. The problem I have in mind requires me to have a good view of the X and Y position over time, so...
But yeah, I might add those landmarks.
Re: A rendering program in lua
Posted: Tue Sep 24, 2013 11:30 am
by testtubegames
Interesting question. I agree, it's kinda tough to picture how the objects are moving when it's separated into a bunch of frames. Landmarks could work, but for cleanliness, I might suggest putting a ghost trace on the ball.
So the ball is represented by some significant character. Then behind it is a trail of ghosts... some less significant characters (1, 2, or maybe even 3 steps-worth of ghosts).
My simplistic attempt at drawing it, using a capital 'O' trailed by asterisks:
------------------
| |
| O |
| * |
| * |
| * |
------------------
------------------
| |
| * O |
| * |
| * |
| |
------------------
------------------
| |
| * * |
| * O|
| |
| |
------------------
Edit: Spaces are weirdly (not) shown here, see Robly's response for a better looking version
Re: A rendering program in lua
Posted: Tue Sep 24, 2013 12:15 pm
by robly18
testtubegames wrote:Interesting question. I agree, it's kinda tough to picture how the objects are moving when it's separated into a bunch of frames. Landmarks could work, but for cleanliness, I might suggest putting a ghost trace on the ball.
So the ball is represented by some significant character. Then behind it is a trail of ghosts... some less significant characters (1, 2, or maybe even 3 steps-worth of ghosts).
My simplistic attempt at drawing it, using a capital 'O' trailed by asterisks:
Code: Select all
------------------
| |
| O |
| * |
| * |
| * |
------------------
------------------
| |
| * O |
| * |
| * |
| |
------------------
------------------
| |
| * * |
| * O|
| |
| |
------------------
That's a good idea, but I feel it would require a lot of variables. However, I'll try it when i think of a way to do it. Also, fixed your spaces.
Re: A rendering program in lua
Posted: Tue Sep 24, 2013 12:21 pm
by testtubegames
robly18 wrote:That's a good idea, but I feel it would require a lot of variables. However, I'll try it when i think of a way to do it. Also, fixed your spaces.
Ah, whoops, that's why there's a 'preview' button... and a 'code' block. Thanks for fixing it up so I don't look (as) crazy
Re: A rendering program in lua
Posted: Tue Sep 24, 2013 5:09 pm
by exfret
Why don't you go in and edit your post to place the code block in there?
Re: A rendering program in lua
Posted: Wed Sep 25, 2013 8:25 am
by robly18
exfret wrote:Why don't you go in and edit your post to place the code block in there?
Because then I'd look like an idiot who fixed up nothing
