Personal Insights
Can we make game with ABAP ?
I made this article for chillSAP Summer Independent Research 2020
Hi ABAP geeks!
Do you enjoy ABAP life?
Actually, I tried create game with ABAP but I still working on it.
So, I would like to share the knowledge so far.
I found the interesting sample programs so I would like to share.
1.Only Use Procedure ABAP
It’s basic method to create executable report.
It does not need any Object-Oriented idea, but needs understanding for Sub-routine.
Sample:Tic-Tac-Toe
https://wiki.scn.sap.com/wiki/display/Snippets/Tic+Tac+Toe+-+1.2+Game+in+ABAP
It works dynamically like a some one be there!
It is consisted by 2 part mainly;
- Selection Screen part
In this part, the count is up by pressing the button on selection screen to convert the player.
It also controls its display whether ‘X’ or ‘O’.Computer_move part
It controls the status by the count of putting marks.
For example, move count 9 means draw. - Check_possible part
The end of game depends on this part.
Program checks each column,and decide whether the game continue or not.
In this sample, all of pattern is written in program.
It’s backbreaking work,but It’s one of the ways without doubt.
Ref)Declare used in it;
Selection Screen
FORM/PERFORM
IF/ENDIF
CASE/WHEN
flag(as a formula)
2.Writing front-end language in ABAP report and process the main logic in ABAP layer.
This method is little bit complicated.
It consist from OO ABAP, HTML, CSS, JavaScript.
Cl_abap_browser enables the way to show the web screen,and main method are stored in ABAP layer.
Sample:Minesweeper
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/index.htm?file=abenexpressions_abexas.htm
It’s consisted by 3 part mainly.
- Definition
In this part, parameters used in process is defined by ABAP (DATA or TYPE definition). - Constructor
It defined over all appearance by using CSS.
It also contains conditional branches written by ABAP,and depend on it, parameters are chenged. - Display
This part execute the predefined view method by the value by condition processed on ABAP layer.
Each statement also passes the HTML value and controls the front-end appearance.
3.Only Use Front-end language
It’s familiar method to create games by using web front language like a HTML5, CSS, Javascript.
If you are used to web language and Object-Oriented idea, This way is suit you!
Sample:Game like a Super Mario
https://sapyard.com/advance-sapui5-fun-with-super-mario-in-sapui5/
It’s consisted by 3 part mainly
- CSS
Its controls rough view of the screen.
In this program, the back ground is defined by CSS. - HTML5 Canvas
Literately,Canvas means drowning the object like a graph.
This technology is based on JavaScript。
In this program, objects in back ground is defined by Canvas. - Controlling method
Using HTML,CSS,Javascript,Canvas,we can control the move of objects.
Predefined parameter will be use Depending on the situation or condition.
Editorial note
Through the challenge of game creation, I felt a lack of knowledge not only ABAP but also around the web.
I’m going to work on the tutorials and so on, referring to the articles I’ve presented here, and try again when I have a little more time to settle in.
Cheers! Rena