UpdateRect(screen, all zeros) No Update

Under windows 2k, I have the following code that I believe should redraw the entire (windowed) ‘screen’ whenever the window gains focus, but it never gets triggered. I tried running UpdateRect(screen, 0, 0, 0, 0) by force when I press a particular key, but even that doesn’t actually redraw the parts of the window that are covered by other windows!

SDL_Event e
while (true) {
SDL_Delay(10);
SDL_WaitEvent(&e);

switch (e.type) {
	case SDL_ACTIVEEVENT:
		if (e.active.gain)
			SDL_UpdateRect(shared->screen, 0, 0, 0, 0);

I’m using 1.1.8 under windows, the precompiled development library.

That’s correct. Windows won’t redraw anything that is being covered up by
other windows, until those other windows stop covering it, and then your
application will get notified it needs to redraw those parts of your windows.
This is an efficiency thing. After all, what is the point in wasting time
drawing something that you aren’t even going to see?

Whatever you are doing that needs a covered window to be drawn anyway is
probably wrong. Since you aren’t giving any information about what you are
trying to do and/or why, I can’t help you though.On Friday 02 March 2001 05:19, you wrote:

Under windows 2k, I have the following code that I believe should redraw
the entire (windowed) ‘screen’ whenever the window gains focus, but it
never gets triggered. I tried running UpdateRect(screen, 0, 0, 0, 0) by
force when I press a particular key, but even that doesn’t actually redraw
the parts of the window that are covered by other windows!

All well and good, but I set an event handler to printf any time SDL_ACTIVEEVENT is fired off, and minimizing, restoring, and even tab-cycling or mouse-clicking on my windowed app never cause it to receive this event…

Jason Hoffoss wrote:> On Friday 02 March 2001 05:19, you wrote:

Under windows 2k, I have the following code that I believe should redraw
the entire (windowed) ‘screen’ whenever the window gains focus, but it
never gets triggered. I tried running UpdateRect(screen, 0, 0, 0, 0) by
force when I press a particular key, but even that doesn’t actually redraw
the parts of the window that are covered by other windows!

That’s correct. Windows won’t redraw anything that is being covered up by
other windows, until those other windows stop covering it, and then your
application will get notified it needs to redraw those parts of your windows.
This is an efficiency thing. After all, what is the point in wasting time
drawing something that you aren’t even going to see?

Whatever you are doing that needs a covered window to be drawn anyway is
probably wrong. Since you aren’t giving any information about what you are
trying to do and/or why, I can’t help you though.

Hi!

In conjunction with the game I’m working on now, I want to develop sort of
a central high-scores server that games (not just mine) could use to track
high scores and statistics. I’m pretty excited about it, it’d be neat if
users could see how they rank among the rest of the world.

Anyway, after doing some thinking, I found that I’m pretty much talking
about a database. Which doesn’t thrill me so much, and I’d be utterly
uninterested in writing that part so I’m looking for existing database
libraries, etc. that I can use to store and query my score records.
Now, if I wanted to do it exclusively for linux I could just use its
existing database API, but that’s simply just not as cool as
using SDL. So how about it, anyone know what I can use on an SDL project?

thanks,
lyle

If all you are keeping is a list of names and their high scores, you might
as well use a text file or an XML file. You can get a free XML parser from
http://xml.apache.org (I’ve used it alongside SDL without any problems)

The advantage to using XML is that it would probably be really easy to send
the results to a server once your users feel like it.

The server can use XML too or a more powerful database system, but that is
outside the scope of SDL.–

Olivier A. Dagenais - Software Architect and Developer

“Lyle Hanson” wrote in message
news:Pine.LNX.4.30.0103201042380.22799-100000 at euclid.nmu.edu

Hi!

In conjunction with the game I’m working on now, I want to develop sort of
a central high-scores server that games (not just mine) could use to track
high scores and statistics. I’m pretty excited about it, it’d be neat if
users could see how they rank among the rest of the world.

Anyway, after doing some thinking, I found that I’m pretty much talking
about a database. Which doesn’t thrill me so much, and I’d be utterly
uninterested in writing that part so I’m looking for existing database
libraries, etc. that I can use to store and query my score records.
Now, if I wanted to do it exclusively for linux I could just use its
existing database API, but that’s simply just not as cool as
using SDL. So how about it, anyone know what I can use on an SDL project?

thanks,
lyle

“Lyle Hanson” wrote in message
news:Pine.LNX.4.30.0103201042380.22799-100000 at euclid.nmu.edu

Hi!

In conjunction with the game I’m working on now, I want to develop sort of
a central high-scores server that games (not just mine) could use to track
high scores and statistics. I’m pretty excited about it, it’d be neat if
users could see how they rank among the rest of the world.

Anyway, after doing some thinking, I found that I’m pretty much talking
about a database. Which doesn’t thrill me so much, and I’d be utterly
uninterested in writing that part so I’m looking for existing database
libraries, etc. that I can use to store and query my score records.
Now, if I wanted to do it exclusively for linux I could just use its
existing database API, but that’s simply just not as cool as
using SDL. So how about it, anyone know what I can use on an SDL project?

When you’re talking about an Internet application like this, it’s
important to make a distinction between the server and the client. The
client will be the game running on the user’s machine, with graphics and
sound, using SDL etc. On the other hand, for a high score table, there’s
no reason for the server to run any game code, so there’s not a great deal
of call for using SDL on the server side.

A typical industrial-strength cross-platform way to code the server side
is to use Perl with its DBI module in conjunction with whatever
web/database server software you want to run. Perl is cross-platform, and
DBI abstracts the database interface (sort of SDL for databases). But
unless you’re going to distribute the server code so other people can set
up their own high-score tables, I’m not sure it matters much.

-Thatcher

Thatcher Ulrich schrieb am 20 Mar 2001:

In conjunction with the game I’m working on now, I want to develop sort of
a central high-scores server that games (not just mine) could use to track
high scores and statistics. I’m pretty excited about it, it’d be neat if
users could see how they rank among the rest of the world.

Anyway, after doing some thinking, I found that I’m pretty much talking
about a database. Which doesn’t thrill me so much, and I’d be utterly
uninterested in writing that part so I’m looking for existing database
libraries, etc. that I can use to store and query my score records.
Now, if I wanted to do it exclusively for linux I could just use its
existing database API, but that’s simply just not as cool as
using SDL. So how about it, anyone know what I can use on an SDL project?

When you’re talking about an Internet application like this, it’s
important to make a distinction between the server and the client. The
client will be the game running on the user’s machine, with graphics and
sound, using SDL etc. On the other hand, for a high score table, there’s
no reason for the server to run any game code, so there’s not a great deal
of call for using SDL on the server side.

All that’s needed is a addon-lib for SDL_net (probably something like
SDL_http) and a little interface to send / query / update scores.

  • Andreas–
    Check out my 3D lightcycle game: http://www.gltron.org
    More than 100’000 Downloads of the last version (0.59)

Right, I intend the server to be completely independent of the game. In
fact, any game or program using the proper API could make use of the
server.

The quick way for me to do it would be to write it in C for unix. I was
thinking that using SDL_net and something cross-platform for the database
stuff would be an easy(?) way to have it be more platform independent so
that I can distribute it, because I think a lot of people would find it
useful. Or, I guess I could just run the server on linux, and allow
others to make use of MY server. I’ll think on it some more…On Tue, 20 Mar 2001, Thatcher Ulrich wrote:

When you’re talking about an Internet application like this, it’s
important to make a distinction between the server and the client. The
client will be the game running on the user’s machine, with graphics and
sound, using SDL etc. On the other hand, for a high score table, there’s
no reason for the server to run any game code, so there’s not a great deal
of call for using SDL on the server side.

A typical industrial-strength cross-platform way to code the server side
is to use Perl with its DBI module in conjunction with whatever
web/database server software you want to run. Perl is cross-platform, and
DBI abstracts the database interface (sort of SDL for databases). But
unless you’re going to distribute the server code so other people can set
up their own high-score tables, I’m not sure it matters much.

-Thatcher

Nice idea, but there’s one major problem: security. How do you keep people
from posting fake scores with hacked clients?

If it’s going to be Open Source, you can’t use the “security through
obscurity” approach at all, although that’s not recommended anyway. (It’s not
that hard to read asm code…)

One way would be to require the game to post a description of the whole game
session (something like the log files that Quake III and other games can
generate for debug purposes), and have the server scan that for sequences of
events that wouldn’t be possible with the original game. That would make
cheating harder, but it would still be possible to hack slowmotion clients or
"player helper bots" to get insane scores.

The only really safe method I know of is to have the server supervise the
game in real time, but it only works in conjunction with clients that make it
totally impossible to implement helper bots or other cheating hacks. That is,
it’s not really possible to do with most kinds of games. (How would you
prevent someone from adding an auto aim + fire helper to an open source FPS
engine, for example?) Also, it’s probably viable only for online games, at
least for modem users…

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Tuesday 20 March 2001 16:52, Lyle Hanson wrote:

Hi!

In conjunction with the game I’m working on now, I want to develop sort of
a central high-scores server that games (not just mine) could use to track
high scores and statistics. I’m pretty excited about it, it’d be neat if
users could see how they rank among the rest of the world.

I don’t know, maybe a API that isn’t dependent on SDL, like SDL_net is.
In fact I don’t see any reason why a system like this should be
dependent on SDL, or any other media API.On Tue, Mar 20, 2001 at 07:55:31PM +0100, Andreas Umbach wrote:

All that’s needed is a addon-lib for SDL_net (probably something like
SDL_http) and a little interface to send / query / update scores.

Martin

Bother! said Pooh, as he was assumed to be a lamer…

All that’s needed is a addon-lib for SDL_net (probably something like
SDL_http) and a little interface to send / query / update scores.

I don’t know, maybe a API that isn’t dependent on SDL, like SDL_net is.
In fact I don’t see any reason why a system like this should be
dependent on SDL, or any other media API.

Well, my primary reason for considering SDL is that by using SDL_net, I
could keep the system portable (to SDL-supporting platforms) rather than
use unix system calls for the networking. Just in case somebody would
want to run it on anything besides unix.On Tue, 20 Mar 2001, Martin Donlon wrote:

On Tue, Mar 20, 2001 at 07:55:31PM +0100, Andreas Umbach wrote:

Yeah, but its not really a complicated system, its just a matter of
connect, read, write, close. Requiring SDL and SDL_net for a few simple
networking functions seems a bit over the top.On Tue, Mar 20, 2001 at 04:43:57PM -0500, Lyle Hanson wrote:

Well, my primary reason for considering SDL is that by using SDL_net, I
could keep the system portable (to SDL-supporting platforms) rather than
use unix system calls for the networking. Just in case somebody would
want to run it on anything besides unix.

Martin

Bother! said PoohI only wanted to stun Tigger.

Like you said, its open source, there isn’t really much you can do to
prevent people from cheating in one way or another and the solutions are
too complex to justify the problem. What are you gonna do?On Tue, Mar 20, 2001 at 08:50:56PM +0100, David Olofson wrote:

The only really safe method I know of is to have the server supervise the
game in real time, but it only works in conjunction with clients that make it
totally impossible to implement helper bots or other cheating hacks. That is,
it’s not really possible to do with most kinds of games. (How would you
prevent someone from adding an auto aim + fire helper to an open source FPS
engine, for example?) Also, it’s probably viable only for online games, at
least for modem users…

Martin

Bother, said Pooh as Kanga gave birth to a monster.

Like you said, its open source, there isn’t really much you can do to
prevent people from cheating in one way or another and the solutions are
too complex to justify the problem. What are you gonna do?

Not only in open source happen that kind of things.
The solution is to make the client just a stupid box for showing GFX and get
input to server, don’t let the client do any kind of game logic computation only
predition to try to speed up to the latency

              Miguel Angel Blanch Lardin

         -- http://www.arianne.cx -- Arianne --

The free open source massively multiplayer online role playing game

nuclear cia fbi spy password code encrypt president bomb iran irak korea cuba
Ala yihad mosad kgb free freedom human rights yugoslavia kosovo ebola dna

                -- Echelon must die --

Well, most of it would have to be done on the server side, obviously, as
everything else can be cheated with. The "upload log file for analysis"
method is the only workable way I can think of ATM.

Forward to sysadmin if someone tries to file a Quake III Arena single player
session with 100% hits in 1734 shots, and no frags for the bots, all at the
toughest level, for example. :slight_smile:

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Tuesday 20 March 2001 23:26, Martin Donlon wrote:

On Tue, Mar 20, 2001 at 08:50:56PM +0100, David Olofson wrote:

The only really safe method I know of is to have the server supervise
the game in real time, but it only works in conjunction with clients that
make it totally impossible to implement helper bots or other cheating
hacks. That is, it’s not really possible to do with most kinds of games.
(How would you prevent someone from adding an auto aim + fire helper to
an open source FPS engine, for example?) Also, it’s probably viable only
for online games, at least for modem users…

Like you said, its open source, there isn’t really much you can do to
prevent people from cheating in one way or another and the solutions are
too complex to justify the problem. What are you gonna do?

The only really safe method I know of is to have the server supervise the
game in real time, but it only works in conjunction with clients that make it
totally impossible to implement helper bots or other cheating hacks. That is,
it’s not really possible to do with most kinds of games. (How would you
prevent someone from adding an auto aim + fire helper to an open source FPS
engine, for example?) Also, it’s probably viable only for online games, at
least for modem users…
Like you said, its open source, there isn’t really much you can do to
prevent people from cheating in one way or another and the solutions are
too complex to justify the problem. What are you gonna do?

sigh Yes, this is a NASTY problem, isn’t it? Well, for MY purposes I’m
thinking that my game will be played, but nobody (well, essentially – but
there’s always ‘that guy’) will have much reason to spend any time coding
a cheat. Even if there IS cheating, the system remains useful for people
to track their OWN progress and get a general feel for where they stand
among the majority of other players (an individual’s records will require
a password to update). I guess I AM relying on a form of security through
obscurity since I’m assuming that my game will not become wildly popular,
therefore there won’t be as much temptation for people to seek out my
system and spend the half-hour it would take to code a cheat.

This is kinda getting away from SDL, and Sam’s probably getting annoyed.
I know that a lot of different list-split scenarios were talked about
before, but I think what makes most sense to ME is to keep the
sdl-announce, sdl-users (for API questions/problems), and then have a list
where we can freely discuss game development ideas that aren’t neccesarily
related to SDL. A lot of the longest threads on THIS list stem from some
neat idea or concept that somebody mentions, and not an SDL issue per se.
(Of course, SDL would likely be used to implement those ideas…) But it’d
be nice to babble on with fellow SDL’ers about projects/ideas. Just my
$.02.

LyleOn Tue, 20 Mar 2001, Martin Donlon wrote:

On Tue, Mar 20, 2001 at 08:50:56PM +0100, David Olofson wrote:

David Olofson wrote:> On Tuesday 20 March 2001 16:52, Lyle Hanson wrote:

Hi!

In conjunction with the game I’m working on now, I want to develop sort
of a central high-scores server that games (not just mine) could use to
track
high scores and statistics. I’m pretty excited about it, it’d be neat
if users could see how they rank among the rest of the world.

Nice idea, but there’s one major problem: security. How do you keep people
from posting fake scores with hacked clients?

There is no really workable solution for single-player games. David’s
complete log analysis idea is one computationally expensive method with
some possibility of success. Another idea is to allow viewers to filter
unlikely scores on their own or to build trust networks of players who
believe each other’s scores. The end result of this unfortunately would be
like the newer “less than perfect, but better than the lame dork who wants
to cheat” aim-bots for Quake and all, generating scores that are good but
not impossible.

For multi-player games, the method many multiplayer games use is to require
all players to submit their own “version” of the score, which the server
compares when committing scores to the ranking system. But then you have to
worry about dummy and hacked/spoofed accounts.

All in all, it’s an interesting set of problems to which there are no cheap
easy answers. You just have to decide how important accuracy is to you
versus the motivation to cheat. For a small community of players, a simple
web form with passwords could work. For something that begins to attract
large numbers of players, nothing you can do will prevent a Red Queen
race vs. the cheaters.


SmokeSerpent <@Benjamin_Moos>
“The purpose of writing is to inflate weak ideas, obscure pure reasoning,
and inhibit clarity. With a little practice, writing can be an
intimidating and impenetrable fog!” – Calvin

Yes, but that doesn’t stop you from hacking an auto-aim tool into your
client, guaranteeing that every shot you fire is aimed dead center at the
closest object that could be a target. It doesn’t stop you from writing
something that moves your character when a fast moving object on collision
course is detected.

Unless the cliend doesn’t even do the world->screen transformations, that is.
:slight_smile:

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Wednesday 21 March 2001 00:29, x5101920 at fedro.ugr.es wrote:

Like you said, its open source, there isn’t really much you can do to
prevent people from cheating in one way or another and the solutions are
too complex to justify the problem. What are you gonna do?

Not only in open source happen that kind of things.
The solution is to make the client just a stupid box for showing GFX and
get input to server, don’t let the client do any kind of game logic
computation only predition to try to speed up to the latency

Sounds like Windows alright. I remember my days back working with MFC and
the nightmare it was trying to get simple things like that to work.
Eventually with enough trial and error and learning, you either find out how
to do it or some hack that’s “pretty good” considering, or else find out it
can’t be done.On Monday 19 March 2001 21:54, you wrote:

All well and good, but I set an event handler to printf any time
SDL_ACTIVEEVENT is fired off, and minimizing, restoring, and even
tab-cycling or mouse-clicking on my windowed app never cause it to receive
this event…

Hello!
I have just started using SDL as a base of my future game project. I have
a question related to Midi-music. I would like to implement a music system
where I could play different Midi-musics simultaneously in different
channels (e.g. drums on one channel, guitar on the other etc.) I would
like to be able to start/stop/fade in/fade out these channels separately.

Is this possible with SDL_mixer? It seems that with Waves this would not
be a problem, but is there a some sort of channel-system for Midis also?
Currently I have not been able to play more than one Midi-track at a time.

So I would like to know if some one has succesfully implemented something
like this or at least believes that it is possible? Any clues would be
highly appreciated.

Regards,
-Mikko Laakso