OGame Automizer Development Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome on the OGame Automizer Development/Support Forum

If this is your first visit, be sure to check out the
Detailed Guide : A guide which we are still writing (En)
Guide : For OA Beginners (En)
Guide : For OA Beginners (Fr)

Author Topic: work with source some question  (Read 1292 times)

0 Members and 1 Guest are viewing this topic.

Vammpi

  • Guest
work with source some question
« on: May 13, 2010, 02:49:22 AM »

Hi i'm work with Your source code.
I'm allready added some mising pieces to my version but reading throught the code i'm found intresting things
1.
in the DB.java file You set up teigers fired on every update/insert/delete in database
so if f.e we got probe scan parsed the parser make update in database->database fire triger which search antaier list of users/targets/prefered targets one by one record to update the fields... its looots of operation just to update probe report...
my point is if use the PK(primery key) as the indexes of arrayList which hold all players then update nessesary fields is simpe:
query DB to get ID of planet-> OGamePlayerLite t= account.Playerlist.get(ID) do what to do with it

thats i'm think reduce a bit CPU consuming :)

edit:
another things You doing aloot of string maching for each on cordinate f.e it is mach faster to compare short valuses insteed of string :) and use less memory depends of universe (xxx:xxx:xx) -> short,short,byte= 9 bytes to compare not 12 even is can be easy packed into int value:

(xxx:yyy:pp) if we use the short for 1'st & 2'nd and 3'th byte is xxxx yyyy pp
(1:259:3)=>  is xxx=0x0001h yyy=0103h pp=0x03
so     
    short x =1;                                                   // 0x1h
    short y =259;                                     // 0x103h
    byte  z=3;                                    // 0x3h                     
    long hashCode = 0;              //0x0000 0000 0000 0000h
    hashCode|=(long)x<<0x00;   //0x0000 0000 0000 0001h
    hashCode|=(long)y<<0x10;   //0x0000 0000 0103 0001h
    hashCode|=(long)z<<0x20;   //0x0000 0003 0103 0001h

(1:259:3)=>hashcode = 12901875713D =  3 0103 0001 H

Easy and fast to compare valable .
« Last Edit: May 13, 2010, 04:17:37 AM by Vammpi »
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1,244
    • View Profile
Re: work with source some question
« Reply #1 on: May 13, 2010, 05:20:32 PM »

The code you are speaking about is one year and half old without major update. (RD will be introduced in old unis : http://board.ogame.org/index.php?page=Thread&threadID=645004)
Since than I've changed the db engine from McKoi db (last software update 2004) to Apache Derby (2009) in OA for OGame 0.85. The main problem in McKoi db was indexing problem, seems it doesn't work as it supposed to. When I have passed Apache Derby the speed has increased by a factor of 10.
About data representation, I'm using for coords 4 numerics (2:3:2:1), this way it's possible to select needed targets with sql (ex: galaxy X from solar sys Y to Z).
Logged

Vammpi

  • Guest
Re: work with source some question
« Reply #2 on: May 13, 2010, 10:44:08 PM »

Well i'm agree the database used in this version wos pure:P i'm swiched todey my version to postgresql
all coord changed to long (selecting range of planets its as well  so easy :) if cord<fromHashCodeCord and cord>toHashCodeCord
hmm whats more
i'm added antypush system and redesign the bot so:
first get planets from range from db
count prioryty based on old scan + excepted rise of resurces based on lvl's of factory
chese MAX_SLOOT highest prioryty targets and scan them randomly
decide howMAch waves use(still work on it)
send flees/waves
repeat until no targets toscan/attack/oftaack times grates then push count

i'm removed also all string comaparations where wos posible so the GlobalActivity use Flags insteed of string

PS the redesigns of univeerse...hmm i'm start work on this source for fun not for 1'st placee on universe ^^
PSS. Can You post a bit newst version ten 1.5 year old:) i'm intresteed how u solve some thing
« Last Edit: May 13, 2010, 10:54:31 PM by Vammpi »
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1,244
    • View Profile
Re: work with source some question
« Reply #3 on: May 14, 2010, 12:43:05 AM »

There were some many changes since 1 year and half... just check the change log (somewhere in the guide : http://docs.google.com/View?id=dfq87kpr_4dtkq8ddw)
The most noticeable
- Representation of buildings/techs/ships/defs was changed to ConstructionType, used also by Construction sim (about 400 lines have to be changed manually in your version) :
public Map<Byte,ConstructionType> entities = new HashMap<Byte,ConstructionType>();
- There was a memory leak in Combat Sim which was discovered when OA has started to make thousands of simulations
- Reduced memory usage and the speed increased by factor 10 of Construction sim
You can get latest 2 fixs from this link : http://rapidshare.com/files/387005417/oa_packages.zip.html

Quote
Can You post a bit newst version ten 1.5 year old:) i'm intresteed how u solve some thing
Sorry but there is nothing new for old version, and the code source of OA for RD is closed, but you can ask.
Logged

Vammpi

  • Guest
Re: work with source some question
« Reply #4 on: May 14, 2010, 02:34:42 AM »

Thx i'm will start marge the "fixes" tomorow(i'm mean morning) now i'. a bit to sleepy
well when i'm look into OgameLitleType look olmost this same then my version :P
i'm have still loots of ideas to try thx for "playground" :)
when i'm finish i'm can shre source with You (its myown oand only  own version so dont be worry about eny publishing)
cu
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1,244
    • View Profile
Re: work with source some question
« Reply #5 on: May 14, 2010, 02:36:24 PM »

Quote
Thx i'm will start marge the "fixes"
The code of OA for old unis will be useless in about 1 month, so for me it's a time wasting, but as I see you are quite interested (where you were one/two year ago ;)), so I can propose you to work on an interesting module and a quite easy one because the main work has been done already. It's a sharing system between clients of galaxy scans/spy reports, chat etc. The communication between clients is fully done (http://forum.ogameautomizer.com/index.php/topic,405.0.html), so it's just a question about defining sharing types of data and managing sharing groups, plus a little GUI. (Why I'm not doing it myself, it's just because currently working on core code bugfixing/optimization and testing the stability of communication between client and server since a month)

Quote
when i'm finish i'm can shre source with You
Yes, share it, old unis users would be very happy with it ;)
Logged

Vammpi

  • Guest
Re: work with source some question
« Reply #6 on: May 14, 2010, 09:25:22 PM »

Yea fixes merged after cupple of hours  fight with errors :)
Quote
where you were one/two year ago ;))
Well i'm wos working on Mu Online server in java xD , sadly project wos newer  finished :/ long story
so my adective to use raw data types and short it /combine as posible
btw writing documentation in code help a loot after whille not only to pll reading it but for author itself as well.
thats remrmber me i'm must make Data normalisation process for database :) i'm hate it

about sharing data well the fastest wey isshere it throught DB :P what requare ofc central database connecting for each of client so

client----->[own database]                           client----->Own Database
|+-------->[central shared database]<-----------|
                     |---reports table
                     |---detaled reports table
                     |---whatever data toshare

so 1'st clients look for data in shared database if not exist looks in own if notexist probe target...
if requared more "live" communications between clients use sockets :)  the pm systemingame can be monitored so is not safe
problem canbe when client what is conecting onother client not have static IP
so isrequared server betwen clients where can be easy imlemented group system

[client1] ---> [own DB ]            [client2]---->[Own Database]
   |                                           |
   |                                           |
   +---------->[Server] <---------+
                        |
                       \|/
              [Central Databse]
« Last Edit: May 14, 2010, 09:28:41 PM by Vammpi »
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1,244
    • View Profile
Re: work with source some question
« Reply #7 on: May 14, 2010, 11:48:02 PM »

Quote
problem canbe when client what is conecting onother client not have static IP
not a problem, the communications are fully done. the server app is up and running, it manages already connections & disconnections and several remote object calls.

I want to implement a simple push/poll system :
Client has something to share (solar scan/spy report, a personal message etc.), client makes a simple java call on a server object
server.shareGalaxyScan(galaxy_scan, uni, sharing group) -> server side, a tread in a pool dispatches a message to all clients subscribed to uni:sharing group -> all clients receive a galaxy scan

about central shared database, I don't think it's a necessary because most OA users run oa for a long time period without shutdowning it, and db could be added after quite easily.

currently uploading all needed packages...
Logged

Vammpi

  • Guest
Re: work with source some question
« Reply #8 on: May 15, 2010, 12:03:39 AM »

Ok in two nodes network it willwork perfect:)
but in another point not that nice.
consider network of 4 nodes=players
4  players scan galaxy and probe this same range of adreses each one send reports to each one else
if mesages are not parsed somewhere to avoid dulicated data the eaach of node will recive 4 coppy of scans
if 5'th node connect  after wile to network then hi do not have accces to valable allay's information
i'm mean is faster to send information to centralpoint and have acces to it  when needed not be flushed by stream of data all time

edit:
Ofc u can make 1 client work in server mode and use it own database to stoer information with not needed runed somewhere alone server + database engine program
« Last Edit: May 15, 2010, 12:11:24 AM by Vammpi »
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1,244
    • View Profile
Re: work with source some question
« Reply #9 on: May 15, 2010, 12:16:39 AM »

Quote
i'm mean is faster to send information to centralpoint
Yes, I understand yours arguments but the central point doesn't have so big storage to store data for ... 130 og servers = databases. So prefer to add db in September/October. Plus, it would be simpler to implement and have something working and useful very quickly.

Quote
Ofc u can make 1 client work in server mode and use it own database to stoer information with not needed runed somewhere alone server + database engine program
No way because they are likely to be behind NAT/Firewall

Needed classes&software&packages : https://ogameautomizer.com/temp/oa_CORBA.zip

The deployment is a little tricky :
- src/corba are generated java files by executing compileIDL.bat, it take in account corba.idl (search on the net about the syntax, "corba idl"). A tip : to define an array : typedef sequence<DataType> DataTypeArray;
- src/web all current files liked to Client-Server side, but some classes are not available to you (just replace with constants)
- Most difficult : libs in corba-libs have to be added as java boot classes (Eclipse : create a custom library => add to the custom lib all files in corba-libs => change order of class loading in the project : corba-libs before even JRE). From command line : -Xbootclasspath/p:"./libs/OB.jar:./libs/OBNaming.jar:./libs/OBBiDir.jar"
- JOB-4.3.2-bin just for idl compilation and naming server
For tests
- run runNamingService.bat first
- then src/web/Server
- then src/web/Client
« Last Edit: May 15, 2010, 12:47:13 AM by Devil's Hand »
Logged

Vammpi

  • Guest
Re: work with source some question
« Reply #10 on: May 15, 2010, 12:25:27 AM »

Downlondin right now ...
I'm use Netbeans work better 4 me:P

I'm  send You email on gmail adres so we can took using gtook
Logged
 

Page created in 0.099 seconds with 19 queries.