Puddle World rendering

8 views
Skip to first unread message

W Bradley Knox

unread,
Jan 9, 2011, 3:33:29 PM1/9/11
to rl-li...@googlegroups.com
Hi, Brian. I'm trying to adjust visualization in Puddle World, and
I've noticed that PuddleMapComponent.render() is called exactly once
per minute, which is way too seldom. I've spent a bit of time trying
to track down the location of this slowdown but haven't yet succeeded.
Do you know where to look?

Thanks,
Brad

Brian Tanner

unread,
Jan 9, 2011, 4:31:50 PM1/9/11
to rl-li...@googlegroups.com
One per minute? That's weird. It's coded to draw one time and never
again, unless I'm confused about what code we're talking about:
http://code.google.com/p/rl-library/source/browse/trunk/projects/environments/puddleWorld/src/org/rlcommunity/environments/puddleworld/visualizer/PuddleMapComponent.java?r=1335

Anyway, this was coded this way because the map never changes, so it
would be wasteful to redraw it more often. This can be redrawn at a
different interval using either a time-based value, or at each step,
or depending on which events are sent to it, etc. Just look at the
update method at the end of the file, and let me know if it's not
clear how it works.

> --
> You received this message because you are subscribed to the Google Groups "rl-library" group.
> To post to this group, send email to rl-li...@googlegroups.com.
> To unsubscribe from this group, send email to rl-library+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rl-library?hl=en.
>
>

--
Brian Tanner
Ph.D Student
University of Alberta
br...@tannerpages.com

W Bradley Knox

unread,
Jan 9, 2011, 4:59:38 PM1/9/11
to rl-li...@googlegroups.com
I didn't realize that the update() method was indirectly calling
render(). Knowing that, I was able to quickly set it up how I want. So
thanks!

I guess that leaves the once-per-minute updates as a mystery. I set my
stopwatch and checked, so it definitely happened. But I've got the
rendering working now (with the agent showing), so I'm happy.

Brad

Brian Tanner

unread,
Jan 9, 2011, 5:17:24 PM1/9/11
to rl-li...@googlegroups.com
WAIT! It doesn't.

It calls theChangeListener.vizComponentChanged(this);

But that call should indirectly make a render happen.

Update can be called several times per step (depending on how you are
running the experiment) so you might want to check the object type and
only call the update (which calls the render which is not super cheap)
on every invocation. One fairly efficient way to do it is to only
draw every time step. This is pretty straightforward and is done in
Mountain Car, look at these two:

Update function method:
http://code.google.com/p/rl-library/source/browse/trunk/projects/environments/mountainCar/src/org/rlcommunity/environments/mountaincar/visualizer/CarOnMountainVizComponent.java?r=1335

updateAgentState method:
http://code.google.com/p/rl-library/source/browse/trunk/projects/environments/mountainCar/src/org/rlcommunity/environments/mountaincar/visualizer/MountainCarVisualizer.java?r=1335

Good luck!

W Bradley Knox

unread,
Jan 9, 2011, 8:50:18 PM1/9/11
to rl-li...@googlegroups.com
Thanks for the point about the update frequency. I'll keep an eye on that.
Reply all
Reply to author
Forward
0 new messages