General Election

Propose new game/software design concepts or new game/software ideas. They can be as whimsical as you like, just be careful you don't ask someone to make it for you...
Post Reply
User avatar
Fahnn
Microbot
Posts: 135
Joined: Sun Jan 27, 2019 7:56 pm
Location: Redcar, UK
Contact:

General Election

Post by Fahnn »

Something that I'd quite like to do is a General Election simulator on the Spectrum. I know that they've been done before, but - and I hope I'm not unnecessarily insulting anyone here - they've all been a bit rubbish. I'm pretty sure I can do something far better, one that takes in multiple elections over a wide time period and stores all the results, right down to the individual constituency votes in each one. Probably more of a database of generated results than a game, though. But I'm kind of into that sort of thing. And there could be a rudimentary gameplay framework in between the elections that could affect the way particular constituencies will vote.

I think it would come down to how much data could be realistically held in a BASIC program. The number of constituencies wouldn't be a problem, as it could be adjusted, but the amount of data (particularly historical electoral data) held on each one could become constrictive. If I went for 650 constituencies (as there are now), I think there'd need to be at least ten persistent variables for each one (to handle current electoral situations), some of which might be able to be stored in one byte but some would definitely need two, so that's probably 15 bytes for each one at a minimum, before I realise there's other things that need to be in there. Candidate names would be random, but persistent, so the member elected for e.g. East Kirktown would always be there, until beaten in an election (and then he or she could pop up elsewhere, contending a different seat). I think the constituency names can be done in two bytes each, but they'd be a bit repetitive and even doing that, constituency data would probably take up about 12,000 bytes, over a quarter of the memory gone already. Then each historical vote would take at least five bytes per constituency (assuming five main parties) and that's over 3K per vote. I'm sure that could be compressed in some way (treating the major parties differently to the minor ones, maybe) but it's still too big. I'd love to see how much of it I could get into 48K, though.

However, could the 128K Spectrum be the answer? I've never done any programming on a 128K machine, but as I understand it, there are banks of memory that can be used, but is that a simple thing to do from BASIC? I can see how it would work from code, but am unsure how BASIC could realistically use the extra memory, as I think I've only ever seen it used for throwing more graphics onto the screen or playing music. Can all the banks be used to store more data (probably text, but could be numerical)? And how easy is it to switch between them? Is it even worth doing? If it was, there'd be some games of this type for the 128K and as far as I can see, there aren't.

Sorry, lots of questions!
User avatar
PeterJ
Site Admin
Posts: 6858
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: General Election

Post by PeterJ »

With the current state of politics in the UK I think it may be rather dull!
User avatar
Fahnn
Microbot
Posts: 135
Joined: Sun Jan 27, 2019 7:56 pm
Location: Redcar, UK
Contact:

Re: General Election

Post by Fahnn »

PeterJ wrote: Sat Apr 13, 2019 8:03 pm With the current state of politics in the UK I think it may be rather dull!
It'll be set in a non-specific time period. That's kind of why I want to do this now. Politics has become uninteresting. At the moment it's in a kind of stasis and it needs to move on, the obsession with Brexit is tedious and counter-productive. Most people don't care about Europe, it's really just the obsession of a small corner of the Conservative Party. And yet, here we are. A one-issue parliament, pretty much, to the detriment of everything else.

So yeah, I want to simulate something more interesting. A more interesting political climate. With scandals, lots of scandals. Sex scandals, extortion rackets, intimidation, hard words and stuff. Over a number of decades, see if you can survive. Could be good.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: General Election

Post by ZXDunny »

The amount of data and processing you'd need would indeed be too much for a Spectrum, especially in BASIC unless you're going to dumb it down rather a lot. Have you considered doing this on a PC? Or if you absolutely must do it on a speccy, then maybe target ones with mass storage (the +3e, Next etc)?
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: General Election

Post by Einar Saukas »

Fahnn wrote: Sat Apr 13, 2019 7:33 pmHowever, could the 128K Spectrum be the answer? I've never done any programming on a 128K machine, but as I understand it, there are banks of memory that can be used, but is that a simple thing to do from BASIC? I can see how it would work from code, but am unsure how BASIC could realistically use the extra memory, as I think I've only ever seen it used for throwing more graphics onto the screen or playing music. Can all the banks be used to store more data (probably text, but could be numerical)? And how easy is it to switch between them? Is it even worth doing? If it was, there'd be some games of this type for the 128K and as far as I can see, there aren't.
If you want to use 128K in a program to be developed exclusively in BASIC, then technically you must reserve the top 16K of memory for data. Your BASIC program could have at most 25K in size (instead of 41K), and use the OUT command to switch one of the 6 free pages into the top 16K. However this data in top 16K could be only accessed using PEEK and POKE. It's not efficient to access data from BASIC this way, thus the reason nobody does it...

A more practical alternative would be writing this program in BASIC, but storing Assembly routines and data in these pages at the top 16K. For instance, a game in BASIC that uses the lower 2/3 of screen for the actual gameplay, and simple Assembly routines to decompress graphics into the upper 1/3 of screen. It could look somewhat like Hobbit 128 (except in this case it's 100% Assembly and graphics use top 2/3).
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: General Election

Post by djnzx48 »

Couldn't you split the program up into different parts and use the RAMdisk to load from? And compression would help to keep the size down (probably Huffman and a variation of LZ for text). ANS was another compression algorithm I looked at, but unfortunately the size of the table required meant it couldn't beat Huffman for realistic text sizes (say 50K or less).
User avatar
Fahnn
Microbot
Posts: 135
Joined: Sun Jan 27, 2019 7:56 pm
Location: Redcar, UK
Contact:

Re: General Election

Post by Fahnn »

Cheers, everyone. I think I had some weird idea that the extra 80K could all be used to simply extend a BASIC program, whereas I now see that can't really be done, or at least not in any straightforward way. And unless it's very straightforward, I probably won't be able to do it.

Another thing I wondered about is making a game composed of multiple 48K snapshot files for different game sections, which could be saved and loaded in a sequence dictated by the choices you make in the main section. Something like that, anyway.
ZXDunny wrote: Sat Apr 13, 2019 11:07 pm Have you considered doing this on a PC?
I have, but part of the appeal of doing things on the Spectrum is the extremely limited memory available. If I tried writing this sort of game on a PC I'd be tempted to throw everything in including the kitchen sink, it would go on forever and probably end up being a bloated mess.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: General Election

Post by djnzx48 »

There are games out there that used dynamic loading from tape. I believe 'The Rats' has a selection of in-game events which the loader program randomly chooses from, but this is only done at the start of the game. And I can't find it now, but someone made a BASIC adventure game where every choice you made led to a new paragraph, which was loaded from tape as data. Obviously this would only be feasible using emulators or extra hardware, as the constant rewinding and fast-forwarding would become too annoying on a real machine.

A program dealing with a lot of data may still be feasible, depending on how much you want to rely on factors such as tape acceleration, disks, mucking around with the cassette player, and so on.
AndyC
Dynamite Dan
Posts: 1388
Joined: Mon Nov 13, 2017 5:12 am

Re: General Election

Post by AndyC »

djnzx48 wrote: Sun Apr 14, 2019 12:35 am Couldn't you split the program up into different parts and use the RAMdisk to load from? And compression would help to keep the size down (probably Huffman and a variation of LZ for text). ANS was another compression algorithm I looked at, but unfortunately the size of the table required meant it couldn't beat Huffman for realistic text sizes (say 50K or less).
The biggest problem with that is that RAMdisk syntax varies between 128 models. The toastrack and grey +2 use the LOAD!"file" syntax, whereas the +2A/+3 use the +3DOS syntax of LOAD "m:filename". This makes using it in a compatible way between different models impossible.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: General Election

Post by djnzx48 »

Oh, I forgot about that. Well, there's always the option of directly POKEing the BASIC to add the '!' based on the detected model.
User avatar
Fahnn
Microbot
Posts: 135
Joined: Sun Jan 27, 2019 7:56 pm
Location: Redcar, UK
Contact:

Re: General Election

Post by Fahnn »

djnzx48 wrote: Sun Apr 14, 2019 10:52 am There are games out there that used dynamic loading from tape. I believe 'The Rats' has a selection of in-game events which the loader program randomly chooses from, but this is only done at the start of the game. And I can't find it now, but someone made a BASIC adventure game where every choice you made led to a new paragraph, which was loaded from tape as data. Obviously this would only be feasible using emulators or extra hardware, as the constant rewinding and fast-forwarding would become too annoying on a real machine.
Yes, it's the instant-access benefits of emulators that got me thinking about this in the first place. I assumed that at least a few games using this technique would have been written since emulators became commonplace, but after a bit of a poke around I couldn't find any (of course, that doesn't mean that such games don't exist). Maybe it's like when CDs became available for data storage and games started including long sections of video seemingly just to fill up the available space. I think I read somewhere that if you were to write a text adventure for the Spectrum that used all the data capacity of a CD, it would be the equivalent of writing 1,500 full-length novels. Possibly that's why no-one got around to it.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: General Election

Post by djnzx48 »

I don't remember any games that make use of advanced tape loading, but if you're including demos then this is a good example of what can be achieved with emulators.
User avatar
Fahnn
Microbot
Posts: 135
Joined: Sun Jan 27, 2019 7:56 pm
Location: Redcar, UK
Contact:

Re: General Election

Post by Fahnn »

djnzx48 wrote: Sun Apr 14, 2019 12:41 pm I don't remember any games that make use of advanced tape loading, but if you're including demos then this is a good example of what can be achieved with emulators.
Going off-topic a bit, but I'm so impressed with some of these Spectrum demos, I've been watching a lot of them on Youtube recently. When I was first getting into making music with trackers on the Amiga, I bought quite a few (SoundTracker, ProTracker, Digitrakker, Octamed, etc.) for a quid each out of the back of Computer Shopper and suchlike. They always came with demos, but those Amiga demos just aren't as impressive as the best Spectrum demos I've seen, either graphically or sonically. I can't put my finger on why, exactly. The Amiga demonstrably has better graphics and sound, but the people making the Spectrum demos just seem to try harder. Maybe that's it.
User avatar
zack4mac
Drutt
Posts: 17
Joined: Sat Apr 13, 2019 1:20 pm

Re: General Election

Post by zack4mac »

Perhaps a political satire game? maybe mix The Prisoner in for good measure! or just have Characters popping up like the Prince Charles Dalek in Head over Heels, I only wish that I kept using my C64 or ST and learnt to program, instead I spent the next few years trying to get my PC ruining solid, needles to say it never happened. :roll:
User avatar
Fahnn
Microbot
Posts: 135
Joined: Sun Jan 27, 2019 7:56 pm
Location: Redcar, UK
Contact:

Re: General Election

Post by Fahnn »

zack4mac wrote: Sun Apr 14, 2019 1:13 pm Perhaps a political satire game?
Oh, for sure, it would have to be, I'm not capable of writing anything serious. There always have to be jokes and utterly ridiculous situations (that lend themselves to more jokes). If I tried anything different, my fingers would probably fall off (I've not tested this theory, but I'm pretty sure of its validity).
Post Reply