Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
aarcangeli committed Feb 18, 2019
1 parent 73b5818 commit f4f14f8
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Serious Sam Android

This project wants to make Serious Sam running natively on Android.

## Video demostration:
*coming soon...*

## Running the game
1. Locate the game directory for "Serious Sam Classic The Second Encounter" ([steam](https://store.steampowered.com/app/41060/Serious_Sam_Classic_The_Second_Encounter/))
1. [Download](https://github.com/aarcangeli/Serious-Sam-Android/releases) and install SeriousSamRelease.apk
Expand All @@ -22,63 +17,59 @@ This project wants to make Serious Sam running natively on Android.
1. Start the game
* The first time will ask you permission to read from external storage

Currently the game is playable only with an xbox 360 controller connected with usb
Currently the game is playable only with a xbox 360 controller connected via usb

NB: In some devices the OTG storage must be enabled by settings -> advanced -> OTG storage
NB: In some devices the OTG storage must be enabled (settings -> advanced -> OTG storage)

### Compile from source
If you want to compile the apk file from the source, proceed as follows:
1. Clone or download the repository in a directory
* Do not use spaces in the path to the solution.
1. Open the project with Android Studio
1. Open the project in Android Studio
1. Connect an android device with debugging enabled
1. Compile and run the game

If you have a precompiled version of ecc.exe you can put inside /Serious-Engine/Sources/Tools.Win32 and
If you have a precompiled version of ecc.exe you can put it inside the directory /Serious-Engine/Sources/Tools.Win32 and
resync the project (File -> Sync with Gradle Files)

## Porting notes:

***Graphic***

Of course Serious Sam has been designed to work on a desktop computer.
OpenGL ES is a subset of OpenGL, and many features aren't available on android.
### Graphic Engine

To solve this problem has been implemented an [adapter] that allows you to run some GL calls on GLES.
Serious Sam has been designed to work on a desktop computer in OpenGL or DirectX.<br>
This project is based on OpenGL ES, a subset of OpenGL, and many features that are necessary to run
Serious Sam are not avaiable on android.

***Instruction set***
The problem is solved by implementing an [adapter] that allows you to run OpenGL calls on OpenGL ES.

With [X86 assembly] you can optimize dramatically the performances for many speed-critical sections of code.
However there is a tiny problem: it is not portable.
### Instruction set

[X86 assembly] is quite offen used in Serious Engine.
Since the main hardware platform for Android is [ARM],
in some cases it was necessary to convert asm codes into compatible equivalents.

Luckly CroTeam has provided (in most cases) a constant that enable to switch from asm to an equivalent
standard C code.
CroTeam has provided (in most cases) a constant that enable to switch from asm to an equivalent C code.

An other problem was with some undefined behaviors of the [specs](http://c0x.coding-guidelines.com/6.3.1.4.html)
There was another problem with some undefineds behaviors from the [specs](http://c0x.coding-guidelines.com/6.3.1.4.html)

For example, take a look at this code:
For example:

```C
float source = 1e20f; // a logically large number for a 16-bit signed integer
int32_t destination = (int32_t) source;
printf("destination: %i", destination);
```
Trying to run this snippet on windows or on Android I got two different results.
Running this snippet on Windows or Android we got two different results:
- windows: destination: -2147483648
- android: destination: 2147483647
- Windows: destination: -2147483648
- Android: destination: 2147483647
Has been hard to discover [this](https://github.com/aarcangeli/Serious-Sam-Android/commit/5eb280352b51c2b7c6c5373fff7871f890ff139b)
bug in serious engine.
This difference caused some troubles.
***The compiler***
### Compiler
Serious engine must be compiled with MSVC, android ndk must be compiled with Clang.
Unfortunately, these two programs have differences.
Serious Engine must be compiled with MSVC while Android ndk with Clang.
These two programs have differences.
These are just a few examples:
- ISO C++ forbids forward references to 'enum' types
Expand Down

0 comments on commit f4f14f8

Please sign in to comment.