[Scummvm-devel] Non-hardcoded gameids

Max Horn max at quendi.de
Tue May 30 14:47:00 CEST 2006


Am 30.05.2006 um 17:55 schrieb David Given:

> I'm looking at writing some Engine classes for ScummVM, and was
> wondering if there was any way of avoiding having to hard-code a  
> list of
> gameids and game titles. The platform I'm implementing is totally
> generic, so that I don't know the title ahead of time.
>
> It's a little grotesque, but I could remember all gameids seen so  
> far in
> the ScummVM configuration file, so that I can implement
> Engine_*_gameIDList() and Engine_*_findGameID() --- but this means  
> that
> Engine_*_detectGames() would, when looking at a directory that hasn't
> been seen so far, return a GameDescriptor that wasn't on the list I
> returned, and I'm not sure that's legal.
>
> The other approach is to implement a single generic game which I  
> use for
> all my titles, but this is unpleasant because it means that a ScummVM
> session can only have one set up at a time.
>
> Any suggestions?

Eugene already gave a good reply, I think. Let me just stress one  
point: Being fully generic w.r.t. to gameid's isn't possible with our  
current design, because then we'd loose the ability to decide which  
engine plugin is supposed to handle a given *target* (note the  
difference between target (a config file entry), and gameid). Before  
somebody shouts "foul, of course we could do that, just add a  
plugin=XYZ config key" -- Very true, but that doesn't gain us  
anything, it just makes the entry a bit longer:

[supergame]
description=Test game for uber l33t engine
gameid=a_funky_game_id
plugin=l33tengine
path=/whatever

is not in any way better than this, IMO:

[supergame]
description=Test game for uber l33t engine
gameid=l33tengine
path=/whatever


So, just return a single generic gameid in Engine_*_gameIDList, like  
agi does. Your Engine_*_detectGames still can returned fine grained  
target records, including a nice description text which indicates the  
true name of the game.

The only drawback this has is that ScummVM can't include all those  
games in the list of supported games ("./scummvm --list-games"). But  
obviously, that's not possible anyway in your situation, no matter  
what we do :-)


Cheers,
Max




More information about the Scummvm-devel mailing list