Game Development Community

How do you usually size camera view and world view?

by Johan Stenqvist (neochrome) · in Torque Game Builder · 06/03/2005 (12:57 am) · 35 replies

I'm wondering how you guys usually set up your game's camera view size and world view size?

I have a single fxSceneWindow2D at "800 600" for my game screen.
I then set the cameraposition to "0 0 800 600" to get "real pixel size" - it just seemed easier if I could specify the size of my sprites in real pixel sizes. Is this the way you're doing it as well? What is recommended?

I've run into a strange problem - which I guess might have something to do with this. At home everything looks nice and dandy, but at work all my sprites are offset about "-400 -300" compared to my "800 600" sized "viewport" - any ideas of what can cause this?

I hope someone will make any sense of my ramblings and perhaps may be able to help me with a nudge in the right direction... :-)

Happy game-coding to you all!

/Johan
Page«First 1 2 Next»
#21
06/13/2005 (8:47 am)
Quote:
"Presumably you're saying that a sprite @ (0,0) would have its lower-right visible at the top-left of the window?"


Yes.

SceneWindow.setCurrentCameraPosition("0 0 800 600");

but this says the center of the screen is 0, 0

so wouldn't it set up something like this?

razedskyz.com/images/800600grid.jpg
#22
06/13/2005 (9:53 am)
@Matthew: Yes, that's what should happen I guess but it looks like Johan is saying that an object @ (0,0) is appearing at the top-left (unless I've missed the point). :)

@Johan: It's not a problem looking at this because it may be something I've missed but this is really odd and the association of the tilemap with sprites is really odd. If you've not got anything too secret then I'd appreciate it if you could zip your whole zip directory up and send it me. Minus any images that are stock. If you can come up with a trivial example then I'd be glad to debug it myself. Up to you bud.

Good Luck,

- Melv.
#23
06/13/2005 (9:56 am)
Ohh, lol sorry about that... I thought Johan was saying that an object 0, 0 should be at the top left, instead of improperly being positioned at the top left.

EDIT: I think I recall a thread back shortly after T2D was released (and there was just one forum) about a tile layer effecting positioning.
#24
06/13/2005 (10:23 am)
Really? I'd appreciate it if you could find that thread. I don't see how on earth it could affect the position of sprites but that's not to say it can't. ;)

- Melv.
#25
06/13/2005 (10:26 am)
I'll search it up... I think either it ended up being user error, or was assumed user error (by the person)... this just reminded me a lot of it
#26
06/13/2005 (11:48 pm)
Hi again!

Not that my project is that secret, but I thought it would be easier for you if I stripped all but what is needed to generate the error - so I've prepared a little something for you over here in this zip-file. In this file are two copies of the console.log: console_working.log is from my computer at home and console_not_working.log is from my computer at work where it's not working.

I setup the screen as this:
www.stenqvist.net/shots/setup.png
When run at home everything works just fine, but at my computer at work it doesn't, and it all boils down to the following code at line 63 in client.cs:
58:	//tiles
59:	%map = new fxTileMap2D()
60:	{
61:		scenegraph = sceneGraph;
62:	};
63:	%map.loadTileMap("~/client/test.map"); // <-- this line causes the error!!
64:	%layer = %map.getTileLayer(0);
65:	%layer.setPosition("-400 -300");
66:	%layer.setAutoPan("0 -10");

I'm placing a sprite in each corner and one in the center, each a picture of a number from 1 to 5.

Here's what it looks like at work, with tilemap loaded:
www.stenqvist.net/shots/not_working.png
And this is what it should look like (no tilemap loaded since that causes the error here at work):
www.stenqvist.net/shots/working.png
I hope this might help you pinpoint what can be the cause of this.
Please let me know if there's any debug-build of t2d.exe or something you want me to run.

Best regards,
Johan
#27
06/14/2005 (12:09 am)
BTW - should this thread, or at least the latter part of it be moved to the "Report Bugs" section?
#28
06/14/2005 (12:31 am)
It should probably be moved but let's go with this one for now.

Well this is one of times when you get completely stumped! I just don't see how the inclusion of an object into the scene can affect the system like this but there it is; very strange.

Is this the stock v1.0.2 executable?
Desperate guess but could you delete all the .DSO files and retry?
After doing the load, what position does "getPosition()" return on the sprite? Is it where it was placed or is it indeed the camera that's foobar'd?

It's starting to look like either you send me some code or perhaps if you get time then see if you can see at what point loading that map causes the problem.

Anyway, thanks for spending the time helping me track the problem. :)

- Melv.
#29
06/14/2005 (12:44 am)
I've uploaded a zip file to my webhost. You'll find it at: www.stenqvist.net/shots/bug_report.zip.

I'm using v1.0.2 of T2D.

I tried deleting all .dso files - same result.

getPosition() returns correct for all objects - including the tilemap.

I tried a safeDelete() on the tilemap from the console and swoosch - all my sprites moved to the correct places!!

No problem helping out - I want this engine to be as good as it can - like you! :-)

Perhaps you can tell me when you've downloaded the zip-file from above so I can delete it - it contains both the tileeditor and the particleeditor - I didn't dare to remove them at this point in the bug search...

Best regards,
Johan
#30
06/14/2005 (1:54 am)
Downloaded the file thanks. I'm at work at the moment so I'm limited on time but I've sent it home to have a look at this evening.

It is so bizarre that deleting the tile-map causes the view to shift!

I'll let you know what I find.

Thanks again,

- Melv.
#31
06/14/2005 (2:53 am)
Couldn't help a little peak...

First thing I noticed, but it's probably got nothing to do with the problem, is that you're using the "GuiBitmapCtrl" for the background and telling it to tile a 10x10 texture over the background meaning on a 800x600 screen, it's got to do 80*60=4800 seperate texture operations per frame just for a black background! This reduces the frame-rate from 300fps to 20fps on my machine (noted that your debug-info screenshot shows a similar FPS). I'd recommend either using a bigger texture or ignoring this and using a profile with the opaque setting to true and set the colour to black (preferred option). A profile similar to "GuiContentProfile" would do.

I did notice that the one that wasn't working was on a "Intel Brookdale-G" chipset. Wonder if this is relevant and we've got some strange OpenGL driver issue. I wonder if it exhibits the same problem running under Direct3D?
OpenGL driver information:
  Vendor: Intel
  Renderer: Intel Brookdale-G
  Version: 1.3.0 - Build 4.14.10.3619
I also wonder if the other person who saw this problem (that Matt mentioned) was using the same chipset. It could be a problem that all other cards are dealing with but the intel one doesn't which could still make it a T2D problem.

It might be good to know if the problem is actually in the load or if indeed it's in the displaying with some kind of modelview/projection problem. Could you try setting the layer to be invisible "%layer.setVisible(false);" and see if that makes a difference?

Unfortunately, I'm not seeing the problem on my machine which is a damn shame. I'll try it on several others around here later when I get some time.

- Melv.
#32
06/14/2005 (4:42 am)
I'll switch to using a GuiControl with a proper Profile for my real project. I tried it for this mini-project and it didn't affect things at all - well, maybe 10-20 more fps but the artifact is still there.

%layer.setVisible(false); has the same effect as not loading the layer/map at all.

I tried D3D over OpenGL and I couldn't get it to run other than in fullscreen - and then with a lot of flicker - but it rendered correctly!
OpenGL in fullscreen had the same error - so I guess it's safe to assume that it's related somehow to OpenGL on this machine.

Best regards,
Johan
#33
06/14/2005 (9:49 am)
Well, I guess we can put that down to a problem either with the Intel Brookdale chipset or some problem in T2D that only shows on that chipset. I noted that you've got the latest driver on there, maybe another driver might work, who knows?

If Matt finds the other thread, i'll investigate what the chipset was.

Thanks for your help!

- Melv.
#34
09/19/2005 (5:42 pm)
Just to confirm this (much after the fact), after my GeForce blew out I had to go to onboard video and it's an Intel Brookdale-G. This exact problem occurs for me, too!! NNOOOOOOOO!!!!

So I guess it is driver related or something. :(
#35
09/01/2006 (5:09 pm)
Sorry to resurrect ancient history here... but did anyone ever figure this one out? I've noticed with great interest that puzzle poker plays flawlessly on the same on-board chipset that has this issue, and I'm just curious if there was something specific in the render of sprites in this old version of T2D (which I'm still using) that has since been fixed up. I guess I could winmerge 'em to see what's changed... hrm...
Page«First 1 2 Next»