Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create IA players #207

Open
koburk opened this issue Jan 29, 2020 · 21 comments
Open

Create IA players #207

koburk opened this issue Jan 29, 2020 · 21 comments

Comments

@koburk
Copy link

koburk commented Jan 29, 2020

This might be a bit hard but challenging and Imo, very interesting. We could have tons of IA players to fight with (More places to attack to start and they can attack too, so be aware!).

Steps:

  • Create IA Player (DONE)

IA Players will have preferences such as:

  • Bunker makers (Big % of their income will be spent on defense), not much time spent ONLINE
  • Agressive play (Big % of their income will be spent on fleet), a lot of time spent ONLINE.
  • Hybrid play (Income will be spent on defences and fleet).
  • NoobStyle (random stuff O.o) (DONE)
    noobstyle might change into another style after some time (Everyone learns to play!).
  • Enable IA Players to build structures (DONE)
  • Enable IA Players to research (DONE)
  • Enable IA Players to build fleet (DONE)
  • Enable IA Players to build defenses (DONE)
  • Enable IA Players to colonize.
    Based on IA style, the colonies will be placed in different positions to fit its play style.
  • Enable IA Players to spy.
  • Spy report will be processed and IA Randomness will decide if attack or not.
  • Enable IA Players to attack
  • Enable IA Players to recicle.
    Based on IA Player experience, reciclers will be sent before/during/after the attack.
  • Enable IA Players to do FleetSaving.
  • Enable IA Players to comerce (ok, this one might be the hardest hehe)
  • Enable IA Players to request comerce to human players.
  • Enable IA Players to do attacks with other IA Players.
  • Enable IA Players to destroy moons.
    Aggresive style will try to hunt players down. Tons of variables will ve involved, such as IA Player points, profits after destroing the enemy fleet,moons, etc.
  • Enable IA Players to use phalanx.
  • Enable IA Players to attack fleets using phalanx information.
  • Generate an IA Player ranks based on power and experience. (DONE)

Cheers

Extra info:

Added New Objects

  1. Planet type
  • Asteroid: Allow players to mine resources.
  1. Ships
  • Driller: This specialized ship can be sent to asteroids for extracting operations. Each level of "Drilling" will allow drilling improvements.
  1. Technologies
  • Drilling: Allow the use of asteroids and enables the ship "Driller".
    Level 1: Allow metal extraction
    Level 4: Allow crystal extraction.
    Level 7: Allow deuterium extraction.
    Level 10: Allow dark matter extraction.

  • Dark Matter Understanding: Allow our scientists to generate dark matter within our labs. Each level will grant 1 DM / Hour.

@koburk
Copy link
Author

koburk commented Feb 3, 2020

Working on machine learning ...

@gregariomansa
Copy link
Contributor

gregariomansa commented Feb 3, 2020

To be able to create an use bots, be it AI or not, would be wonderful for the Steemnova community. The only needed restriction could be that the bots are clearly identified as such.
Some years ago, little before de facto quitting the game, I wrote about this. I think it was a suggestion to @mys. In ]Discord, most certainly. He kindly replied, but with a negative answer.

@gregariomansa
Copy link
Contributor

gregariomansa commented Feb 3, 2020

Since this is open source, this could be implemented outside Steemnova. Now I remember that is exactly what a suggested to @mys. Something like "If you don't do it, maybe I will".

So, @koburk, if you start a server that allows bots, you can count me in.

@koburk
Copy link
Author

koburk commented Feb 3, 2020

Thank you for your reply. Actually I'm already working on that!. Actually, instead of using the steemnova engine for testing (because this engline was made to work using php as "brain"), i'm developing a full new engine, using php only to display info and making all the "thinking" within SQL Side.
Once I have it runnin, I'll have to see how (if possible) to translate my development into steemnova engine.

Identifying IA as such is gonna be easy, but the goal is to set their IA to "play" not to be farms. That's the main reason i'm developing the new engine to allow machine learning in the process (Yes, I might be going too deep into this, but I like the challenge). In time we're gonna be learning from bots for sure.

image

There's an example of my environment values. Ofcourse there's still more things to add to allow bigger events, those are my bassics for now.

If you pay attention, you'll see "max planets", and "min/max fields", instead of using ranges for planet position like ogame, i will use randomness to set each planet's fields. The difficulty in this case will be get the biggest possible, because the first positions will have a very low chance to be that big, same for the furthest. I still need to check the math for that.... So many things to check haha

@mys
Copy link
Contributor

mys commented Feb 3, 2020

In my opinion the best place to set AI is in PHP Cronjob. Cron script can iterate over bot-players specified in database and take actions for them. All in random interval.
The biggest challenge is to precise path of actions bot should do.

@koburk, as actions I mean sending commands to SQL.

@koburk
Copy link
Author

koburk commented Feb 3, 2020

You're right, but having something in php calling sql or just having sql, I much rather the second option. Barely no performance issues but because you can have all the code in the same place. At the end that "cron" can be scheduled in mysql too.
I work as DBA, so that's why I might be a bit commited to use a bit more the mysql power instead of using php to iterate or take actions, those are way faster using pure sql (Focused on big amounts of information).

@Qwatayean
Copy link
Contributor

Qwatayean commented Feb 3, 2020 via email

@koburk
Copy link
Author

koburk commented Feb 3, 2020

I'm not 100% sure, it was a bit hard for me to really get what you were trying to say, correct me and my apologies in advance if i'm not getting your idea...

Seems like you are trying to figure out the best way to improve performance, but there's no much to be worried about. During testing, i was able to get 10.000 IA players runing at the same time, checking for actions ever 1 sec with over 97% of success
What does that 97% of success means?, basically it means you can run 9700 orders every 1 sec without worries about if those were executed, but that's a full push try. Normally we wouldn't be using as muchas CPU/Memory trying to simulate every 1 sec, instead every 1 minute to hours between them (the difference would be the IA play style). Basically if we get to play vs 10.000 IA players, not everysingle one of them will be doing stuff at the same time, but having a % of performing an action.

The global/general idea is: you ask those 10.000 IA players: "are you online?" if it's online you ask again: "are you going to do something?", those two questions are set to enable actions or not, then if those two answers were YES, you ask: "do you wanna try something new or follow machine learning stuff?", based on that: "what do you want to do?"

that's a very brief idea.

@Qwatayean
Copy link
Contributor

Qwatayean commented Feb 3, 2020 via email

@koburk
Copy link
Author

koburk commented Feb 3, 2020

Indeed, the queries are not the same as user queries (Not stored, processed instead).
I'm glad I could answer without changing topic hehe.

@koburk
Copy link
Author

koburk commented Feb 5, 2020

At this point, my IA_Players are able to build stuff... Here you can see my log (From newer to older descending order).
Basically every minute, the server checks the questions I've posted before (is online, wants to do something ...), then checks what it can actually do (based on requirements, levels and resources), and then builds. Not much until now, but step by step.

DB Object ia_connection manages ia_brain object
DB Object ia_connection (Event) created
DB Object ia_brain manages queue_lock object
DB Object object_level created
DB Object wants_to_do (Function) created
DB Object ia_brain (Stored procedure) created
DB Object ia_queue created
DB Object is_online (Function) created
DB Object object_detail created
DB Object object_name created
DB Object universe created
DB Object rapid_fire created
DB Object requriments created
DB Object planets created
DB Object create_user manages full_galaxy object.
DB Object create_user (Stored procedure) created
DB Object change_log created
DB Object users created
DB Object ia_style_description created
DB Object types created
Random names for IA_Players
Change log created

image

image

This is being hosted on a small virtual machine and works without any issue for now (fingers crossed)

@koburk
Copy link
Author

koburk commented Feb 13, 2020

Update:
My IA-Dumb-brain-dead-Players are already fighting each other to climb my ranking

image

@koburk
Copy link
Author

koburk commented Feb 13, 2020

Full LOG

DB Object ranking_hist created
DB Object ranking created
DB Object error_check created
DB Object build_queue_process manages update_planet_values
DB Object update_planet_values (Stored procedure) created
DB Object reset_worl handles populate_world
DB Object populate_world (Stored procedure) created
DB Object reset_worl (Stored procedure) created
Random names for IA_Players -> Now using name_list instead
DB Object name_list created
DB Object build_queue_process (Stored procedure) created
DB Object update_planet_lastcheck (Stored procedure) created
DB Object set_new_object_levels (Stored procedure) created
DB Object ia_queue_to_general_queue (Stored procedure) created
DB Object ia_decide (Stored procedure) created
DB Object ia_build_hist created
DB Object set_new_object_levels (Stored procedure) created
DB Object update_planet_lastcheck (Stored procedure) created
DB Object build_queue created
DB Object ia_connection manages ia_brain object
DB Object ia_connection (Event) created
DB Object ia_brain manages queue_lock object
DB Object object_level created
DB Object wants_to_do (Function) created
DB Object ia_brain (Stored procedure) created
DB Object ia_queue created
DB Object is_online (Function) created
DB Object object_detail created
DB Object object_name created
DB Object universe created
DB Object rapid_fire created
DB Object requriments created
DB Object planets created
DB Object create_user manages full_galaxy object.
DB Object create_user (Stored procedure) created
DB Object change_log created
DB Object users created
DB Object ia_style_description created
DB Object types created
Random names for IA_Players
Change log created

@koburk
Copy link
Author

koburk commented Feb 19, 2020

I'm so proud, my lobotomized retarded IA Players are able to decide if they're gonna get energy from upgrading solar plants or buying satelites...
I just wanted to share it with you guys, I'm like a father for them ... haha

@gregariomansa
Copy link
Contributor

gregariomansa commented Feb 19, 2020 via email

@koburk
Copy link
Author

koburk commented Feb 20, 2020

I will open the server for testing once my bots are less retarded and not all of them get lobotomized haha.
I need to find a way to give a bot (or group of bots) a goal, like "reaching the biggest metal mine" or stuff like that (like real people do).
Still i need further tests, i haven't developed any UI yet, so there's no way to "play" the game but being part of the ia. Like i said, i need longer days with more time to spend on this engine ...

Also, I've managed to give some sort of personality to each IA. Currently if you attack a player multiple times it will improve their defences and will "find a way" to not get attacked that much. This process was made because of 2 points.
1- The universe evolves and so should do them.
2- Farming something that has always the same thing is boring, we need to spy, simulate and then attack, not just take notes of a target list with coordenates (IMO).

@koburk
Copy link
Author

koburk commented Feb 25, 2020

:) Currently teaching my brain-dead lobotomized retarded IA_Players to colonize....
I'm splitting ia_players in agro or def style (basically), at the moment only defensive style is being used, i want them to colonize first and then i'll enable agro style to start teaching them to spy, then i need to build a simulation/battle engine, generate the math for each player (some will be a bit more reckless) to decide if attacking or not based on resources captured/recicled and ... yeah, i want the IA_PLAYERS to seek revenge!, so if you screw up with them they will find a way to get something in return... of course this could be something good to set baits and recicle their attacks ahaha (i need to give a small chance for that to happen but it will be feasible), at the end of the day the IA is there to push players economy so it won't be perfect...

Oh sh@t, i might need to recreate the fleet table structure to allow more stuff, like:
MOVE A PLANET. Oh yeah, what about using death stars to pull a planet from one place to another (it will consume huge amounts of deuterium) and will enable another mission to destroy those death stars pulling planets.
IMO this feature shouldn't be only for players with death stars but everyone, so you can send a fleet to hold position in a planet and then the owner of that planet can use those ships to move the planet for example, allowing other people to intercept the movement and recicle those poor and exhausted death stars ...
Still I need to think about some more missions, including renting, giving away...

@koburk
Copy link
Author

koburk commented Feb 27, 2020

In order to get the most of my system, I've moved the most used tables into memory, because of that a few things had to be changed, like adding a backup every 3 minutes to disk tables and if something goes wrong (Server/MySQL shutdown/restart for any reason), every 3 minutes the system checks if memory tables are populated, if not the system fills them and we're ready to go again :).

Also, now is possible to play on different universes with the same user/pass (Still, a new login is required, i'm not trying to include multiple users within multiple univereses a built-in for now, but people can do it if they want)

Update

  • DB Object research_level removed -> Migrated to object_level instead
  • New research: Dark matter understanding. Each level will grant 1 unit of dark matter for every hour.
  • New ship: Driller. This ship will be able to drill within asteroids to gather resources.
  • New research: Drilling. It will allow material extraction from asteroids. LVL1 Metal, LVL4 Crystal, LVL7 Deuterium, LVL10 Dark matter.
  • New planet: Asteroid. It will allow drilling operations.
  • DB Object users_stk created
  • DB Object requirement_stk created
  • DB Object rapid_fire_stk created
  • DB Object planets_stk created
  • DB Object object_level_stk created
  • DB Object object_detail_stk created
  • DB Object full_galaxy_stk created
  • DB Object build_queue_stk created
  • DB Object create_events (Stored procedure) created
  • DB Object create_ranks (Stored procedure) created
  • DB Object move_to_disk (Stored procedure) created
  • DB Object randomize_name (Stored procedure) created
  • DB Object recover_to_memory (Stored procedure) created
  • DB Object task_daily (Stored procedure) created
  • DB Object try_to_buy_fleet (Stored procedure) created
  • DB Object try_to_fortify (Stored procedure) created
  • DB Object try_to_research (Stored procedure) created
  • DB Object is_building_def (Function) created
  • DB Object is_building_fleet (Function) created
  • DB Object is_researching (Function) created
  • DB Object try_to_build (Stored procedure) created
  • DB Object research_level created

@koburk
Copy link
Author

koburk commented Mar 2, 2020

Best design ever! haha, nah, but seriously, this is moving forward. Next steps will be enable sections to build structures -> researchs -> defences -> ships in that order.
After that i need to configure fleet orders and action for each order (Nightmare in progress!).

image

Also, anyone insterested on helping me catching bugs and start developing an emipre before hand is welcome on board!
I don't have a static ip yet but you can connect to my address using:
http://188.127.188.245/fire/index.php

Today i will create about 20.000 players and they will stay for now. In theory there's no need to reset the world anymore. So since tomorrow you can create an account and ... don't know what you'll be able to do for now O.o ... figure out on rankings hehe

if somethings goes wrong, feel free to send me an email at koburk@hotmail.com
Soon enough i will enable in game messages, tickets and so on... too much to do so little time :/

@koburk
Copy link
Author

koburk commented Mar 6, 2020

Haha, i'm starting to get some stuff done. Im using ajax to avoid page reloads, feels smooth!

image

@koburk
Copy link
Author

koburk commented Mar 9, 2020

Researching is enabled

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants