Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages<12
Options
Go to last post Go to first unread
Offline elasto  
#25 Posted : Monday, June 10, 2013 9:31:52 AM(UTC)
elasto

Joined: 8/23/2011(UTC)
Posts: 245

Thanks: 6 times
Was thanked: 12 time(s) in 11 post(s)
I think when you set the size it's including the size of the title bar, so you have to make it a little bigger if you want 640x480 actually available for rendering (presumably 640x496 :) )

Offline internetfreak  
#26 Posted : Monday, June 10, 2013 11:34:16 AM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
Ok that sounds like a good reason for this behavior. Could this maybe be changed, I like to set the view port size without having to care about the window border and title bar :)
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline elasto  
#27 Posted : Monday, June 10, 2013 11:41:59 AM(UTC)
elasto

Joined: 8/23/2011(UTC)
Posts: 245

Thanks: 6 times
Was thanked: 12 time(s) in 11 post(s)
Looking at it, there's TotalPixelSize and ViewportPixelSize. TotalPixelSize will include the titlebar and ViewportPixelSize wont.

Currently TotalPixelSize is settable and ViewportPixelSize is not.

It would seem to me at first glance we could make ViewportPixelSize settable, making it deduce the height of the titlebar via (TotalPixelSize - ViewportPixelSize) and then set TotalPixelSize for you.
Offline internetfreak  
#28 Posted : Monday, June 10, 2013 11:59:51 AM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
Ok so with ViewPortSize I can set the size which I want and then the border gets added and set as TotalSize? That would be a good solution because I'd like to set the size which my viewport should have so I can rely on that setting :)
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline elasto  
#29 Posted : Monday, June 10, 2013 12:04:19 PM(UTC)
elasto

Joined: 8/23/2011(UTC)
Posts: 245

Thanks: 6 times
Was thanked: 12 time(s) in 11 post(s)
Yeah. I'm coding it now. If it passes peer review it'll be in this week's release.

For now you could try it out yourself too - would help me verify my understanding is right!

Code:
Size borderSize = window.TotalPixelSize - window.ViewportPixelSize;
window.TotalPixelSize = desiredViewportSize + borderSize

Edited by user Monday, June 10, 2013 12:05:04 PM(UTC)  | Reason: Not specified

Offline internetfreak  
#30 Posted : Monday, June 10, 2013 12:57:09 PM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
Good news, I implemented it as local delta patch (in the appropriate assembly) and tested it successfully :)
Now I hope that it gets approved

One question which is ot: How can I close the game window? I didn't find the necessary clue to achieve it
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline elasto  
#31 Posted : Monday, June 10, 2013 1:11:16 PM(UTC)
elasto

Joined: 8/23/2011(UTC)
Posts: 245

Thanks: 6 times
Was thanked: 12 time(s) in 11 post(s)
Easiest way is just to call Window.Dispose :)
Offline internetfreak  
#32 Posted : Monday, June 10, 2013 1:40:31 PM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
Here' a screen which proves that your addition works (ok, I could have faked it, but it's really working ;) )
It's a bit messy on the map but I just messed around with my engine to create a map which is a bit more filled but I still get around 60FPS +/- 1-2 FPS
UserPostedImage

About closing the window: Thanks, didn't know that it would work with this, I expected something like Exit() or similar (it's more familar)
Really good support here,I like working with Delta because no one would be excluded, even if the question is more or less a bit nooblike :)
For that good level of support I will give my best to give something back ;)

Edited by user Monday, June 10, 2013 1:42:46 PM(UTC)  | Reason: Explanation about screen added

Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline elasto  
#33 Posted : Monday, June 10, 2013 1:58:48 PM(UTC)
elasto

Joined: 8/23/2011(UTC)
Posts: 245

Thanks: 6 times
Was thanked: 12 time(s) in 11 post(s)
ThumpUp
Offline Benjamin  
#34 Posted : Monday, June 10, 2013 3:37:40 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Originally Posted by: PG Go to Quoted Post
Looking at it, there's TotalPixelSize and ViewportPixelSize. TotalPixelSize will include the titlebar and ViewportPixelSize wont.

Currently TotalPixelSize is settable and ViewportPixelSize is not.

It would seem to me at first glance we could make ViewportPixelSize settable, making it deduce the height of the titlebar via (TotalPixelSize - ViewportPixelSize) and then set TotalPixelSize for you.


As there has been already discussed here, there are 2 window sizes:

  • Window.TotalPixelSize: This is the total size of your window
  • Window.ViewportPixelSize: This is the render area you are talking about


You basically want ViewportPixelSize to be 640x480, which has currently no setter as PG described. The solution from this thread will be implemented in a setter or extra method (like SetViewportSize(fullscreen, size)). We keep you informed.

Good work on the tile engine so far, Internetfreak.
Offline internetfreak  
#35 Posted : Monday, June 10, 2013 3:52:11 PM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
@Benjamin
Ok, that sounds like a good solution for me. As long as it works, I will be happy about it :)
Currently I implemented the solution from PG as setter for ViewPortPixelSize and manually used the compiled assemblies but with that week's release, it's not longer necessary I think so I can return to the factory state then (I like it clean and I only use things which are offically included in the engine to ensure compatibility with everything)

And thanks for your kind words, I hope it will be even better soon (currently I'm kind of motivated sometimes to work on it, I can say that it was not the case every time)
The next thing I implement is probably either scrolling or something else like the editor for maps (don't know currently, we will see when it's time). As always, I cannot really tell you more about my plans (I currently don't want to) but you will find it out soon enough :)
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline Benedict  
#36 Posted : Wednesday, June 12, 2013 3:01:50 PM(UTC)
Benedict

Joined: 5/15/2013(UTC)
Posts: 4

Greetings!

The latest version, which is going to be in the next release at the end of this week, now has an improved way of handling resizing without depending on the window's border.

Basically, you will now do this by just one function call and the engine will take care of translating it to the underlying framework, p.ex. if you want to set the size of the viewport inside your window you will do a call such as this:
window.ViewportPixelSize = new Size(1024,768);

I hope this change will prove useful.

Edited by user Wednesday, June 12, 2013 3:48:34 PM(UTC)  | Reason: Not specified

Offline internetfreak  
#37 Posted : Wednesday, June 12, 2013 9:56:40 PM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
Thanks for the implementation, for me it will be very useful since I can control the viewport directly and, as you said, don't care about the border which the window manager adds.
Continue working like this, I will help as much as I can.

btw, I like the new DE homepage test ;)
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline Flavio Damasco  
#38 Posted : Thursday, June 13, 2013 11:43:31 AM(UTC)
Flavio Damasco

Joined: 5/15/2013(UTC)
Posts: 45
Location: Hannover

Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: internetfreak Go to Quoted Post
btw, I like the new DE homepage test ;)


Nice to hear that! Smile


UserPostedImage
Offline internetfreak  
#39 Posted : Sunday, October 20, 2013 5:01:20 PM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
I just thought I revive this thread because I got an additional question.
Now that the rendering is cleared I can use it but I got another problem: What if the resolution changes? For example, I have a 20*15 map which fits perfectly into a 640*480 window. Now the user doesn't want to play in such a small resolution, he rather wants to have 1024*768 at least (I assume that I have a game which supports that as it should not be quite difficult with delta)
Now the viewport for rendering has changed and I need more tiles which I have to render from my map to fill the new space.
How can I achieve this in a good and performant way without wasting too much resources? And how should I proceed if the resolution was higher and then gets changed into a lower res?
Is it recommended to support multiple resolutions or should I rather say that I have a window with 1024*768px and from that window I take a 640*480px space for map rendering, the leftovers are for other things of the game (UI for example)?

You can see, I have a lot of new questions and maybe you can solve them together with me so I can proceed in coding my projects and then I'll be able to announce the project officially sometime in the future
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline Benjamin  
#40 Posted : Sunday, October 20, 2013 8:03:55 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Lets say your game is always in Landscape mode (like 16:9, 4:3, etc.) and you always put your stuff in the aspect ratio that is visible on screen (either by docking or just using the inner area), then all the resizing and correctly positioning is done automatically for you via the QuadraticScreenSpace. This works out most of the time, but when going to Portrait resolutions (like 480x800 on Android) it might not be perfect. Here it makes sense to have an extra layout for different aspect ratios (possible via the UI Editor or just a bit of code on your side).

Some more details can be found here: http://deltaengine.net/learn/screenspace (is going live in the next few days)
Offline internetfreak  
#41 Posted : Monday, October 21, 2013 9:03:05 AM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
You have indeed a valid point.
I know that the positioning and the scaling is done automatically by the ScreenSpace but my point was a bit different.
I'm using the code which PG posted above in his posts for setting up and render the map but it's limited to a specific world size. In my project, it's possible that the map goes over the whole screen so I don't have only a specific portion of the screen for map rendering. As long as the resolution stays the same, I get no problem but if it does, then I have to handle that change so I can display more tiles (or less tiles if the resolution is lower than before).
As background-information: To achieve a natural look of the graphics I calculate the size of each image based on the pixelSize and the current resolution so the size of the tile in ScreenSpace-Size is the appropriate expression of the PixelSize, the tile is neither downscaled nor upscaled. Recalculating the pixel size is easy but what if I'm able now to display 25 tiles instead of 20? In this case I need to grow the buffer for tiles in an efficient way without recreating each sprite since I don't have much control over the sprites once they are created (I cannot really dispose them if I remember it right and I also want to preserve them due to performance reasons so I only have to add the new tile sprites to my buffer)

I hope this is a bit more understandable as I don't know how to correctly explain this. If it's still unclear I will explain it in german next time :)
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline Benjamin  
#42 Posted : Monday, October 21, 2013 9:16:43 AM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Not sure on what you mean by recalculating the number of tiles. If you want to render them pixel accurate maybe you should use the PixelScreenSpace instead (similar to what fonts do, they will always be rendered in the correct pixel size). Obviously it depends on the game and use case, but let's say for an editor of a 2D game with small tiles it could make sense to make everything use PixelScreenSpace and only scale up/down the map area of the editor and leave all UI elements plus the size of each tile always in the same pixel size.

Let me know if you need a full example game for this. In the meantime check out the PixelScreenSpaceTests.
Offline internetfreak  
#43 Posted : Monday, October 21, 2013 10:51:48 AM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
According to PG's code I have this in my code:
Code:

private readonly Sprite[,] map = new Sprite[MapWidth,MapHeight];
private const int MapWidth = 10;
private const int MapHeight = 10;


This is sufficient for the start resolution and I assume for this example that it fits the screen nicely. Now the player changes the resolution so there is room for 20*20 tiles.
Now I have 2 possibilities:

1) Upscale everything so it fits again (not really wanted by me as it looks horrible depending on the images)
2) Change the rendersize of the map to support the new tiles

What I want is possibility 2, I want to render the new tiles. My problem is that the buffer is already initialised and I have enough sprites for 10*10 tiles but not for 20*20 tiles.
My question is how to solve this problem in a good way as it is (in my opinion) not really good to deactivate all old sprites and create a new 20*20 array of sprites for rendering (would waste too much memory until the GC is collecting and maybe the old memory will never get freed as the entity system maybe still could hold references)
Personally I prefer to reuse old things so how can I grow the buffer but behold the old sprites? Shrinking the buffer is no problem because I can deactivate all sprites which are not needed (for example we have a buffer of 20*20 and the screen is shrinked to 10*10 tiles, then I only deactivate the tiles outside of the render-area to stop them for update etc)

Maybe it's the best to create a large buffer at start, depending on the platform (for example on PC I create a buffer which is capable to hold enough tiles for 1024*768px and offer that as maximum resolution whereas on WP7/8 I only create a buffer for the phone's resolution as it generally doesn't change)

I hope this time it's more understandable because I'm horrible in explaining things on english due to the fact that I can't speak english very well (meanwhile it's sufficient enough to talk but I still lack skills)
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline ollimorp  
#44 Posted : Monday, October 21, 2013 8:07:49 PM(UTC)
ollimorp

Joined: 7/22/2013(UTC)
Posts: 13

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
Hi Internetfreak,

Quote:
My question is how to solve this problem in a good way as it is (in my opinion) not really good to deactivate all old sprites and create a new 20*20 array of sprites for rendering (would waste too much memory until the GC is collecting and maybe the old memory will never get freed as the entity system maybe still could hold references)


Tiny-"Denkfehler" (Germish rocks) :)
You overlooked something: The array contains just the reference of the tiles. Well while you copy the array in a new larger array, you will not make a deep copy - so you will just copy the references. ;)


Greetings



EDIT: Take a look at http://www.dotnetperls.com/array-resize

Edited by user Monday, October 21, 2013 8:14:59 PM(UTC)  | Reason: Not specified

Offline internetfreak  
#45 Posted : Monday, October 21, 2013 8:28:50 PM(UTC)
internetfreak

Joined: 12/19/2011(UTC)
Posts: 529

Thanks: 10 times
Was thanked: 16 time(s) in 15 post(s)
@ollimorp
Thanks for your link, it's helpful
I know that .NET copies the references but with my statement you quoted I meant discarding all old sprites and create them completely new :)
With Array.Resize I can react very well on viewportchanges and I'm sure I can find a good way. In the end, it's not really my task to control the resolution, I rather have to make sure that my project reacts well on such changes.
We will see how I will progress :)
Mein Blog: www.internetfreak.net

- Inoffizieller DeltaEngine-Supporter und Tutorialschreiber -
Offline Rallfried  
#46 Posted : Tuesday, October 22, 2013 11:33:37 AM(UTC)
Rallfried

Medals: Admin

Joined: 8/21/2011(UTC)
Posts: 36
Location: Hannover

Thanks: 2 times
Rss Feed  Atom Feed
Users browsing this topic
OceanSpiders 2.0
2 Pages<12
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2018, Yet Another Forum.NET
This page was generated in 0.338 seconds.