Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Variants

Reply
 
Thread Tools Display Modes
Old February 12, 2015, 16:28   #101
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,365
AnonymousHero is on a distinguished road
Quote:
Originally Posted by Diego Gonzalez View Post
Yes, every dungeon grid has a QGraphicsItem. And every animated object too. It's easier to let Qt do all the redrawing and cleaning of the items underside your animation. QGraphicsItem also can receive events so it's simpler to grab mouse clicks and things like that.
Every time we need to animate something we create a custom graphics item that is only an empty rectangle where you can draw things. Qt handles all the stuff related to the whole scene. Like this:

When the beam item is hidden or destroyed Qt redraws everything under it. Really a piece of cake.
This image also shows the pseudo-ascii mode. Tiles are used for everything except player and monsters.
Tiles are handled in a different way now. All tilesets are accesible at any time. But the tileset is not loaded in memory. The specific tile is fetched on demand. To reduce disk access the game has a couple of tile caches to store the most used tiles, like walls and floors. I think that this scheme works quite fast.
Great, thanks for the information.
AnonymousHero is offline   Reply With Quote
Old February 12, 2015, 17:32   #102
Diego Gonzalez
Rookie
 
Join Date: May 2007
Posts: 23
Diego Gonzalez is on a distinguished road
We did some visual effects by changing the size, color and opacity of certain tiles. Qt simplefies those tasks. A bit of particle theory (simplified) was used for some spell effects too.
Diego Gonzalez is offline   Reply With Quote
Old February 12, 2015, 21:33   #103
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,365
AnonymousHero is on a distinguished road
Quote:
Originally Posted by Diego Gonzalez View Post
We did some visual effects by changing the size, color and opacity of certain tiles. Qt simplefies those tasks. A bit of particle theory (simplified) was used for some spell effects too.
I was mostly concerned about the performance of just doing a "dumb" matrix of QGraphicsItem. (In my initial tests it performed well, but going to 2560x1440 fullscreen there was a bit of a worry. I suspect the problem is actually the fact that in my port I still had a lot of indirection between Angband_Term (struct Term?, whatever) and the actual display code.)
AnonymousHero is offline   Reply With Quote
Old February 13, 2015, 01:32   #104
Diego Gonzalez
Rookie
 
Join Date: May 2007
Posts: 23
Diego Gonzalez is on a distinguished road
NPP doesn't use the term structure. We still have the old light_spot function. It marks the proper graphics item as dirty. Qt redraws that spot later. At some point, we had separate graphics items for monsters, objects and terrain. But it was slow. Now, the DungeonGrid object takes care of drawing all the dungeon layers in one grid. The code is a bit more complex but faster. Animations and targetting use their own graphic items.
Perhaps you need to reduce the frecuency of full screen redrawings. I had to pay special attention to this problem. Qt is great with this because it takes care of redrawing just the necessary items. We dont have to write the code necessary to redisplay a bunch of grids under an animation with a size of 10x10. The graphics engine does that for us.
Qt doesnt care about a dungeon of grids. It works only with graphics items that overlap each other partially and it knows how to redraw the necessary items when some of them change positions or visibility (most of the time hehe).
Diego Gonzalez is offline   Reply With Quote
Old February 13, 2015, 02:42   #105
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,504
Derakon is on a distinguished road
Question, then: how do you handle screen scrolling? Shifting the screen by 1 character effectively dirties every single part of it. Or do you just limit yourself to "big" scrolling? In other words, would a "character is always centered in the screen" option work in NPPQt?

Pyrel uses a canvas for its drawing (and thus manually draws each cell individually), but as a consequence, when the screen scrolls, it can detect that, draw the current screen at an offset, and then manually fix dirtied cells (mostly around the edges).
Derakon is offline   Reply With Quote
Old February 13, 2015, 03:04   #106
Diego Gonzalez
Rookie
 
Join Date: May 2007
Posts: 23
Diego Gonzalez is on a distinguished road
The canvas has a method, centerOn. It takes care of the current window size and set the scrollbars to the proper coordinates and size. Also we can scroll the canvas view to any grid, if we traslate the dungeon coordinates to canvas coordinates (it depends on the current tile size). How Qt optimizes that, I don't know. Perhaps it uses a big offscreen pixmap and redraws only the edges like you said. A change in the window size is also handled by Qt without our intervention. Once you get used to the idea that the dungeon as a whole doesn't exists anymore and all we have is a bunch of grids that are separately redrawn at any time, some parts of the code get easier to write. Full redraws are rare. If we write a good draw method for one grid everything flows. Well, mostly, because I remember some strange flickering situation that I had to solve with a full screen redraw (that Qt surely limits to the items that are currently visible).

Last edited by Diego Gonzalez; February 13, 2015 at 03:18.
Diego Gonzalez is offline   Reply With Quote
Old March 4, 2015, 05:19   #107
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
We are done coding the beta version, and it is just being de-bugged now. I am down to finding a bug maybe once every 15 minutes of play. When it can be played for an hour without any bugs the beta of the QT port will be released.
__________________
NPPAngband current home page: http://nppangband.bitshepherd.net/
Source code repository:
https://github.com/nppangband/NPPAngband_QT
Downloads:
https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57
nppangband is offline   Reply With Quote
Old March 9, 2015, 16:45   #108
Zireael
Adept
 
Join Date: Jul 2011
Posts: 204
Zireael is on a distinguished road
Quote:
Originally Posted by nppangband View Post
We are done coding the beta version, and it is just being de-bugged now. I am down to finding a bug maybe once every 15 minutes of play. When it can be played for an hour without any bugs the beta of the QT port will be released.
That's some great news!
Zireael is offline   Reply With Quote
Old March 10, 2015, 02:24   #109
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
All set to release. Unfortunately the simple days of zipping up the files and uploading them are over. Qt binaries require a release package with all the DLLs.

Step 1) learn how to do a release package.

Is anyone experienced with this process? Thanks to anyone who can offer some help or advice. I am trying to read up on it but I haven't quite gotten my head around it yet.
__________________
NPPAngband current home page: http://nppangband.bitshepherd.net/
Source code repository:
https://github.com/nppangband/NPPAngband_QT
Downloads:
https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57
nppangband is offline   Reply With Quote
Old November 14, 2015, 03:18   #110
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Update: The development phase for a fully functional NPPQT windows port is finished!

There is some de-bugging to do but a final beta will be out soon.

Ports for Linux and the MAC will follow shortly after that.
__________________
NPPAngband current home page: http://nppangband.bitshepherd.net/
Source code repository:
https://github.com/nppangband/NPPAngband_QT
Downloads:
https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57
nppangband is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Final NPPMoria and NPPAngband 7.1.0 released nppangband Variants 8 January 30, 2014 11:55
Final NPPMoria and NPPAngband 7.0.0 released! nppangband Variants 34 September 6, 2013 23:21
NPPMoria Competition Wraitheist Variants 5 September 3, 2013 18:10
NPPAngband and NPPMoria 7.0.0 beta-1 released! nppangband Variants 15 May 9, 2013 22:26
OpenGL port BreathesFire Development 2 November 3, 2011 08:22


All times are GMT +1. The time now is 02:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.