Coder Social home page Coder Social logo

danilolc / pk2 Goto Github PK

View Code? Open in Web Editor NEW
79.0 9.0 23.0 53.86 MB

Pekka Kana 2, a platformer game

Home Page: http://pistegamez.net/game_pk2.html

License: MIT License

C++ 97.98% Makefile 0.94% Java 0.27% GLSL 0.81%
game pekkakana2 sdl2 sdl2-image sdl2-mixer android windows

pk2's Introduction

pekka

Copyright (c) 2003 Janne Kivilahti

Ported to SDL by Samuli Tuomola (2010) https://github.com/stt/pk2

Translated and ported to SDL2 by Danilo Lemos (2016-2020)

"Pekka Kana 2 (Pekka the Rooster 2) is a jump 'n run game made in the spirit of old classic platformers such as Super Mario, Sonic the Hedgehog, Jazz Jackrabbit, Super Frog and so on." http://kiwi.mbnet.fi/pistegamez/pk2/

This repository contains the source code and resource files for the game Pekka Kana 2 created by Janne Kivilahti in 2003. The source code was released by the original author on a forum thread.

Since then a lot of things changed, including an initial SDL port by Samuli Tuomola in 2010 and then the SDL2 port, bug fixes, and code redesign by Danilo Lemos (2016-2020).

This game was tested on Windows, GNU/Linux and Android.

Binary distibution

See the game's page at Itch.io.

Compiling

Windows

To compile on Windows, you will need the mingw c++ compiler with SDL2, Zip and Lua libs. There is a Makefile on /mingw/i686/ that defines the needed stuff and include /mingw/mingw.mk. Edit the /mingw/i686/Makefile as you need and run Make on this directory.

Debian

To compile Pekka Kana 2 into Debian GNU/Linux based distributions, you need the SDL2, SDL2_image, SDL2_mixer, Zip and Lua libraries installed on the system. To get everything you need, just run the following command on the terminal:

$ apt install build-essential libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libzip-dev liblua5.4-dev

Then run the "make" command inside the "Pekka Kana 2" directory.

$ make

The PK2 binary will be in "bin/" directory.

$ ./bin/pekka-kana-2

To make the removal, within the compiled directory, execute this command:

$ make clean

Android

Run git submodule init then git submodule update to get the SDL libs. Then ./gradlew build on android/ with the SDK and the NDK installed may work.

macOS - not tested

Use Homebrew to install SDL2 packages:

brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer

Now just clone the code and run make on pk2 directory, the PK2 binary will be in bin/ directory.

User made episodes:

http://mapstore.the.cz/ To add a new episode, just download the zip and put it inside "mapstore/" on local data.

The game can be started with the "dev" argument to enable the cheats and "test" following by the episode and level to open directly on the level.

This example starts the level13.map on dev mode:

./pekka-kana-2 dev test "rooster island 2/level13.map"

FIXMEs

  • Android import zip, delete zip, zip file on save (can't load save with no zip)
  • New graphics and controllers menu
  • SDL_QUIT on Android
  • Autosave settings option, ask when overwriting save, select save on new game
  • Low volume sounds not played on low volume - music playing on volume 0
  • Jump frames when fps is low
  • Better sound quality

PLANS

  • Loading languages from zip files and all.txt
  • Speed-run mode (frame counter, ghost)
  • Better documentation
  • Implement new layer on .map (regions)
  • Find image (load .bmp or .png)
  • New weather
  • High resolution mode

V1.5

  • 64bit release
  • Better error handling (remove PK2_Error)
  • Multi line info sign
  • New HQx (OpenGL)?
  • OpenGL ES
  • Edit controller position
  • Faster item tab
  • Lua screen
  • Chick system

pk2's People

Contributors

danilolc avatar felis-catus avatar licaon-kter avatar ravmahov avatar stt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pk2's Issues

Feature: Checkpoints

As much as i liked the concept, i couldn t play past second level as it gets quite frustrating without having checkpoints and having to start from the very beginning. Please add some to make it really enjoyable

Guix Port

Hi,

I'm porting the game to GNU Guix. The game builds but then segfaults probably due to missing files.

Could you please help me with locating them in the source code? I'll then change their location in the package definition.

$ /gnu/store/n6b9fia22n7060xm8mgdvrz6bqwqxlca-pekka-kana-2-1.4.2/bin/pekka-kana-2/pekka-kana-2
[DEBUG]	PFile	- Find ./data/redirect.txt
[INFO]	PFile	- ./data/redirect.txt not found, trying different cAsE
[WARN]	PFile	- Couldn't scan on "./data"
[INFO]	PFile	- ./data/redirect.txt not found
[ERR]	PFile	- Can't get RW from file "./data/log.txt"
[DEBUG]	PK2	- Pekka Kana 2 started!
[DEBUG]	PK2	- Game version: Pekka Kana 2 Definitive Edition 1.4.2 (Linux) (no-zip) (portable)
[DEBUG]	PK2	- Number: 0x402
[DEBUG]	PK2	- Data path - ./data/
[ERR]	PFile	- Can't get RW from file "./data/settings.ini"
Segmentation fault

aarch64 debug errors

Hi there,

I'm trying to run the game on a rk3326 arm soc.
Compiled nicely so far but running it I get some serious errors:

[DEBUG] PFile - Find ./data/redirect.txt
[INFO] PFile - ./data/redirect.txt not found, trying different cAsE
[DEBUG] PFile - Scanned on "./data" for "". Found 5 matches
[INFO] PFile - ./data/redirect.txt not found
[DEBUG] PK2 - Pekka Kana 2 started!
[DEBUG] PK2 - Game version: Pekka Kana 2 Definitive Edition 1.4.2 (Linux) (no-zip) (portable)
[DEBUG] PK2 - Number: 0x402
[DEBUG] PK2 - Cammit hash: 72fd91a
[DEBUG] PK2 - Data path - ./data/
[DEBUG] PK2 - Opened settings
[DEBUG] PK2 - Found config file
[DEBUG] PK2 - Render method set to default
[DEBUG] PK2 - Audio buffer size set to 512
[DEBUG] PK2 - Audio multi thread is ON
[DEBUG] Piste - We compiled against SDL version 2.0.9 ...
[DEBUG] Piste - But we are linking against SDL version 2.0.10.
[DEBUG] PDraw - Initializing buffers
[DEBUG] PRender - Initializing graphics
[DEBUG] PRender - Video driver: KMSDRM
[ERR] PGl - Couldn't find glBindFragDataLocation

[ERR] PGl - Couldn't find glTexImage1D

[DEBUG] PGl - OpenGL version: OpenGL ES 3.2 v1.r13p0-01rel0.8747d14aec16ec21ac2b2da252c4ec5f
[DEBUG] PGl - GLSL version: OpenGL ES GLSL ES 3.20
[ERR] PGl - Error compiling shaders/basic.vs:
0:1: P0007: Language version '140' unknown, this compiler only supports up to version '320 es'
[ERR] PGl - Can't load vertex shader
[FATAL] PGl - Can't create basic program
[ERR] PGl - Error compiling shaders/indexed.vs:
0:1: P0007: Language version '140' unknown, this compiler only supports up to version '320 es'
[ERR] PGl - Can't load vertex shader
[ERR] PGl - Can't create indexed program
[ERR] PGl - Error compiling shaders/hqx.vs:
0:1: P0007: Language version '140' unknown, this compiler only supports up to version '320 es'
[ERR] PGl - Can't load vertex shader
[ERR] PGl - Can't create hqx program
[ERR] PGl - Error compiling shaders/crt.vs:
0:1: P0007: Language version '140' unknown, this compiler only supports up to version '320 es'
[ERR] PGl - Can't load vertex shader
[ERR] PGl - Can't create screen program
[INFO] PInput - No haptic found
[DEBUG] PInput - Controller found: OpenSimHardware OSH PB Controller
[DEBUG] PSound - buffer size: 512
[DEBUG] PSound - Desired 22050hz 0x8010
[DEBUG] PSound - Audio driver: alsa
[DEBUG] PSound - Got 22050hz 0x8010
[DEBUG] PK2 - Loading language from language/english.txt
[DEBUG] PFile - Find language/fonts/ScandicSmall.txt
[DEBUG] PFile - Found on language/fonts/ScandicSmall.txt
[DEBUG] PFile - Find language/fonts/ScandicSmall.bmp
[DEBUG] PFile - Found on language/fonts/ScandicSmall.bmp
[DEBUG] PDraw - Created font from language/fonts/ScandicSmall.txt - id 0
[DEBUG] PFile - Find language/fonts/ScandicBig1.txt
[DEBUG] PFile - Found on language/fonts/ScandicBig1.txt
[DEBUG] PFile - Find language/fonts/ScandicBig.bmp
[DEBUG] PFile - Found on language/fonts/ScandicBig.bmp
[DEBUG] PDraw - Created font from language/fonts/ScandicBig1.txt - id 1
[DEBUG] PFile - Find language/fonts/ScandicBig2.txt
[DEBUG] PFile - Found on language/fonts/ScandicBig2.txt
[DEBUG] PFile - Find language/fonts/ScandicBig.bmp
[DEBUG] PFile - Found on language/fonts/ScandicBig.bmp
[DEBUG] PDraw - Created font from language/fonts/ScandicBig2.txt - id 2
[DEBUG] PFile - Find language/fonts/ScandicBig3.txt
[DEBUG] PFile - Found on language/fonts/ScandicBig3.txt
[DEBUG] PFile - Find language/fonts/ScandicBig.bmp
[DEBUG] PFile - Found on language/fonts/ScandicBig.bmp
[DEBUG] PDraw - Created font from language/fonts/ScandicBig3.txt - id 3
[DEBUG] PFile - Scanned on "language" for ".txt". Found 37 matches
[DEBUG] PFile - Scanned on "episodes" for "/". Found 2 matches
[DEBUG] PK2 - Found 2 episodes
[DEBUG] Piste - FPS set to 60
[WARN] PSound - Unrecognized audio format
[ERR] PFile - Can't get RW from file "./data/saves.dat"
[INFO] PK2 - No save file
[WARN] PSound - Unrecognized audio format
[ERR] PK2 - Can't load intro.xm
[DEBUG] PGl - Terminated
[DEBUG] PK2 - Terminated
[DEBUG] PLog - Terminated

No sure at what stage the program terminates.
Any Ideas?

Gamepad on android seems not to be fully recognized

I sideloaded the .apk on a FireTV stick 4K Max. The game starts and I can use the remote buttons to move around the menu. However, when selecting "Use gamepad" in the controls menu, it seems that my playstation4 controller (which works flawlessly with other applications like retroarch or ppsspp) is not fully recognized. Only the "X" button seems to work while all the other buttons (like moving and jumping) do not respond.

Do you know if it is a known issue and if it will ever be resolved?

Thank you anyway for your amazing work :)

Touchscreen is too touchy

In android version, when touching screen, triggering of next touch event happens almost instantly. No delays.
Thus I get cases where I accidentally press button on next menu screen(unless I shift finger slightly) and worse, being unable to exit menu ingame(retriggers instantly).

Suggestions:

  • Maybe a grace period before processing next touch.
  • Track finger and reject its touch events until it has been lifted from screen.

[Android] Keyboard / Gamepad support

Hello, it is likely that at the port for smartphones has been removed keyboard support. Gamepad support would also be good :P

In general, the keyboard works, but only the buttons that are not subscribed - such as Pause. So it's impossible to play the keyboard in Pekka Kana.

Add support for more languages via pixel fonts (GNU Unifont), DON'T remove extra language locales

Add support for more languages via pixel fonts (GNU Unifont), DON'T remove extra language locales.

The GNU Unifont .bmp/.gif/.png full-charset image supports a wide variety of writing systems (it supports a lot of Unicode 5 charset!) which can, if included in pk2sdl, can add support for more language locales to the game. Just download that image file from the GNU Unifont website (converting that .bmp to .gif or .png will greatly reduce its filesize for inclusion in pk2sdl, especially because it is a monochrome image file!).

One can also make more pixel fonts via http://fontstruct.com (& use the free apps Transparent Windows 2.2, PeekThrough app, or similar, to retrace-copy .ttf fonts' glyphs (e.g. via BabelMap) via semi-transparency applied to your charmap app and web-browser, to copy glyphs into your own pixel font) and http://pentacom.jp bitmap font maker 2, but only monochrome-color pixel fonts...
One can possibly write a Python3 or Perl script to apply color-font-glyphs parts via an algorithm to these monochrome fonts.

But the above may require you to convert the lang locale files of PK2 to utf-8 and to tweak the game's code to read those utf-8 files, and to increase the hardcoded limits of the image dimensions for reading the .bmp files with the PK2 image font-glyphs, so as to accommodate for the increased image dimensions of newly added images with the pixel-font glyphs for many languages added into them (and the .txt files that describe the glyph-to-image mappings, see e.g. the Cyrillic extra metadata info in one of the Russian.txt locales for ideas on how to do that).

Also, I think that most people won't mind having more language locale translations files bundled in pk2sdl, instead of removing those and having only 1 translation file per language... (this is against the proposed 'remove repeated languages' in the FIXMEs!). And the game should also support importing more such .txt files supplied by the enduser.

P.S. Maybe having 2-3 more options for the placement of the pk2sdl gameplay buttons on Google Android devices - is a good idea, especially about the location of the buttons for doodle & eggs-laying & ducking & inventory & pause/main-menu, etc.... 🤔 E.g. a WASD ( w\asd) keyboard-like keys like those placed on a keyboard and on the other side - in the same way - the rest of the key buttons for the pk2sdl gameplay.

Cheers!
And thanks a lot for pk2sdl!!! 🙏
P.P.S. Please add hyperlinks to the other pekka kana 2 projects on github.com, these can be very useful to people who make new episodes&maps for pk2sdl! http://lospec.com & my http://github.com/sahwar/Bulogos 'Best free drawing apps' file list free apps for doing pixel-art for pk2sdl!
Also please add the pk2lib mediafire.com links and the PisteGamez webforum link and the PisteGamez discord.com chat-channel - to the 'More episodes' section of the README.md in the pk2sdl http://github.com repository, as it contains many new episodes for pk2 (though you may need to convert some of the image files into image filetypes compatible with pk2sdl!).

Again, THANKS A LOT FOR pk2sdl and its Google Android port, the MS Windows port and the (GNU/)Linux port, and the macOS port!

Music bugs

  • Map music is not loaded from the episode folder: in the original game, if there's a music file with filename "map" (e.g. map.xm), it is played on the map menu. This does not seem to happen in this port.
  • If you kill The Evil One (music will stop), the hiscrore music will not start to play when you reach exit: if the player kills a sprite with the AI property "The Evil One", the level music will stop playing. This works as intended, but in the original game when the player reaches exit, the hiscore music will still start playing. In this port, the hiscore music will start playing only in the hiscore screen if the Evil One has been killed.

Coming a error when open level 2

Hellow!
Firstly thank you! for provide open source & free this app.
First run is very smooth. But not run 2 level. coming a error 'pekka kanna 2 is stoped'. Fix it…
I think RAM no clear after complete game (level1).
Thank you!

Doesn't compile on macOS

Due to pygame and/or SDL2 not working properly on recent versions of macOS, Pekka Kana 2 will not compile. Obviously not a fault with the game but perhaps this needs mentioning in the readme?

Segmentation fault when exiting

It's not a big problem since it happens when exiting PK2. But I guess it would be better if PK2 could exit without a segmentation fault.

The segfault happens when freeing the music.

GDB log:

Exited correctely
[Thread 0x7fffdf6b0700 (LWP 29033) exited]
[Thread 0x7ffff542b700 (LWP 29032) exited]
Exited correctely

Thread 1 "PK2" received signal SIGSEGV, Segmentation fault.
0x00007ffff780cf28 in Mix_FreeMusic () from /usr/lib/libSDL2_mixer-2.0.so.0
(gdb) bt
#0  0x00007ffff780cf28 in Mix_FreeMusic () from /usr/lib/libSDL2_mixer-2.0.so.0
#1  0x0000555555587ffe in PisteSound_End () at engine/PisteSound.cpp:168
#2  0x0000555555588286 in Piste_Quit () at engine/PisteEngine.cpp:126
#3  0x0000555555575ba0 in quit () at src/pk2.cpp:7948
#4  0x00007ffff734723c in __run_exit_handlers () from /usr/lib/libc.so.6
#5  0x00007ffff734736e in exit () from /usr/lib/libc.so.6
#6  0x00007ffff733100a in __libc_start_main () from /usr/lib/libc.so.6
#7  0x00005555555577ae in _start ()

Retrying a level crashes the game

On Android 12, when I retry a level after getting knocked out, the game crashes upon loading the level. This occurs even if I attempt a different level than the one failed.

Making the custom mouse icon disappear

If you are in the main menu, go into any of the other menus, press escape and then press escape at the main menu again, the custom mouse pointer disappears and shows the windows one.

If you then click again it reappears, but the menus don't do anything. Only after it has reappeared.

Smartphone overheating

The game overheats smartphones due to using the CPU instead of the GPU to process graphical information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.