Space Engineers

Space Engineers

72 ratings
PongLCD (Playable!)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
11.580 KB
20 Mar, 2015 @ 1:10am
16 Jul, 2015 @ 9:44pm
3 Change Notes ( view )

Subscribe to download
PongLCD (Playable!)

Description
This script was made using my EasyAPI script which you can find in the workshop

Here is a link to the blueprint so you don't have to set it up yourself. It just needs power.

INTRO

This script is a fully playable version of Pong for Space Engineers. You can play PVP, verses the computer, or just watch two AI players battle it out. The controls are implemented on a single Button Panel. Each player has a start button, and a button that reverses their paddle so it moves up or down.

Space Engineers Arcade here we come!

HOW TO PLAY

The game supports any combination of Computer and Human players. Yes, that means you can play VS your friends, lol. Just press one or both of the start buttons to toggle that player between Computer and Human.

The goal of the game is to get the ball past the other players paddle to score a point. When you get to 11 points you win.

The game is not optimized for human players and so it is very hard to play. It is more of a proof of concept to show what is possible. But it IS playable.

The buttons on the button panel are as follows:
1. Player 1 switch paddle direction
2. Player 1 start button.
3. Player 2 start button.
4. Player 2 switch paddle direction

Press the start button corresponding to the player you want to play as.

Press the switch paddle direction button corresponding to the player you are playing to change the direction the paddle is moving. This is very difficult to master but since I wanted to keep it as simple as possible it is what it is.

Note: If it's not working make sure all the blocks are owned/accessible to you. Also, on some computers I have had issues with the wide LCD not displaying anything even though the content is in the public text. If this happens, just try using the small LCD.

SETUP INSTRUCTIONS

You will need the following on your Ship/Station for the code to work properly:
1. An LCD Block named "PongLCD" configured to display the public text
2. A Timer Block named "PongTimer" set up to:
1. run this script
2. trigger itself
3. A Button Panel placed a few blocks back from the LCD so you can see the LCD over the top of it.
The buttons on the button panel should have the following actions assigned to them:
1. PongLCD - Decrease Image change interval
2. PongLCD - Increase Image change interval
3. PongTimer - Decrease Delay
4. PongTimer - Increase Delay

Once everything is configured, just trigger the timer block to run the program. If it's working you will see a game start counting down on the LCD and then the AI will start battling. Simply press one of the start buttons to take over as a human player.

HOW IT WORKS

The graphics rendering and events are all handled using my EasyAPI script.

I don't know if anyone else has done this before but I came up with a way to read input from a Button Panel and have it trigger events in a Programmable block. Basically, you assign a default value to a changeable block property (like 5.0 to the Timer Block Delay). Then, when you click a button you make it either increment or decrement that value. In the programming block, you can then check to see if it is either greater than the default value (for the button that increases the value), less that the default value (for the button that decreases the value), or the same (no buttons pressed). If the value is not the default value you can then set it in the programming block back to the default. In this way you can detect button presses while using very few blocks. For example in this script I simply use the Timer Delay value, and the LCD Change interval slider to handle four buttons.

Here is a basic code example of how buttons are handled:
// Assuming you have a Button Panel with one button set to increment the trigger delay and another to decrement it Single delay = timer.GetProperty<Single>("TriggerDelay"); if(delay > 5) { // The button that increments the value was pressed. // Set the property back to the default so we can detect another press timer.SetProperty<Single>("TriggerDelay", (Single)5); } if(delay < 5) { // The button that decrements the value was pressed. // Set the property back to the default so we can detect another press timer.SetProperty<Single>("TriggerDelay", (Single)5); }
27 Comments
matthewvogt 29 Mar, 2020 @ 9:02am 
broken =( really wish it would get an update
Doat 27 Feb, 2020 @ 5:37pm 
the problem is not an update, it is the script, there are 18 errors in MDK vs, its c# thats the problem
Seagull Lung 4 Jan, 2020 @ 5:00am 
dam i was in middle of building this setup when i read its broken , thats a shame was going to suprise my faction buddys
matthewvogt 21 Jan, 2018 @ 8:22pm 
Yup broken mod. maybe someday
KamiKatze 29 Jun, 2017 @ 5:11pm 
THis script needs an update. Compilation fails...
Phraxas 22 Aug, 2016 @ 10:53pm 
This should include a sound block so that it can play sounds.
Aulus 4 Dec, 2015 @ 8:49pm 
@rockyjvec thanks i'll watch for an update.
rockyjvec  [author] 4 Dec, 2015 @ 8:48pm 
@Aulus, a bug was introduced a few builds back which broke most of my scripts, including this one. I'm hoping it will be fixed soon, or else I will have to rewrite all my scripts :-(
Aulus 30 Nov, 2015 @ 5:29pm 
Anyone else having trouble getting this to work on the current build. I've followed the instructions using the vanilla programmable and timer block and small lcd. Whenever I compile and try to run I get an error "object reference not set to an instance of an object"? I'm the owner of all blocks.
willfarnham22 27 Mar, 2015 @ 11:28am 
@rockyjvec hey dude i love you it's been a while since i used the gates but when i was they did not work from Control Panel they must have added it since the last time thank you for pointing it out.

I play survival on full realistic so getting the materials to build gates takes a while so had not got to it to play with yet in my new world.

Thanks again for pointing that out.