Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Another screen update API

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Another screen update API
Richard Phipps
Member #1,632
November 2001
avatar

23 doesn't see the need for a DRS system in a screen update library. I am not sure myself if it's only going to be used in certain specialised situations.

clovekx
Member #3,479
April 2003
avatar

I disagree to have this hi-level API in Allegro library. It should be an addon.

Why to use so complex screen update API? Anybody can write his own or download only what he really needs. Why to have a triple buffering or DRS possibility if you don't want to use it?

Mandrake Root Produc
Member #300
April 2000

right, that's what I said, make an add-on lib.

ReyBrujo
Moderator
January 2001
avatar

I would prefer joining the blits instead of preprocessing them, but that is up to you.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

axilmar
Member #1,204
April 2001

Quote:

I am not sure myself if it's only going to be used in certain specialised situations.

Lot's of 2d non-scrolling games need it.

Quote:

Why to use so complex screen update API?

It's about 3 functions to use. Why do you think it is complex?

Quote:

Anybody can write his own

I seriously doubt that.

Quote:

or download only what he really needs.

I seriously doubt that too. You have to know that such an update method exists, in order to search for it. Most newbies don't.

Quote:

Why to have a triple buffering or DRS possibility if you don't want to use it?

Allegro has many many things that are not used 99% of the time...and it lacks the one thing that 100% of its users need, and that is the screen update method.

Add-on or not, such a piece of code is really needed.

Marcello
Member #1,860
January 2002
avatar

1+-----------+
2| |
3| +------------------+
4| | |
5+-----| |
6 | |
7 | |
8 | |
9 +------------------+
10 
11What about:
12 
13+-----------+
14| 1 |
15|............------------+
16| 2 |
17+-----...................+
18 |3 |
19 | |
20 | |
21 +------------------+
22 
23Imagine:
24 +----------+
25 | |
26+---| |---+
27| | | |
28| +----------+ |
29| |
30| |
31| |
32+------------------+
33 
34Yours would do (assuming it did not freak out):
35 
36 +----------+
37 |1 |
38+---| |---+
39|2 . .3 |
40|..................|
41|4 |
42| |
43| |
44+------------------+
45 
46Whereas this idea would do:
47 
48 
49 +----------+
50 |1 |
51+---............---+
52|2 |
53|..................|
54|3 |
55| |
56| |
57+------------------+
58 
59Or with some extra checks, realize 2 and 3 can be merged.

Marcello

Richard Phipps
Member #1,632
November 2001
avatar

Not quite:

1 +----------+
2 | |
3+---| |---+
4| | | |
5| +----------+ |
6| |
7| |
8| |
9+------------------+
10 
11Would be seen as:
12 
13 +----------+
14 | |
15+---| |---+
16| |
17| |
18| |
19| |
20| |
21+------------------+
22 
23And processed as:
24 
25 +----------+
26 |1 |
27+---| |---+
28|2 | |3 |
29| | | |
30| | | |
31| | | |
32| | | |
33+---+----------+---+

So still done in 3 parts.

Thomas Fjellstrom
Member #476
June 2000
avatar

shouldn't that be:

1 +----------+
2 | |
3+---| |---+
4| | | |
5| +----------+ |
6| |
7| |
8| |
9+------------------+
10 
11Would be seen as:
12 
13 +----------+
14 | |
15+---| |---+
16| |
17| |
18| |
19| |
20| |
21+------------------+
22 
23And processed as:
24 
25 +----------+
26 |1 |
27+------------------+
28|2 |
29| |
30| |
31| |
32| |
33+------------------+

Less overhead. split in horizontal strips, should even blit faster.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Gideon Weems
Member #3,925
October 2003

Yeah, Marcello mentioned that in the bottom of his code box.

I hope this API turns out; perhaps a collaboration is in store? You know how it goes: "Together, we stand..."

Richard Phipps
Member #1,632
November 2001
avatar

No, the routine I described would scan down and find one large unbroken rectange upon finding the corner of 1. It wouldn't check each row completely and stop if the row started earlier or finished later than the one above.

Thomas, that method would be faster in this case, but slower in others.

EDIT:

Er.. I'm talking about the routine I made. Not about other methods. Wasn't that Marcello's question?

Gideon Weems
Member #3,925
October 2003

Sorry for being side-tracked.

Has your method been added to axilmar's download? I've wanted to try out dirty rectangles for some time and would be more than happy to test.

Richard Phipps
Member #1,632
November 2001
avatar

Not as far as I know. You'd have to talk to Axilmar about that one..

clovekx
Member #3,479
April 2003
avatar

Quote:

I seriously doubt that too. You have to know that such an update method exists, in order to search for it. Most newbies don't.

If they don't know about it and they also do something, then they don't probably need it. They can just read the example.

Quote:

and it lacks the one thing that 100% of its users need, and that is the screen update method.

I don't. You don't need that kind of API if you don't want to have more than one update method.

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

23 doesn't see the need for a DRS system in a screen update library. I am not sure myself if it's only going to be used in certain specialised situations.

To clarify, I don't see why it can't be seperate. A DRS API and my screen update API, both of which can be used seperately or together, would be kick-arse. I'm pretty much calling my API done, so if someone wants to build a DRS that works with it, go ahead. I have no need for a DRS and no knowledge of how to even make one, so I wash my hands of that. :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

axilmar
Member #1,204
April 2001

Quote:

Not as far as I know. You'd have to talk to Axilmar about that one..

You can do anything with the piece of code I posted.

Quote:

If they don't know about it and they also do something, then they don't probably need it.

What if they later find out they need it?

Quote:

They can just read the example.

I don't think the Allegro's example DRS is a good solution. It can be improved in so many ways, as it has been shown in this thread.

Quote:

I don't. You don't need that kind of API if you don't want to have more than one update method.

I don't have use for compiled sprites either, or midi, or streaming, or FLI etc...but that's hardly an argument. Furthermore, all games make use of a screen update method; so why should't a screen update API be there out of the box?

Quote:

To clarify, I don't see why it can't be seperate

It can be separate, but the point is to offer a complete solution. DRS is only a few lines of code...does it really worth the hassle of a separate download? especially since the context is the same?

Evert
Member #794
November 2000
avatar

Quote:

Furthermore, all games make use of a screen update method; so why should't a screen update API be there out of the box?

Having a common, transparent screen update API that handles triple buffering, page flipping or double buffering is something that IMO has a place in Allegro. It was also part of the original Allegro 5 draft, as I remember.

Quote:

DRS is only a few lines of code...does it really worth the hassle of a separate download?

I see no reason a DRS couldn't be included with the update API. Someone needs to write it though.

X-G
Member #856
December 2000
avatar

I second Evert/axilmar on both accounts. Just, you know, in case. :P

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

clovekx
Member #3,479
April 2003
avatar

Quote:

I don't have use for compiled sprites either, or midi, or streaming, or FLI etc...but that's hardly an argument.

It's not supposed to be. But you said:

Quote:

thing that 100% of its users need

Allegro HAS screen update API.

What about to add all the addons you can find in resource directory.

Or we could also add pathfinding. It's also very useful. O, and it's not there yet.

Quote:

or streaming

Do you mean audiostreaming?

axilmar
Member #1,204
April 2001

Quote:

It's not supposed to be.

Then why you said it then?

Quote:

Allegro HAS screen update API.

What do you mean? it does not. If it did, neither 23, nor me or any other person would make one.

Quote:

What about to add all the addons you can find in resource directory.

Or we could also add pathfinding. It's also very useful. O, and it's not there yet.

A screen update API is something used by 100% of games, and therefore need to be in the core Allegro library. Path finding or any other functionality is not.

Richard Phipps
Member #1,632
November 2001
avatar

I agree with Axilmar on this one. Something like Chris's lib should be merged with Allegro. A DRS system (if short) would be not too much extra work for the potential gain for some users.

Korval
Member #1,538
September 2001
avatar

I agree that giving the API control over screen updating is good. I disagree that having a DRS system in the API is a good idea.

Here's one reason: a DRS system requires that the underlying system support a specific kind of buffering: copy-based buffering. OpenGL, however, supports arbitrary buffering; that is, they specifically tell you that the contents of the back buffer after a swap are undefined. They could be what the front buffer was (flip), it could retain the back buffer data (copy). It could copy random garbage from an arbitrary piece of video memory into the back buffer, and it will still comply with the OpenGL specification.

If GL-based 2D is at all a priority, then you cannot put something in the API that directly conflicts with it.

BTW, I am aware that, in theory, you can create copy-based rendering in OpenGL (using intermediate textures or render targets). However, this is needlessly slow.

Lastly, DRS, in and of itself, is a pretty outdated technology. If you're running a TNT2 or better, you can easily render an entire screen's worth of 2D data (including strings, etc) at well over 30 (if not 60)fps. It sounds very efficient, and it is, but if you're relying on hardware acceleration, it is efficiency that you will never use.

[edit]

However, after thinking about it a bit, I wouldn't be adverse to having AllegroPro provide optional support for a DRS-style framebuffer update mechanism. Because AllegroPro is designed to allow drivers to opt-in/out of various framebuffer update mechanisms, it's no problem to have drivers that can actually support it use it, and the GL driver (among others) not.

Evert
Member #794
November 2000
avatar

Quote:

I agree with Axilmar on this one. Something like Chris's lib should be merged with Allegro.

I have Chris's merged with my local tree here in a draft for a new graphics API. Works beautifully. I'll see about merging Chris's current version with the 4.1 code branch.

Quote:

Here's one reason: a DRS system requires that the underlying system support a specific kind of buffering: copy-based buffering. OpenGL, however, supports arbitrary buffering; that is, they specifically tell you that the contents of the back buffer after a swap are undefined.

The DRS system could simply fail to initialize on OpenGL - just as the tripple buffering system fails to initialize on drivers that don't support it (ie, X11 - although I see no real reason why it couldn't be made to work there).

The main problem with a DRS that I see is that you either need to manually mark rectangles as dirty (as user), or have each draw operation to the screen mark an area as dirty.
The first approach is obviously the most flexible and easiest to implement (and what I'd implement anyway), but the programmer is likely to decide it's too much work calling the extra function if he can just use double buffering/page flipping and get away withoutit it. The second obviously slows down all drawing opertions and is generally undesirable IMO.

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

I have Chris's merged with my local tree here in a draft for a new graphics API. Works beautifully. I'll see about merging Chris's current version with the 4.1 code branch.

Hey; cool! 8-) Hope you're using the newest version; found a bad bug last night ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Bob
Free Market Evangelist
September 2000
avatar

Quote:

I disagree that having a DRS system in the API is a good idea.

The DRs can simply be hints to the API.

--
- Bob
[ -- All my signature links are 404 -- ]

 1   2 


Go to: