Author Topic: Offering an idea  (Read 603 times)

Linkpy

  • Newbie
  • *
  • Posts: 4
  • Likes: +0/-0
    • View Profile
Offering an idea
« on: May 09, 2016, 08:06:29 am »
I was thinking, back then I played Rawbots.

I'm a programmer, and I love programming. But.. visual programming is not for me. So, maybe a programming language in Rawbots can be good, with a "CPU Part" for using it, no ? It may be Lua, very easy to include in a game and easily extensible.

What do you think of my idea ?

PS : I think I'm not the only one who has the idea lol

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Offering an idea
« Reply #1 on: May 09, 2016, 08:41:32 am »
Yeah, that idea seems to come up everytime future development or the programming system are discussed. It certainly would make complex behaviours a wwhole lot easier to implement, but I wouldn't want to loose the hardware level VP system we have now.

In the current game, you can implement simple state machines, or even a fully functional microcontroller core if you need that sequential, branching behaviour.

Sleeping_Owl

  • Member
  • **
  • Posts: 18
  • Likes: +1/-0
    • View Profile
Re: Offering an idea
« Reply #2 on: May 09, 2016, 04:54:24 pm »
Rawbots should keep visual programming system, it is really good for simple bots and seems to be more accessible to players that have no "real" programming experience. So default programming mode should be more casual VP.

I like the idea of script executor VP tile with multiple inputs, it can easily fit existing VP model.

Somewhat related but simpler thing to do is VP tile for text math expression. Current math implementation makes relatively simple calculations take several screens. Most people are used to see math as text like "a + sin(b) - 2 * c^2" not web of VP tiles. Such part would decrease code size of my bots by half or even more.

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Offering an idea
« Reply #3 on: May 09, 2016, 05:13:19 pm »
I suppose the acessability depends on what functions are built in. Pressureline wrote a good post about this at some point.

Custom math hexes would be cool, perhaps you could integrate basic branching/conditional functions too. Another minor improvement would be to let appropriate hexes have an arbitrary number of inputs, which would help with combining values and implementing more complex custom functions.

Linkpy

  • Newbie
  • *
  • Posts: 4
  • Likes: +0/-0
    • View Profile
Re: Offering an idea
« Reply #4 on: May 09, 2016, 05:51:05 pm »
I didn't say replace the VP system. But, a very good improvement for this system is a programmable tile, with limited or infinite input and output. This tile can only perform math and logic operations.

For example, we can use a Arduino-like programming system : with ports. Or, even more "realistic", add a part which is a "programming card". With several size, memory and ports limitations. So, for ENORMOUS robots using this system, the creater needs to use multiple card for what he want, not just one which will do everything.

Or, like MarvinMan said, a custom math tile, and conditional tiles (if, while, for, etc) for easier programming. I think this isn't to difficult to implement (of course, if the current VP system - in term of implementation - is well done, and easily extensible).

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Offering an idea
« Reply #5 on: May 10, 2016, 11:48:15 am »
Putting limitations on processing power could be interesting in a more developed game, but at this point we need all the processing power we can get. One advantage of custom code hexes could be that it could be compiled and optimised somewhat to run as fast as possible.

PressureLine

  • XFM Developer
  • Administrator
  • Experienced Member
  • *****
  • Posts: 192
  • Likes: +4/-0
    • View Profile
    • Rawbots Club Forums
Re: Offering an idea
« Reply #6 on: May 10, 2016, 12:19:06 pm »
A 'string math' hex would be very useful, since being able to input "ASIN(a/b)" etc would make code much cleaner.

Rather than a full 'programming' hex (since multiple lines would be an issue) something like a small 8-pin RISC PIC would probably fit better with the 'low-level' style of Rawbots programming.
"Never assume that anything you've never seen before is benign. Most particularly not something that says 'MARINES' on it."

Linkpy

  • Newbie
  • *
  • Posts: 4
  • Likes: +0/-0
    • View Profile
Re: Offering an idea
« Reply #7 on: May 10, 2016, 06:45:04 pm »
@MarvinMan : I see, maybe in the future Rawbots.

@PressureLine : Oh, this can be very interesting to add a PIC like this. Can be cool.

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Offering an idea
« Reply #8 on: May 11, 2016, 09:57:41 am »
A microcontroller part would be particularly useful if its clock was either decoupled from the physics step clock or ran at some large multiple of the physics clock speed. That way you don't have all the problems with propagation delays that the VP code does.

tob.s

  • Member
  • **
  • Posts: 24
  • Likes: +3/-0
    • View Profile
Re: Offering an idea
« Reply #9 on: December 02, 2016, 08:59:40 am »
i always wondered if it would be possible to locate, read and manipulate a vp tyles values from the ram ( may bee easy to investigate with cheat engine ) into a selfmade programm which then could act as bridge to any programming language u want - variables, arrays and even simple a+b-c*d instead of a monitor full of vp tiles...

just renembering that there was a video and also a tutorial back in the old forum that showed a handy and a midi-controler used as input device ( most certainly via OSC ) couldnt find  the tutorial but heres the trailer -

if this function is already included ( well it should be as there was an tutorial ) it would be a way for rawbots to communicate with an external programm, even if its  just input - we dont have an archive of to old forum do we ?


z26

  • Experienced Member
  • ***
  • Posts: 108
  • Likes: +0/-0
    • View Profile
Re: Offering an idea
« Reply #10 on: December 02, 2016, 10:53:54 am »
"would be a way for rawbots to communicate with an external program"

Never thought of that, but that would be nice.  In practice however osc might introduce a delay.  Also, a program with only inputs isnt useful, you'd need to be able to send back the outputs that you want too.  There would be a possible hack to do this: make a program screencap a part
of your screen in the vp grid with all the outputs you want then decode them with a text reading program?  Saving the map file often
and looking inside could be an alternative, however there's a few problems: this freezes the game an instant, has a lower data rate and worst of all, you would need to use some tricks (using the presence or absence of the attach point of a hook to transmit true/false values and using the position of an actuator with a pid controller so that it responds faster to transmit numerical values) because data from sensors isn't saved in the map file automatically.

Also, using osc might not be critical.  It might be possible to stimulate keypresses with an external program.  Finding a decent solution for input seems easier than figuring one for output.

If you added an output function however, i could see this being used for a complex, non time critical program.  Good thinking.

I've tried getting osc to work but I've failed, maybe you'll have a better go at it than me.
« Last Edit: December 02, 2016, 01:51:04 pm by z26 »

z26

  • Experienced Member
  • ***
  • Posts: 108
  • Likes: +0/-0
    • View Profile
Re: Offering an idea
« Reply #11 on: December 02, 2016, 02:03:39 pm »
Also, we do have an archive to the old forum, but its quite incomplete.  I discuss this subject there http://forum.rawbots.club/index.php?topic=3.msg219#msg219

https://glovepie.en.softonic.com/
I'm currently investigating Glovepie, an old program meant to control games with stuff like wiimotes an virtual reality gloves.   it's a bit like hot2key, but seems to be much more programmation oriented.  I've managed to shoot plasma shots by middle clicking so far.
« Last Edit: December 02, 2016, 03:01:51 pm by z26 »

tob.s

  • Member
  • **
  • Posts: 24
  • Likes: +3/-0
    • View Profile
Re: Offering an idea
« Reply #12 on: December 02, 2016, 04:15:48 pm »
i always wanted to visualize sensor data ( eg from a hook ) to get a better understanding of how your bot sees the world.
On my small real robot i had a sharp ir distance sensor ( acts like a laser range finder but is much cheaper ) mounted to a servo - it sweeped the servo full 180 deg, measuring the distance at every deg - this data was then transmitted to pc / processing via serial where it was written in an array and also visualized ( looked very much like a radar screen ). As next step i planned to let the bot move a fixed distance and scan again, combining the offset from the bots last position and the new distance readings to get a map of the room and also evaluting shapes ( a ball should be easy to identify as it would always show the same siluette just varying in size  regardless of the bots position to it ) . But as the tank chasis i bought is realy poor at running straight ( i used photocells to sync left / right rpm but never got to work exactly ) i didnt get any further.

When it comes to reading from ram i just tried with cheat engine to find a single blocks mass i set to random values , but i had no luck. Still if i could have read it the address one would need to run this process everytime he starts rawbots/loads the bot and its likely to crash the game.

As for OSC im not totally sure if its just input ( by default osc is bidirectional ) im assouming they used an osc-libary instead of writing their own solution, so the function to send osc might be in there but not connected to any vp-tile - if you want to further investigate, this seems to bee the most popular osc libary for unity - https://github.com/jorgegarcia/UnityOSC

thanks for the link to the old topics, so its port 8000 ( someone also mentioned 9000 ) and in the input sampler you should write the address like /1/rotary1 - havent done anything with osc for a long time, but i got plenty of midi controlers here and might give it a try.
« Last Edit: December 02, 2016, 04:36:19 pm by tob.s »

z26

  • Experienced Member
  • ***
  • Posts: 108
  • Likes: +0/-0
    • View Profile
Re: Offering an idea
« Reply #13 on: December 02, 2016, 04:25:16 pm »
With glovepie i managed to send the y position of my mouse as an analog input to a piston.  I had to use a workaround: i encoded the value in binary using one key for each bit, then decoded it in rawbots.  It works, but using osc instead would probably be preferable.

Also, I had something similar in mind (outputting a scan of the environment)  I don't know if osc supported outputs in rawbots.  For inputs you simply had to write something special in the "positive/negative" keyboard hex,  but how would you output something?

If someone's curious heres the code.  replace "1050" by the vertical resolution of your monitor and on rawbots side, multiply the output of the
"5" key by 32, 4 by 16, 3 by 8, 2 by 4, 1 by 2 and 0 by one.  Then add them together and you have an analog value going from 0 to 64.

Spoiler: show

var.positionx = mouse.CursorPosY / 1050 * 64
var.positionx = var.positionx - (var.positionx mod 1)
var.positionx = 64 - var.positionx


if var.positionx < 32 then key.5 = false
if var.positionx >= 32 then
var.positionx -= 32
key.5 = true
end

if var.positionx < 16 then key.4 = false
if var.positionx >= 16 then
var.positionx -= 16
key.4 = true
end

if var.positionx < 8 then key.3 = false
if var.positionx >= 8 then
var.positionx -= 8
key.3 = true
end

if var.positionx < 4 then key.2 = false
if var.positionx >= 4 then
var.positionx -= 4
key.2 = true
end

if var.positionx < 2 then key.1 = false
if var.positionx >= 2 then
var.positionx -= 2
key.1 = true
end

if var.positionx < 1 then key.0 = false
if var.positionx >= 1 then
var.positionx -= 1
key.0 = true
end
« Last Edit: December 02, 2016, 04:46:56 pm by z26 »

tob.s

  • Member
  • **
  • Posts: 24
  • Likes: +3/-0
    • View Profile
Re: Offering an idea
« Reply #14 on: December 02, 2016, 05:40:09 pm »
just trying to get it to work, but im not exactly clear how to translate the musical standards to something rawbots understands - im using a korg nanokontrol 2 to generate midi, then use this ( https://github.com/fred-dev/OSC_MIDI_OSC/releases ) as midi to osc bridge ( u have to set the osc out port to 8000 in the settings xml file) wich seems to work nicely as i monitored incomming osc data with this https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/osc-tools/OSC_Data_Monitor_windows.zip However my Osc message look like "noteOn" "94" "127" where notOn is the type of event, 94 is the number of the corresponding note and 127 being the velocity ( = loudness of the note )
so i guess for rawbots it should be /noteOn/94 but it nothing happens - maybee ill try with touchosc later to see if it works when using the exact settings shown in the video

feature=player_embedded