Jump to content



Photo
- - - - -

FP and Pinmame - theoretically possible


  • Please log in to reply
192 replies to this topic

#101 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 17 January 2011 - 08:09 PM

thanks - I tested it full screen and there were no slow downs, but of course the pinmame window was then not visible. I guess it would work fine if you had it on a second monitor or something.

Has anyone built an alphanumeric gas segment display in FP? if someone were to build one like those seen in VP, in the same order, I am pretty sure I could light it up from pinmame. I thought about using the 'define pattern thing with FP but I'm not sure it would work.

#102 FDSystems

FDSystems

    Eclectic end-user

  • Charter Member
  • 2,477 posts
  • Location:Bahia

  • Flag: Brazil

  • Favorite Pinball: I will have to find out again.............

Posted 17 January 2011 - 09:02 PM

QUOTE (highrise @ Jan 17 2011, 03:44 PM) <{POST_SNAPBACK}>
thanks - if anyone would like me to demo this on a pre-built FP table then just send me a PM. As I said, what you will have to do is put all the lights into an array for me, and I will then be able to point pinmame at it.


I´m in awe! surprise.gif otvclap.gif

Any plans to use your skills to develope something for VP too?

Edited by 1234fd, 17 January 2011 - 09:03 PM.

From Brasil. Updated version of 1234fd



#103 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 17 January 2011 - 10:53 PM

I'm confused... last time I checked VP already had Pinmame support...? what did you have in mind?

#104 DedRok_V

DedRok_V

    Crazed Pinball Wizard (Australia's Former #1)

  • Platinum Supporter
  • 2,238 posts
  • Location:Newcastle, Australia

  • Flag: Australia

  • Favorite Pinball: Avengers Blue LE : Judge Dredd : Cosmic Princess

Posted 18 January 2011 - 01:20 AM

Looks like you've cracked it, good one highrise




Blueprint game : up to date list http://www.vpforums....s...st&p=147107

#105 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 18 January 2011 - 02:17 AM

well, I don't know about that. I guess you could say that the tunnel from the outside world into FP has been dug. However, someone still has to dig a tunnel out of FP into the outside world. I am still not sure how to achieve this, but I do believe it is possible.

#106 FDSystems

FDSystems

    Eclectic end-user

  • Charter Member
  • 2,477 posts
  • Location:Bahia

  • Flag: Brazil

  • Favorite Pinball: I will have to find out again.............

Posted 18 January 2011 - 02:29 AM

QUOTE (highrise @ Jan 17 2011, 07:53 PM) <{POST_SNAPBACK}>
I'm confused... last time I checked VP already had Pinmame support...? what did you have in mind?


You already have made research & development in various directions, I thought you might have new ideas.
Anyway thank you for your efforts, even if I cannot fully understand to where they lead... dblthumb.gif
From Brasil. Updated version of 1234fd



#107 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 18 January 2011 - 04:45 AM

if you look in the VP threads you will find lots of things I have done with VP - rom-free fading light system, DMD system, XML ROM system and so on smile.gif

I ran some test tonight with getting VPM to run an LED display in FP. I got it to communicate with it, but the LED system in FP uses a completely different set of segment values. So I tried redefining each pattern using a conversion algorithm but it didn't work so well, and also ran far too slowly. Quite frustrating really.

#108 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 20 January 2011 - 03:53 AM

ok guys, having got stuck with using the nvram, I have an idea for getting FP to talk to pinmame which I think is feasible. BUT I need someone to help because I don't know how to achieve it script wise.

The idea is this - I put a small alphanumeric display in the bottom corner of the screen, set to white. This can display numbers in a way that should be possible to be read. In fact, it should be able to display more than numbers - we should be able to redefine a set of characters, perhaps 128 of them, to allow each digit to send 7 bits of data.

Here is a screen shot of how it might look. Using 32 characters it would potentially allow up to 32 switches to be hit at once with data being sent quite quickly.

So who thinks they can come up with something that can read this? each segments should be positioned relative to the next and so I'm hopeful some clever soul will know how it could be done. You would have to take into account resolution but that should not be too hard to do.

if this can be done, I think we will have 2-way communication and thus, roms in fp.

UPDATE: I have found that this small, the LEDs are not even. However, if I make them 16 across, then they come out exactly 21 pixels across in 1024 x 768. So each square can be mathematically defined.

Attached Files


Edited by highrise, 20 January 2011 - 04:06 AM.


#109 magnox

magnox

    Hobbyist

  • Silver Supporter
  • 47 posts

  • Flag: Scotland

  • Favorite Pinball: JackBot

Posted 20 January 2011 - 05:24 AM

That's overkill Highrise. There is no need to display alphanumerics - machines operate with a switch matrix, so all that is really needed is something like a 12x12 grid of pixels that represent the switch on/off state. A grid switch could be made 'off' with a colour of 255,255,255 and 'on' with a colour of 255,255,254 or similar. The eye can't pick up the difference, but a program could and it would negate having something noticeable on the screen. FP can output that state, no problem and I'm sure VPM could be altered to read the grid.

The problem, as you have already identified, is passing the VPM information quickly enough back to FP.

#110 settingsons

settingsons

    Pinball Fan

  • VIP
  • 959 posts
  • Location:Switzerland

  • Flag: Switzerland

  • Favorite Pinball: Terminator 2 and many EM machines



Posted 20 January 2011 - 07:20 AM

.......and you could put the pixel matrix on the HUD which stays in a fixed position when the user switches viewing angles.

In AHK (and Autoit must have similar) there is a function to read a single pixel colour at a specified co-ordinate.

PixelGetColor Retrieves the color of the pixel at the specified x,y coordinates.
PixelSearch Searches a region of the screen for a pixel of the specified color.
(ref: AHK Commands )

and the PixelSearch would be useful to determine the exact starting co-ordinate of the matrix on the screen (in case the position varies slightly - you could have a sequence of pixel colours just before the matrix to identify its position). It would be established once when the program runs and kept in a variable - then the grid could be read from that offset position (determined by the variable) using the PixelGetColor function.

...need to rush to work now.

Edited by settingsons, 20 January 2011 - 07:21 AM.


#111 sza

sza

    Enthusiast

  • Members
  • PipPipPip
  • 75 posts

  • Flag: ---------

  • Favorite Pinball: black hole

Posted 20 January 2011 - 08:26 AM

In autoit:

PixelGetColor ( x , y [, hwnd] ) Returns a pixel color according to x,y pixel coordinates.
hwnd -[optional] Window handle to be used.
you get 24 bits with one pixel

P.S. Probably it it best to use 0,0 coordinates, as they will remain in the corner, independently on the resolution used.

QUOTE (settingsons @ Jan 20 2011, 08:20 AM) <{POST_SNAPBACK}>
.......and you could put the pixel matrix on the HUD which stays in a fixed position when the user switches viewing angles.

In AHK (and Autoit must have similar) there is a function to read a single pixel colour at a specified co-ordinate.

PixelGetColor Retrieves the color of the pixel at the specified x,y coordinates.
PixelSearch Searches a region of the screen for a pixel of the specified color.
(ref: AHK Commands )

and the PixelSearch would be useful to determine the exact starting co-ordinate of the matrix on the screen (in case the position varies slightly - you could have a sequence of pixel colours just before the matrix to identify its position). It would be established once when the program runs and kept in a variable - then the grid could be read from that offset position (determined by the variable) using the PixelGetColor function.

...need to rush to work now.

Edited by sza, 20 January 2011 - 10:47 AM.


#112 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 20 January 2011 - 12:08 PM

thanks guys those are all helpful comments.

regarding using the alpha display - you see, the thing is, I don't think it is overkill. I had considered the other options as you suggested (discussed earlier in the thread)

However, the reason I thought about this were just what you say - the speed. Well, the speed and also the practicability. When I got the system working the other way, I started out with a system that sent one light command at once. What I found was that this was way too slow because the data stream was something like 30 to 40 commands per second.

I realise that the data sent back to VPM is probably going to be less because generally there are more lights than switches, but at the same time, the more bandwidth the better. Also, I thought, at least whilst it is being tested, using a control mechanism that is already built into FP, i.e the alphanumeric display, able to send 32 bytes of data in one shot, would be a good idea because it would mean not having to build something in FP from scratch - I don't know a good practical way of building a pixel grid which will render well in various different resolutions so as to be readable - can anyone help with that? maybe using lights? is there another way?

The thing to remember is that the first step is to get a working model, even if it is not particularly pretty. Once we have that, we can get a better idea of the bandwidth needed. I considered for instance the idea of putting the em display off the bottom of the screen where I could pick up just the top 'bit' of it. I don't know how many switches some of these earlier SS machines have but I suspect it might be less than 32.

Anyway, I have some pointers to work with, thanks guys.

Edited by highrise, 20 January 2011 - 12:11 PM.


#113 Manofwar

Manofwar

    Hobbyist

  • VP Dev Team
  • PipPip
  • 49 posts

  • Flag: Spain

  • Favorite Pinball: Attack from Mars

Posted 20 January 2011 - 01:08 PM

I've been testing a matrix of 8x8 pixels at 0,0 on the screen. It seems possible to read the information correctly.

The problem is the screen resolution, everyone has one, and the graphics are distorted. The array is resized and need to know that has real dimensions. This can be done at the beginning of the table, drawing an array such as chess (black, white, black,...).

This pattern is easily detectable and indicate the width and height of the matrix in real pixels, adjusting the reading to the actual size on screen.

Edit: I had not read the whole Settingsons response. This is exactly what I speak.

QUOTE
and the PixelSearch would be useful to determine the exact starting co-ordinate of the matrix on the screen (in case the position varies slightly - you could have a sequence of pixel colours just before the matrix to identify its position). It would be established once when the program runs and kept in a variable - then the grid could be read from that offset position (determined by the variable) using the PixelGetColor function.



Translated with Google

Edited by Manofwar, 20 January 2011 - 03:19 PM.


#114 Rawd

Rawd

    Pinball Wizard

  • VIP
  • 4,313 posts
  • Location:Edmonton, Canada

  • Flag: Canada

  • Favorite Pinball: Triple Strike



Posted 20 January 2011 - 03:11 PM

QUOTE (Manofwar @ Jan 20 2011, 06:08 AM) <{POST_SNAPBACK}>
I've been testing a matrix of 8x8 pixels at 0,0 on the screen. It seems possible to read the information correctly.

The problem is the screen resolution, everyone has one, and the graphics are distorted. The array is resized and need to know that has real dimensions. This can be done at the beginning of the table, drawing an array such as chess (black, white, black,...).

This pattern is easily detectable and indicate the width and height of the matrix in real pixels, adjusting the reading to the actual size on screen.

Translated with Google


In Arcade-render, I am sure that everyones image will be in a different place on the screen. Does that matter?



 


#115 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 20 January 2011 - 03:16 PM

I think putting the grid at (0,0) will work myself. Manofwar, that sounds promising. if you already have something practical and working then maybe we should work together? Fpinmame team? haha.

I have permission to use the Mata Hari table. What is needed is to put all the lights into the correct array, and do the same for the switches. I think then we will have a playable table.

There are still a few minor issues with the PM->FP end. Basically the system is writing a text file every 35 milliseconds, which FP is then reading when it gets a keypress. Sometimes an error occurs, which I think happens when it is trying to read the file whilst it is being written to. So my idea is to have two text files which the systems alternate. Hopefully this will solve that problem. Another possibility is to use the image grid to send a signal to the external script that it has executed the file so it can be overwritten - like a buffer.

Edited by highrise, 20 January 2011 - 03:19 PM.


#116 light66

light66

    Hobbyist

  • Members
  • PipPip
  • 41 posts
  • Location:Denmark

  • Flag: Denmark

  • Favorite Pinball: ATM T2

Posted 20 January 2011 - 06:24 PM

Just pointing out some possible problems here.

Binary should be the way to go, the alphanumerics is way too complicated to read.
You will need relatively large pixels/dots to compensate for all sorts of resolution and different OpenGL implementations to be sure you reed the correct value.

@ManOfWar:
How do you write your 8x8 matrix. Using 64 images, or?
And remember that you would also have to read 64 individual pixels and convert them to a usable value and that could be slow.

@highrise:
What happens to the code loaded with LoadExternalScript when you load more?
Does it dissappear or stay in the scripts space?

light

#117 settingsons

settingsons

    Pinball Fan

  • VIP
  • 959 posts
  • Location:Switzerland

  • Flag: Switzerland

  • Favorite Pinball: Terminator 2 and many EM machines



Posted 20 January 2011 - 07:34 PM

QUOTE (Rawd @ Jan 20 2011, 04:11 PM) <{POST_SNAPBACK}>
In Arcade-render, I am sure that everyones image will be in a different place on the screen. Does that matter?


I thought that as well Rawd although I don't know much about scripting in FP so it maybe possible to fix something to position 0,0? If that is not possible then one thing that is fixed in one place all the time regardless of the viewing angle is the HUD (that was previously mentioned to me by Steve at GoPinball).

Even if the HUD position varies from table to table it could be identified by searching for the starting point of the HUD that would be indicated by a preset pattern of pixels somewhere in the top left hand region of the screen (there are search methods to do this).

Edited by settingsons, 20 January 2011 - 07:39 PM.


#118 sza

sza

    Enthusiast

  • Members
  • PipPipPip
  • 75 posts

  • Flag: ---------

  • Favorite Pinball: black hole

Posted 21 January 2011 - 01:35 AM

QUOTE (settingsons @ Jan 20 2011, 08:34 PM) <{POST_SNAPBACK}>
QUOTE (Rawd @ Jan 20 2011, 04:11 PM) <{POST_SNAPBACK}>
In Arcade-render, I am sure that everyones image will be in a different place on the screen. Does that matter?


I thought that as well Rawd although I don't know much about scripting in FP so it maybe possible to fix something to position 0,0? If that is not possible then one thing that is fixed in one place all the time regardless of the viewing angle is the HUD (that was previously mentioned to me by Steve at GoPinball).

Even if the HUD position varies from table to table it could be identified by searching for the starting point of the HUD that would be indicated by a preset pattern of pixels somewhere in the top left hand region of the screen (there are search methods to do this).



The position 0 0 is usually defined in the reference to application window.
Overlay object can go on the HUD, in the corner (0.0.) always the same place
Overlays are animated, Fp script can control which frame overlay displays.
All you need is set of (8, 16, 128 ) of one pixel images with different colors, put them in FP image list, and assign the list to your overlay(s)
To transmit the data out just set the overlay(s) to the frame number equal to the number to transmit. Actually for transmitting switches you need only one pixel in total. On old SS there is 16 or 32 unique switches and only one switch is triggered at the time (well.. multi-ball can cause small problems). There are 16mln unique 24bit colors, so in theory you could transmit data from a pinball with to 16mln switches this way biggrin.gif

Example

switch4_hit -> overlay to frame 4
switch4_unhit-> overlay to frame 0
switch12_hit -> overlay to frame 12
switch12_unhit -> overlay to frame 0

Hope it helps somehow

Edited by sza, 21 January 2011 - 01:51 AM.


#119 Rawd

Rawd

    Pinball Wizard

  • VIP
  • 4,313 posts
  • Location:Edmonton, Canada

  • Flag: Canada

  • Favorite Pinball: Triple Strike



Posted 21 January 2011 - 02:33 AM

This thread makes me feel so stupid. smile.gif


 


#120 highrise

highrise

    Pinball Fan

  • VIP
  • 589 posts

  • Flag: ---------

  • Favorite Pinball: Scared Stiff



Posted 21 January 2011 - 02:51 AM

hey guys - I know you aren't too hot on this whole alphanumeric idea but I think maybe I wasn't clear enough on it. Before I thought of this I had already thought of doing it as you are discussing (mentioned in the first post I think). But I should explain because there are some practical reasons :

The idea is NOT to use it to actually read the numbers themselves, i.e NOT using OCR (optical character recognition) - that would be crazy!

The idea is that a single alphanumeric digit uses 7 segments in fixed positions. In other words, you have seven areas of colour always in exactly the same spot, on the HUD - just like a grid, the pixels on each line are always in exactly the same place. So you don't read the number itself - all you do is read a pixel in the position of each segment, to see which of the 7 lines are on. By using binary, this gives you a number between 0 and 127. These characters can be defined within FP. If you use a line of 32, you basically have 28 bytes of data delivered in one shot. If you want more, you can potentially use two lines. Also the LED colour could be set to be very dark so only the computer could detect it.

See what I mean? You're basically converting the alphanumeric back to its original binary - it IS a grid, just a ready made one. I was always using binary, and have done from the outset. The reason I suggested this is because it is immediate and native to FP (no importing of graphics), and I imagine will display very quickly, up to 32 segments at once because it is a standard part of FP.

I just think given how easy it is to set up in FP, it's worth considering.

Edited by highrise, 21 January 2011 - 03:25 AM.