POV-Ray : Newsgroups : povray.off-topic : New NearInfinity demo up Server Time
6 Sep 2024 19:18:31 EDT (-0400)
  New NearInfinity demo up (Message 11 to 20 of 25)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 5 Messages >>>
From: Darren New
Subject: Re: New NearInfinity demo up
Date: 14 Dec 2008 14:48:53
Message: <49456325$1@news.povray.org>
stbenge wrote:
>> That's very Zen.  With the fading trails, that's sort of like one of 
>> those rice-paper pads you write on with water.
> 
> I have no idea what you're talking about :)

http://www.amazon.com/Buddha-Board/dp/B0010TEFFQ/ref=pd_bbs_sr_1

It's a dark board with rice paper over it. When you paint with water, it 
leaves marks, but only till the water dries.

One I did as a java VADz a long time ago:
http://home.san.rr.com/dnew/ZenMaster.html

> Thank you for trying it! You're input is valuable, considering my 
> girlfriend could not get it working on her Vista x64 laptop. It may be a 
> screen/video driver problem though. 

Possibly. This has one of those high-end 5.0 Vista cards, a Radeon HD 4850.

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

From: Clarence1898
Subject: Re: New NearInfinity demo up
Date: 14 Dec 2008 16:40:00
Message: <web.49457c343f822f768b9825800@news.povray.org>
stbenge <THI### [at] hotmailcom> wrote:
> Hi everyone,
>
> Months ago I updated my NearInfinity demo, but never got around to
> posting it. It can be found here:
> http://www.caltel.com/~abenge/NearInfinity.zip
>
> It should look like this:
> http://www.caltel.com/~abenge/NIscreen.jpg
>
> There is no goal to the game. You just fly around in a near-infinite
> landscape. I would call it infinite, but even the best random number
> generators don't go on forever. The landscape is not different every
> time you start the program up. You can change the landscape's seed
> within an .ini file. To make it a little more interesting, there are six
> Easter eggs to find. They occur very rarely, and you get no reward for
> finding them; they are simply there. Look at ee.png for spoilers :) Keys
> are left, right, up and/or z. It has bouncy and smooth, but solid
> collision-detection.
>
> If you are running Windows, have DirextX 8.0 or above, and have some
> free time, could you download it and tell me what you think? With the
> default settings it should run at 60 FPS regardless on your monitor's
> refresh rate. I kept the logic separate from the frame rate, so it
> should work on your computer exactly as it does mine, as long as your
> computer isn't really old. It will skip frames to compensate if your
> computer is slow.
>
> I would like some feedback on a few things. What is your operating
> system? Does it work on Vista? What FPS are you getting? Do the default
> settings of 1280x960 fullscreen mode give you ultra-smooth scrolling?
> What about lower resolutions? You can change these and other settings
> within the NI.ini text file. If you decide to run in windowed mode,
> change dynamicFrameRate to method 2. You won't get the benefits of
> VSYNC, and it really shows.
>
> If for some reason I didn't upload the program with the default 1280x960
> resolution and VSYNC settings, change the values found in NI.ini to these:
> windowed=0
> screenMode=2
> dynamicFrameRate=3
>
>
> Thanks in advance!
>
> Sam

It works on Vista x64 on quad core, very smooth scrolling.
It fails on XP home x32 dual core amd.  Here is th elog file:

HGE Started..

HGE version: 1.70
Date: 14.12.2008, 16:32:00

Application: NearInfinity 2008 Sam Benge
OS: Windows 5.1.2600
Memory: 981480K total, 214936K free

D3D Driver: ati2dvag.dll
Description: ATI RADEON XPRESS 200 Series
Version: 6.14.10.6571
Can't find appropriate full screen video mode

Finishing..
The End.

Finishing..
The End.


It will work in 640x480 mode.


Interesting game, very good.

Isaac.


Post a reply to this message

From: stbenge
Subject: Re: New NearInfinity demo up
Date: 14 Dec 2008 19:39:16
Message: <4945a734@news.povray.org>
Darren New wrote:
> stbenge wrote:
>>> That's very Zen.  With the fading trails, that's sort of like one of 
>>> those rice-paper pads you write on with water.
>>
>> I have no idea what you're talking about :)
> 
> http://www.amazon.com/Buddha-Board/dp/B0010TEFFQ/ref=pd_bbs_sr_1
> 
> It's a dark board with rice paper over it. When you paint with water, it 
> leaves marks, but only till the water dries.

Sounds like a neat idea. I'm guessing this works because water tension 
causes the rice paper to stick to a black backing? Simple, effective, 
but possibly fragile for young ones :(

> One I did as a java VADz a long time ago:
> http://home.san.rr.com/dnew/ZenMaster.html

Pretty cool. There's a gap at the end of a drawing run if the mouse is 
moving too fast. I assume you used an array to hold the positions/states 
of each circle? It must be a big array because I never found the end.

>> Thank you for trying it! You're input is valuable, considering my 
>> girlfriend could not get it working on her Vista x64 laptop. It may be 
>> a screen/video driver problem though. 
> 
> Possibly. This has one of those high-end 5.0 Vista cards, a Radeon HD 4850.

Ack, HGE's hit-and-miss functionality is somewhat discouraging :(

Sam


Post a reply to this message

From: stbenge
Subject: Re: New NearInfinity demo up
Date: 14 Dec 2008 19:55:47
Message: <4945ab13@news.povray.org>
Clarence1898 wrote:
> stbenge <THI### [at] hotmailcom> wrote:
>> I would like some feedback on a few things.
> 
> It works on Vista x64 on quad core, very smooth scrolling.
> It fails on XP home x32 dual core amd.  Here is th elog file:
> ...
> Can't find appropriate full screen video mode
> 
> It will work in 640x480 mode.

Sounds like a simple video card shortcoming to me. I'll keep this in 
mind if I make another game. Low-resolution video modes should always 
work, so I'll have to keep new games at 640x480 or 320x240. A lot of 
people hate these lower resolutions, but for 2D games they seem to work 
well. Cave story, for instance, has a large fan base. It used a low 
resolution and the scrolling wasn't smooth at all. People still loved it 
because the game play more than made up for the lack of graphics quality.

> Interesting game, very good.

Thank you, Isaac. I would like to make enemies that you could kill, but 
using this method to do it is looking impossible. The stars and motes 
will always be the same if you go back to them, just like the landscape. 
It would be hard to do this with enemies, because the method I used 
doesn't allow me to change elements. They are all always static, though 
in the case of the motes it doesn't seem that way.

Sam


Post a reply to this message

From: Darren New
Subject: Re: New NearInfinity demo up
Date: 14 Dec 2008 22:19:00
Message: <4945cca4$1@news.povray.org>
stbenge wrote:
> Sounds like a neat idea. I'm guessing this works because water tension 
> causes the rice paper to stick to a black backing? 

Plus, the paper is thin enough that wetting it makes it more transparent.

> Simple, effective, but possibly fragile for young ones :(

Depends how young, I guess.

> Pretty cool. There's a gap at the end of a drawing run if the mouse is 
> moving too fast. I assume you used an array to hold the positions/states 
> of each circle? It must be a big array because I never found the end.

It is, of course, dynamically allocated. The fun thing is to compare the 
size of the .class file with what you could build by hand. VADz is an old 
technology to compress all kinds of interactive graphics down to a 
relatively tiny size - we could put online order forms in a banner ad 
smaller than most people could fit an advertisement in an animated GIF.

> Ack, HGE's hit-and-miss functionality is somewhat discouraging :(

It is strange. You'd think it would work or not. Maybe you're using some 
feature which has to be supported by the card to work?

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

From: Darren New
Subject: Re: New NearInfinity demo up
Date: 15 Dec 2008 19:28:33
Message: <4946f631$1@news.povray.org>
Warp wrote:
> std::vector<hgeSprite> tile;
> 
> tile.reserve(8*8);
> for(...)
>   for(...)
>     tile.push_back(hgeSprite(...));

Not that I'd recommend micro-optimization over readability, but isn't this 
going to be more inefficient than the other way? Doesn't this allocate a 
sprite on the stack, pass it to tile.push_back(), which then has to copy it 
to dynamically allocated memory anyway?

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

From: nemesis
Subject: Re: New NearInfinity demo up
Date: 15 Dec 2008 19:40:00
Message: <web.4946f8153f822f764d42da060@news.povray.org>
stbenge <THI### [at] hotmailcom> wrote:
> Who's going to trust my programs, now that my ignorance is known? I
> could always provide the source...

It's good to know you suck at least on something, Master.  Makes you... more
human. ;)

OTOH, it's a pretty good-looking "game" for someone still learning its C++
way...


Post a reply to this message

From: Warp
Subject: Re: New NearInfinity demo up
Date: 16 Dec 2008 12:20:04
Message: <4947e344@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> > std::vector<hgeSprite> tile;
> > 
> > tile.reserve(8*8);
> > for(...)
> >   for(...)
> >     tile.push_back(hgeSprite(...));

> Not that I'd recommend micro-optimization over readability, but isn't this 
> going to be more inefficient than the other way? Doesn't this allocate a 
> sprite on the stack, pass it to tile.push_back(), which then has to copy it 
> to dynamically allocated memory anyway?

  The std::vector reserves an entire array of objects, rather than
reserving them one-by-one. (What the reserve() function does is that it
allocates space for that many objects, without actually instantiating them.)
So rather than having 64 allocations with 'new', there's only one.

  The temporary given as parameter is created only once, not 64 times.

  What is done 64 times is calling the copy constructor of hgeSprite
(for each element added to the vector). It of course depends on how
the copy constructor in question is implemented, but usually calling
a copy constructor should not be significantly slower than calling the
regular constructor.

  If we compare the amount of operations in both situations, they would be:

- 1 'new' call, vs. 64 'new' calls.
- 1 temporary instantiated, vs. none.
- 64 copy constructor calls, vs. 64 regular constructor calls.
- 1 temporary destruction, vs. none.

  Doing only 1 'new' rather than 64 might in itself make the whole thing
faster, even though there's an additional temporary creation/destruction.

  Anyways, even if there is some speed penalty, it's probably negligible.
As a reward your objects will be managed by std::vector, rather than you
having to manage them manually.

  (As an additional reward, the std::vector will require less memory than
the 64 individually allocated objects. Of course with 64 objects this is
nothing, but it might become significant with a larger number.)

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: New NearInfinity demo up
Date: 16 Dec 2008 13:05:54
Message: <4947ee02$1@news.povray.org>
Warp wrote:
>   The std::vector reserves an entire array of objects, rather than
> reserving them one-by-one.

Ok, cool. I would have guessed std::vector would allocate an array of pointers.

>   The temporary given as parameter is created only once, not 64 times.

So the declaration is essentially hoisted from out of the loop? Makes sense.

>   What is done 64 times is calling the copy constructor of hgeSprite

OK. I know the assignment operator, and the constructor, but I never heard 
of a copy constructor. <google> Oh, I see. It's a constructor with a 
particular type for the argument. OK.

> a copy constructor should not be significantly slower than calling the
> regular constructor.

It doesn't look like it, but doesn't it have to "construct" the temporary, 
then invoke the copy constructor? It's not like the compiler can construct 
directly into the array element that std::vector allocated, can it? And 
wouldn't it have to call the destructor on the temporary 64 times after it 
was copied (assuming it has a destructor)?

It looks like the code you wrote initializes a temporary, then passes it (by 
address, presumedly) to std::vector.push_back(), which then has to copy it 
into an internal array. Then the code reinitializes the same temporary for 
the next iteration (assuming the code is even a little smartly compiled). If 
the sprite has a destructor, doesn't it need to call that before freeing the 
temporary? How can the compiler know the ... Oh, is std::vector inlined 
enough that the compiler can see it's getting inserted directly into a 
particular array element? If so, that would make sense, yes.

>   If we compare the amount of operations in both situations, they would be:
> 
> - 1 'new' call, vs. 64 'new' calls.
> - 1 temporary instantiated, vs. none.
> - 64 copy constructor calls, vs. 64 regular constructor calls.
> - 1 temporary destruction, vs. none.

Hmmm... How does the temporary get constructed? Wouldn't it be 64 calls to 
the constructor (taking the various individual arguments for the sprite) and 
then 64 calls to copy that data to the one that's in std::vector?

>   Doing only 1 'new' rather than 64 might in itself make the whole thing
> faster, even though there's an additional temporary creation/destruction.
> 
>   Anyways, even if there is some speed penalty, it's probably negligible.
> As a reward your objects will be managed by std::vector, rather than you
> having to manage them manually.

As I said, I'm never (well, rarely) against clarity and idiom in favor of 
micro-performance optimizations. Especially when you're talking about 
initialization which you presumably do only once.

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

From: Warp
Subject: Re: New NearInfinity demo up
Date: 16 Dec 2008 13:40:25
Message: <4947f619@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> >   The temporary given as parameter is created only once, not 64 times.

> So the declaration is essentially hoisted from out of the loop? Makes sense.

  Ok, it may be possible that it is created in each loop, depending on how
you are creating it, so I may have exaggerated that bit, and it may indeed
be created 64 times.

  You could manually optimize it and create it only once outside the loops,
to make sure. (If, for example, each sprite is otherwise identical but with
different coordinates, you could simply change the coordinates and push it
into the vector.)

  OTOH in this case it probably doesn't matter.

> >   What is done 64 times is calling the copy constructor of hgeSprite

> OK. I know the assignment operator, and the constructor, but I never heard 
> of a copy constructor. <google> Oh, I see. It's a constructor with a 
> particular type for the argument. OK.

  The difference between the copy constructor and an the assignment operator
is that in the latter case the object being assigned to has already been
constructed in the past, and now it's assigned a new value. With the copy
constructor the object in question is directly initialized with the given
object.

  Copy constructors are called, for example, when you pass an object to
a function by value.

  (In some situations the compiler may be able to optimize the copy
constructor call away.)

> > a copy constructor should not be significantly slower than calling the
> > regular constructor.

> It doesn't look like it, but doesn't it have to "construct" the temporary, 
> then invoke the copy constructor? It's not like the compiler can construct 
> directly into the array element that std::vector allocated, can it?

  Actually it is perfectly possible to construct into an array element
directly. (A programmer can do that himself by using so-called placement
new.)

  Whether or not the compiler is smart enough to optimize it like that
is another question.

> And 
> wouldn't it have to call the destructor on the temporary 64 times after it 
> was copied (assuming it has a destructor)?

  If the temporary is created 64 times, then it will be destroyed 64 times
as well, of course.

> It looks like the code you wrote initializes a temporary, then passes it (by 
> address, presumedly) to std::vector.push_back(), which then has to copy it 
> into an internal array. Then the code reinitializes the same temporary for 
> the next iteration (assuming the code is even a little smartly compiled). If 
> the sprite has a destructor, doesn't it need to call that before freeing the 
> temporary? How can the compiler know the ... Oh, is std::vector inlined 
> enough that the compiler can see it's getting inserted directly into a 
> particular array element? If so, that would make sense, yes.

  Being a template class, all member functions of std::vector are inlined.
(This might change with export templates, but things like push_back() will
probably always be inline, for efficiency.)

  As I said, you may be right in that the temporary is created 64 times,
though. You could hand-optimize it by creating it once outside the loops.

-- 
                                                          - Warp


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 5 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.