PDA

View Full Version : [Engine] Pokemon Android Engine


Flameguru
April 13th, 2013, 05:55 PM
Pokemon Android Engine
SOURCE HAS BEEN RELEASED!
6500+ Lines of code and counting!

Introduction
Some of you may remember a Java Engine that I made a few years ago. It never got completed, and never will, but this engine is based on mostly the same code except for the graphics portion and other Android specific code. This Engine is nowhere close to completion and I probably won't ever completely finish it. I am developing this as a final project for my Mobile App Development course in college. It is inspired by the second generation of Pokemon games as those will always be my personal favorites in the series. This Engine is built on top of the e3roid OpenGL Engine for Android allowing for hardware acceleration and easier graphics handling in the code. It is a long way from completion and will likely never truly be completed, but it is 100% open source so that anyone can use it if they want to. As far as current completion, it is close to how far my Java Engine was in terms of functionality but many improvements have been made such as authentic damage calculation, proper Pokemon stat generation, and more which my Java Engine never implemented. I won't be releasing the source until after my class is over in the middle of this May but once it has been graded for my class I will release the source and anyone can use it or continue developing it for use in their own Android Pokemon game. All I ask for is credit in whatever you make using it.

Don't ask me if it will ever come to iOS, it won't. I can't stand Objective-C.

Completion
I have done a decent amount of work so far. Below is what I have started working on:

App Persistence - Done
Title Screen - Done
On-Screen Controller - Done
Hardware Keyboard (If Applicable) Controls - WIP (Overworld only)
Tile Loading - Done
Map Loading - Done
Scrollable Map - Done
Collision Detection - Done
Tile based animated movement - Done
Battle System - WIP (Nearly Finished)
NPC Interactions = WIP (All you can do is talk to them)
Day/Night System - WIP (Adding Time based events/encounters later)
In Game Menu - WIP (Semi-Functional)
Save/Load - WIP (Only certain things are saved/loaded for now)
Other misc. systems in place

Map Editing
I am using the very popular Tiled Map Editor for this engine as it is natively supported by the underlying e3roid OpenGL Engine. This map editor allow for multiple layers (for both tiles, objects, and collisions) and multiple tilesets for each map and is overall just an excellent map editor. You can find the Tiled Map Editor and more information about it here (http://www.mapeditor.org/).

Downloads
Latest Release: Build 12 – Uploaded on May 27, 2013
Eclipse Project (Source) (http://www.mediafire.com/?p10e5v9e4zkkjdu) - Import this as a project into your Eclipse/ADT workspace and get to work ;)
Pokemon.apk (http://harshboy.info/files/Pokemon.apk) – Sideload this to your Android device and install. You must have unknown sources enabled and have a file browser to install.

Changelog
Check Source for most up to date changes.
Build 11 (In Progress)
- Fixed a bug regarding stat lowering moves (Divide by 0)
- Fixed a bug regarding status condition persistence outside of battles
- Fixed a bug regarding App persistence when locking the device
- Begin to implement Hardware Keyboard controls (Overworld only for now)
- In Game Menu nearly finished
- Unique Wild Pokemon Encounters per zone (Route 29, Route 30, etc)
- Begin implementing PP of moves
- Begin to implement Save/Load System (Currently saves Name and X,Y Location on Map)
- Begin to implement Day/Night System (Functional)
- Implemented NPCs
- Fixed Resolution issues (Image is now 480x320 all the time and stretched on all devices to fill the screen)
- Fixed B Button (Re-enabled)
- Added walking in grass animation
- Changed Title Screen to mimic the Pokemon Gold Title Screen (Animated)
- Added Item use in Battles (Just Pokeballs and Potions for now)
- Added Pokemon Party screen in Battles (Switching works but its a bit wonky)
- Added Pokemon Party screen to In Game Menu
- Cleaned up some code
- [DEBUG] Select Button Toggles Day/Night System On/Off (Overworld)
- [DEBUG] B Button instant levels Player's Pokemon (Main Battle Screen)
- Pokemon data is now loaded from a text file (Essentials format)
- Attack data is now loaded from a text file (Essentials format)
- Encounter data is now loaded from a text file (Very similar to Essentials format)
- Map Connection data is now loaded from a text file (Similar to Essentials)
- Save/Load System mostly implemented (Functional)

Build 10
- Bug Fixes (Battle System and In Game Menu)
- Game State is now saved when Home Button is pressed (Resuming works)
- Disabled Back Button so that Player does not reset game accidentally (In Game Menu will allow exiting)

Build 9
- Bug Fixes (Battle System)
- Battle system is nearing completion (Need to add Party switching and item use)
- D-Pad has been redone in the Gameboy Color style
- A and B Buttons have been redone in the Gameboy Color style
- Start and Select Buttons have been added to the HUD (Gameboy Color style)
- In Game Menu added (Does not function other than appearing and the ability to exit it)
- Disabled B Button due to a bug

Build 8
- Bug Fixes (Battle System)

Build 7
- Bug Fixes
- Battle System has correct damage calculation
- Pokemon have accurate stat generation (IV and EV as well)
- Attacks have their correct damage mimicking the real games
- Overworld changed to mimic Johto

Build 6
- Bug Fixes
- Basic Battle System implemented

Build 5
- Title Screen redone (Tap anywhere on screen to start game)
- Added A and B buttons to the HUD

Build 4
- Bug Fixes

Build 3
- Overworld BGM (Route 30)
- Collision Sound Effect
- Tile Movement
- Begin porting Pokemon Java Engine class files (Monsters, Attacks, etc)

Build 2
- Title Screen with Continue Button
- Animated Player Sprite (Does not stop Animating when stationary)
- Scrollable Maps (Player is centered)

Build 1
- D-Pad for movement (HUD)
- Basic Movement (Not Tile Based)
- Load Tiled Maps (Test Map is extremely basic)
- Collision Detection (Not Tile Based)
- Scrollable Maps (Player not centered)
- Gold Player Sprite (Not Animated)

Screenshots (Build 11)
http://harshboy.info/files/13.png
http://harshboy.info/files/2.png
http://harshboy.info/files/3.png
http://harshboy.info/files/4.png
http://harshboy.info/files/5.png
http://harshboy.info/files/14.png
http://harshboy.info/files/6.png
http://harshboy.info/files/7.png
http://harshboy.info/files/8.png
http://harshboy.info/files/9.png
http://harshboy.info/files/10.png
http://harshboy.info/files/11.png
http://harshboy.info/files/12.png


Videos (Build 11)
Sorry for the bad quality, Screencast for Android no longer works after upgrading my Nexus 4 to Paranoid Android 3.15 from 3.10 so I had to record using my iPod Touch. Its really hard to play one handed and through the iPod as you'll notice in the video.
rG92p_rbUiY

Somniac
April 13th, 2013, 06:19 PM
Wow, let me be the first to say this is fantastic. I really hope you do well on your course as this is a very interesting project.
It's a shame that the only android device I have, I accidentally left at my sister-in-law's otherwise I would be happy to test it out for you.

I have to say that it's extremely good of you to leave it as open-source. I know a lot of people are highly protective of their coding, even if they never plan to finish a project.

Flameguru
April 19th, 2013, 06:59 PM
It's been about a week since I first posted about the engine. I've been making a lot of progress in the little free time that I have. Everything is coming together pretty well, I will eventually upload a Build 11 (The current build is 10.9 and is missing some things and has some bugs but otherwise represents what Build 11 will contain for the most part) apk for anyone to try out on their device.

I have 4 more weeks to complete this for my course. Another week of development on the engine itself and I think a basic game demo will be possible. It won't be too polished but I don't want to submit just an engine, I want to show off what it can do so I think I'm going to try and recreate up to Violet City as accurate as my engine will allow for a short game demo. Competition from other groups in my class is severely lacking so I'm not too worried as to how my project will compare to the others :P

Here is my To Do list:
- Finish the In Game Menu (Pokedex, Pokemon Party, Bag)
- Finish the Battle System (Items and Party Switching)
- Implement Signs
- Implement Ledges
- Trainer Battles
- Create a short demo up to Violet City and the first Gym
- Clean up the code
- Submit to Professor

After that, I plan to make it much more modular and remove many of the things that are hardcoded and have the engine parse many of the files from Pokemon Essentials. This will ensure ease of use as well as resource compatibility between engines. I don't have time to do all of that right now though. The good OOP inside of me cringes every time I look at my code right now.

That's about it for now, always check the first post and my site for the most up to date information.

venom12
April 19th, 2013, 08:00 PM
It is great man :D I always wanted to make a game for android :D Good luck.

Flameguru
April 25th, 2013, 08:19 PM
Just a little progress update.

I had a few exams this week so I had to prioritize them instead of the engine unfortunately. It's been a slower week than the last week as far as progress, but I'm still working on the engine in my free time and now that those exams are over I have a lot more time to work on the engine.

I managed to get in battle items (pokeballs and potions for now) and in battle party switching working perfectly. It took a while to get right and was really wonky but now it works perfectly. Capturing Pokemon works and I started to implement Bills PC Storage System (Data structure and saving to it only for now, no way to access it - that will come along with the npc interactions).

Still working on finishing the in game menu. I added the party screen (pretty much a copy paste from the battle system with a few differences) and am working on the Bag next. After the Bag I'm going to tackle the Pokedex system.

As always check the first post for all up to date information and screenshots from the latest builds, I update it almost every day. At this point, this android engine has surpassed my old java engine in every single way, so at the very least I'm proud of that.

If you've tested the Pokemon.apk on your device, please feel free to post any feedback on it. Obviously its in an extremely alpha stage so don't expect it to be perfect. I'm mostly concerned with how it runs performance wise on lower spec devices (I have a Nexus 4, there isnt anything this phone cant handle). I've already had a few friends test it and the on screen controls seem to vary in usability on devices. Whether or not its the fault of the engine or just that their phones are garbage is beyond me. Everything works flawlessly on my Nexus 4 but you get what you pay for I suppose.

I leave this for your potential enjoyment:
v9QmE5criWE

robin22gongon
April 26th, 2013, 12:21 AM
A little comment though. GBC graphics yet GBA Graphics on the Trainer Card? Well, I can't say anything since this is just an engine but still...

Flameguru
April 26th, 2013, 04:40 AM
A little comment though. GBC graphics yet GBA Graphics on the Trainer Card? Well, I can't say anything since this is just an engine but still...

All of the GBA graphics will be replaced with GBC ones eventually, I just took what I had from my RMXP project to have resources to start out with. It's a lot easier to recycle sized and transparent images than to find rips and resize them and add transparency where needed. They're just images though, anyone can change them if they want. Right now the whole menu is gba except for the Pokemon Party screen and the Bag.

Whitney's Shaymin
April 27th, 2013, 08:19 AM
First off let me say wholy crap. This is what makes me glad I have an android. Also in GSC graphics makes this awesome. When this gets close to done I will have to test it. But I will follow this since this is awesome.

FL
April 28th, 2013, 07:16 AM
If you manage to make the essentials things, this can be very useful since isn't hard to load an Android emulator in a PC. Keep in mind the average people that will use this prefer gen 3/4/5 graphics, so try to make it flexive when isn't hard. Your strategy to mimics the Essentials codes is very neat. If you finish the Hardware Keyboard Controls, I suggest you to put a button than hides the controls in screen. Android API is generally easier to use and less burocratic than iOS API IMO.

CrossZero
April 28th, 2013, 09:07 PM
Awesome proyect, could be usefull to a lot of people because its a open-source.

I personaly prefear the FR/GL graphics but ther are a lot of gamers that prefear de GBC style.

I wonder if there are tile options, so you could import tiles from your PC so you could use the tiles you do or tiles other users makes.

By today, the engine is not very good, could be a lot better, but i love it and i can imagine how it will be

See ya

KingCharizard
April 29th, 2013, 07:00 AM
pretty cool, not something I'd work on/with but interesting nonetheless. I hope you pass your final, good luck.

Flameguru
May 2nd, 2013, 10:01 AM
Awesome proyect, could be usefull to a lot of people because its a open-source.

I personaly prefear the FR/GL graphics but ther are a lot of gamers that prefear de GBC style.

I wonder if there are tile options, so you could import tiles from your PC so you could use the tiles you do or tiles other users makes.

By today, the engine is not very good, could be a lot better, but i love it and i can imagine how it will be

See ya


As I've already stated, graphics can be changed by anyone using it. If you've ever programmed 2D RPG style games, you would know that the simpler the graphics, the easier it is to program. With GSC tiles, the Map is only one layer for the actual ground, whereas you would need at least 2 or 3 layers for Gen3 graphics due to transparency and the actual concept of "layers" in the world. Not only are the tiles simple, but all NPC sprites are 32x32 instead of a few pixels taller/shorter so you don't need to worry about overlap or do any calculations. Some people won't like the old graphics, but these are the games I grew up on so I will always like them.

Dynamic tilesets wouldn't be a hard thing to do, in fact I'm going to have to add something like it eventually to deal with Night/Day tile/sprite differences (During the Night, Windows are lit for example). Right now the Day/Night only makes it dark, no tile swapping is performed, so it almost seems like electricity hasn't been invented in this world yet.

I've made a fair bit of progress since my last update. I decided to attempt to remove as much hardcoded stuff as possible. So far I've got the engine loading Pokemon, Attacks, Encounters, and Map Connections from txt files, very similar to Essentials. In fact, the pokemon.txt and attacks.txt are straight from Essentials, but I made a few modifications to the pokemon.txt such as removing the leading information like Name= or Moves= for the sake of less to parse and interpret. Here are some examples of how these files look (They should make a lot of sense to anyone who has used Essentials):

pokemon.txt
[1]
BULBASAUR
BULBASAUR
SEED
BULBASAUR can be seen napping in bright sunlight. There is a seed on its back. By soaking up the sun's rays, the seed grows progressively larger.
GRASS
POISON
45,49,49,45,65,65
45
64
70
Fluctuating
5120
Green
Grassland
0,0,0,0,1,0
OVERGROW
1,7
0.7
6.9
FemaleOneEighth
1,TACKLE,4,GROWL,7,LEECHSEED,10,VINEWHIP,15,POISONPOWDER,15,SLEEPPOWDER,20,RAZORLEAF,25,SWEETSCENT,32,GROWTH,39,SYNTHESIS,46,SOLARBEAM
LIGHTSCREEN,SKULLBASH,SAFEGUARD,CHARM,PETALDANCE,MAGICALLEAF,GRASSWHISTLE,CURSE
IVYSAUR,Level,16
16

0
[2]
IVYSAUR
IVYSAUR
SEED
To support its bulb, IVYSAUR's legs grow sturdy. If it spends more time lying in the sunlight, the bud will soon bloom into a large flower.
GRASS
POISON
60,62,63,60,80,80
45
141
70
Fluctuating
5120
Green
Grassland
0,0,0,0,1,1
OVERGROW
1,7
1.0
13.0
FemaleOneEighth
1,TACKLE,1,GROWL,1,LEECHSEED,4,GROWL,7,LEECHSEED,10,VINEWHIP,15,POISONPOWDER,15,SLEEPPOWDER,22,RAZORLEAF,29,SWEETSCENT,38,GROWTH,47,SYNTHESIS,56,SOLARBEAM

VENUSAUR,Level,32
9
10
0
[3]
VENUSAUR
VENUSAUR
SEED
VENUSAUR's flower is said to take on vivid colors if it gets plenty of nutrition and sunlight. The flower's aroma soothes the emotions of people.
GRASS
POISON
80,82,83,80,100,100
45
208
70
Fluctuating
5120
Green
Grassland
0,0,0,0,2,1
OVERGROW
1,7
2.0
100.0
FemaleOneEighth
1,TACKLE,1,GROWL,1,LEECHSEED,1,VINEWHIP,4,GROWL,7,LEECHSEED,10,VINEWHIP,15,POISONPOWDER,15,SLEEPPOWDER,22,RAZORLEAF,29,SWEETSCENT,41,GROWTH,53,SYNTHESIS,65,SOLARBEAM


7
3
0

moves.txt
1,MEGAHORN,Megahorn,000,120,BUG,Physical,85,10,0,00,0,abef,Cool,"Using its tough and impressive horn, the user rams into the target with no letup."
2,ATTACKORDER,Attack Order,000,90,BUG,Physical,100,15,0,00,0,befh,Smart,The user calls out its underlings to pummel the target. Critical hits land more easily.
3,BUGBUZZ,Bug Buzz,046,90,BUG,Special,100,10,10,00,0,bek,Cute,The user vibrates its wings to generate a damaging sound wave. It may also lower the target's Sp. Def stat.
4,XSCISSOR,X-Scissor,000,80,BUG,Physical,100,15,0,00,0,abef,Beauty,The user slashes at the target by crossing its scythes or claws as if they were a pair of scissors.
5,SIGNALBEAM,Signal Beam,013,75,BUG,Special,100,15,10,00,0,bef,Beauty,The user attacks with a sinister beam of light. It may also confuse the target.
6,UTURN,U-turn,0EE,70,BUG,Physical,100,20,0,00,0,abef,Cute,"After making its attack, the user rushes back to switch places with a party Pokémon in waiting."
7,STEAMROLLER,Steamroller,010,65,BUG,Physical,100,20,30,00,0,abe,Tough,The user crushes its targets by rolling over them with its rolled-up body. This attack may make the target flinch.
8,BUGBITE,Bug Bite,0F4,60,BUG,Physical,100,20,0,00,0,abef,Tough,"The user bites the target. If the target is holding a Berry, the user eats it and gains its effect."
9,SILVERWIND,Silver Wind,02D,60,BUG,Special,100,5,10,00,0,bef,Beauty,The target is attacked with powdery scales blown by wind. It may also raise all the user's stats.
10,STRUGGLEBUG,Struggle Bug,045,30,BUG,Special,100,20,0,04,0,be,Tough,"While resisting, the user attacks the opposing Pokémon. The targets' Sp. Atk stat is reduced."
11,TWINEEDLE,Twineedle,0BE,25,BUG,Physical,100,20,20,00,0,be,Cool,The user damages the target twice in succession by jabbing it with two spikes. It may also poison the target.
12,FURYCUTTER,Fury Cutter,091,20,BUG,Physical,95,20,0,00,0,abef,Cool,The target is slashed with scythes or claws. Its power increases if it hits in succession.

encounters.txt
ROUTE29
16,2,3
161,2,3
163,2,3
19,2,3
161,2,3
ROUTE30
16,2,4
10,2,4
11,3,5
167,2,4
19,2,3
ROUTE31
16,3,4
60,3,4
69,4,5
167,3,5
92,3,5
ROUTE32
187,4,5
69,4,6
179,4,6
194,3,6
23,4,5
ROUTE46
39,2,3
19,2,3
74,2,3
231,2,3
21,2,3

connections.txt
# PLAYER ROOM TO DOWNSTAIRS
47,137
66,136
UP
TRUE
DOWN
# PLAYER DOWNSTIARS TO ROOM
66,135
47,138
UP
TRUE
DOWN
# PLAYER HOUSE TO NEWBARKTOWN
64,142
170,108
DOWN
FALSE
DOWN
# PLAYER HOUSE TO NEWBARKTOWN
65,142
170,108
DOWN
FALSE
DOWN
# NEWBARKTOWN TO PLAYER HOUSE
170,107
65,141
UP
TRUE
DOWN

Other than that, I've pretty much just been fixing some bugs. I've made improvements to the NPC's, but haven't done any sort of event handling with them. All they can do now is say the same sentences over and over, but its a start.

I have another 2 weeks to get done as much as possible for my course, and then it will be released for anyone to use/improve upon. I'll keep posting updates here as things actually get done. Keep checking the first post as well for updated beta apk's to try out.

Whitney's Shaymin
May 10th, 2013, 09:06 AM
How is this going. Just wow. I rly need to try this. Keep it up and we will have new mobile games.

Whitney's Shaymin
May 13th, 2013, 09:05 AM
Okay I officially tried this and just wow. Few things though

Nurse joy doesn't respond to button so can't heal.
Couple minor graphical glitches though not much.

Flameguru
May 13th, 2013, 12:06 PM
Okay I officially tried this and just wow. Few things though

Nurse joy doesn't respond to button so can't heal.
Couple minor graphical glitches though not much.

Only way to heal currently is to have your Pokemon faint. Progress has slowed a bit and I won't be able to add too much beside a few fixes this week as I have finals this week. Once they're over and done with and its submitted for grading I will continue it as well as release the source.

Whitney's Shaymin
May 13th, 2013, 12:41 PM
k long as you continue to work on it. I figured out how to heal.

Flameguru
May 27th, 2013, 04:28 PM
I've updated the first post with a link to the Eclipse Project and source for anyone interested in working on it. I've been busy lately but I haven't forgotten about it! Some things are still hardcoded and those are the things I want to change by the next build. The things that are hardcoded are that way simply because I was running low on time before it was due and just wanted something quick and dirty that was functional. A professor won't care if you have internal and backend 100% complete if there is no frontend to experience it. Another thing I must change is to switch to a game loop instead of input/timers.

To anyone who downloads it and may have an interest in helping with the code, PM me. If you know Java then you're pretty much set as all of the Android specific things don't really apply because of the underlying E3roid engine I'm using.

Rhatios16
May 27th, 2014, 05:23 PM
nice work, just how far you are into it now, and just wondering are you gonna implement the use of animated sprites into this. keep the good work