News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Roland, probably the worst Amstrad CPC emulator

Started by antoniovillena, 12:12, 04 May 11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

antoniovillena

Now you can record games with Roland, look at these examples:

http://roland.antoniovillena.es/464s?TnmT0w.rec
http://amstradcpc.es/emulador/464.html?TnocxQ.rec

As easy as pressing F6 when you end your game

Gryzor

Heeey, this is pretty neat!

I always wondered, how is this done?

antoniovillena

Quote from: Gryzor on 19:07, 21 September 11
Heeey, this is pretty neat!

I always wondered, how is this done?


The recordings are made with the emulator itself. Just launch a game (from roland.antoniovillena.es or amstradcpc.es) and press F6 key when finish. You can interrupt the playback with F3, or go to the end of the playback with F4, and then, continue playing.

Gryzor

Well, yes, I gathered that much, but *how* does the emulator do it? How does it record it?

One way to do it in other emulators is to record input, but this doesn't work in non-predetermined games...

Devilmarkus

Quote from: Gryzor on 08:13, 22 September 11
Well, yes, I gathered that much, but *how* does the emulator do it? How does it record it?

One way to do it in other emulators is to record input, but this doesn't work in non-predetermined games...

Why not?
When the timing is 100% accurate, also "random values" are the same!

Sadly the VSync in JavaCPC seem to be not 100% accurate...
Recordings get out of sync after a while... :(
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Gryzor

Maybe I don't understand something about how games are modified at launch.

If you get a game where the enemies are found in random positions with each new game, or where the items are in random rooms etc. etc, what good would input recording do?

Devilmarkus

Well, random numbers are generated in Z80.
A recording looks like this:
- Take a SNA snapshot
- keep this snapshot in memory
- record keyboard input
- When done, save SNA with attached keyboard inputs.

The random values so are always the same!
(You can try in BASIC! When you print a random number with a "RANDOMIZE xxx" before, the random numbers are always the same after a RUN)
So a SNA also does a kind like "RANDOMIZE" when loaded...
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Gryzor

Ah, yeah, I thought of the snapshot thing, but I thought I can't be that clever - so it must be something else :D

Ok, simpler than I thought then. Thanks!

Phi2x

#33
.

Gryzor

Yeah, I guess this makes sense: determine the initial conditions and you're all set...

antoniovillena

#35
Yes, the key is that all in a computer is deterministic. If you save the state of a machine and record exactly all the input (keystrokes and mouse events), then you will show the same results in the output (screen and audio)

As Devilmarkus says, the emulator must be accurate to work with other emulators recordings (there is a SNP format). If JavaCPC fails in VSYNC, probably Roland fails in other stuff. So it uses their own recording format.

As phi2x says, Roland uses TAPs and DSKs in normal cases. Also there is a special case (for example if you want to record only the second level of a game) where you can use also SNAs.

So Gryzor, there is not any secret in input recording. The only change in the emulator is that now I sample the keystate every frame (because keystrokes are recorded in frame units, 20ms). Not necesary if you use CPU cycles as time unit.

Devilmarkus

Quote from: antoniovillena on 12:41, 22 September 11
Not necesary if you use CPU cycles as time unit.

I also tried with CPU cycles!
There's still a sync problem with!
Funny:
When I just change a bit of the code it already causes these problems!
I mean: Use the same code but with different variable names for example!

And that's really strange....
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Phi2x

#37
.

antoniovillena

Quote from: phi2x on 13:30, 22 September 11
So, would it be a desirable feature to have for a CPC emulator?
Would it help us enjoy insanely difficult games? Or would it spoil all the fun?

You can do rollback in Roland (with F3 and F4). Then if you save the gameplay, you will
see the perfect playgame (the mistakes were deleted in the recording).

Yes, It's not exactly the REWIND feature, but running backwards an emulator is a very difficult task. You must save a log with past values in not reverseable instructions (like ld bc,0). Also the reverseable instructions (like add a, b) must log some flags.

Phi2x

#39
.

Phi2x

#40
.

Gryzor

Holy frak, rewinding is fantastic!!!! I want it for the CPC emulators now...

antoniovillena

Quote from: phi2x on 14:48, 22 September 11
Thinking about it a bit more, differential snapshots are not that practical because you have to process every differential since the first one to extract that snapshot when you'll want to rewind. So, it will be very heavy on the CPU.
It's like video encoding in a way. What they do in video encoders is storing keyframes at regular intervals between differential frames.
So, it would be a mix of full snapshots (every 10 frames?) and differential ones.

Let's do the math again:
full snapshots : 128KB * 5 frames * 30 seconds = 19200KB
+ differential snapshots: 8KB * 45 frames * 30 seconds = 10800KB

19200KB + 10800KB = 30000KB = 30MB

Still a bargain  :) ... but more complex than I thought!

Another solution is saving full snaspshots every, for example, 5 seconds. If you rewind 2 seconds, and for example the last snapshot is saved 3 second back, you only have to emulate 1 second forwards to extract the correct snapshot. The worst case is to emulate 5 seconds forward but it's easy because you don't have to do in real time (cpu can be full throtle) and to show anything to screen or buffer sound.

The other question is that you must log a circular buffer every frame of last 5 seconds (or the time you want to rewind) to show the user the illusion of the rewind. But in this case you only must save the video screen (16Kb each frame).

So redoing the calcs, you need: 128K * 1/5 * 30 seconds= 768k
For video buffer: 16K * 50frames/second * 5 seconds= 4Mb (video buffer is the same indepently on recording duration)

I have made a recording of a difficult game (with rollback of course) here:

http://amstradcpc.es/emulador/664.html?TntBgA.rec





antoniovillena


In this link you can view the recorded gameplays, only the ones in that players fill user & comment field.

http://amstradcpc.es/emulador/partidas.php

RockRiver

Quote from: antoniovillena on 21:40, 04 May 11
I owns a ZX Spectrum +2A)
Thanks for your work!!! mate.
I recommend to you to acquire a +3 [disquette support compatible PCW and CPC] and then a 6128. These are two of my favorites retro-compus. HcX compatible too ;-)
Or study the great emus that support that... in +3 side I like so much RealSpectrum with "real"disquette reading like WinAPE. This make easy sharing software within my real and virtual machines.

Mochilote

Roland running at 9x% on iphone 4 (IOS 5.0.1):







it's a shame that can not be used because they have no on-screen keyboard... :D

Gryzor

Hmmm unfortunately the % doesn't show up on my Android browser... impressive though!

antoniovillena

I have seen this page:
http://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/


So it's possible to map the joystick by clicking in the border. I have not Android or IOS mobile, so I can't try, but it's a good suggestion for the next version of Roland.



   |       |
---|-------|---
U |       |
D |       |
---|-------|---
F |  L  R |



  Sorry the ugly Ascii, so I propose these locations for UP, DOWN, LEFT, RIGHT and FIRE.


  Another question, is all the keyboard mapped in these devices or i need remap some keys (or adding touch support)?
-----

antoniovillena

Updated emulator


Roland, probably the worst Amstrad CPC emulator


Because it lacks of sound in latest versions of Firefox. Now I have ported the Firefox code to Web Audio Api and works well.

Zoe Robinson

Quote from: antoniovillena on 23:25, 05 June 14
Updated emulator


Thank you for removing any chance of me getting any work done today. :)


*goes back to playing Silkworm on your website*

Powered by SMFPacks Menu Editor Mod