<< May 14, 2020 | Home | May 16, 2020 >>

old-school patching

I actually can't remember when it was the last time I 'manually' patched a file. But it was quite common in the pre git-days. A patch basically is the same as a git-commit, telling the code where to insert what and where to remove what... As I'm trying to get 'Wood Games 3D' back to life, I first need to get it to compile. Strangely I did not keep my highly altered libgdx-version for some reason only one patch-file. At least I wrote down a date in the file (I guess that meant the day when I created the patch and not the day of its svn-revision). But still a good point to start.

A patch looks like something like this:

Index: src/com/badlogic/gdx/scenes/scene2d/ui/Label.java
===================================================================
--- src/com/badlogic/gdx/scenes/scene2d/ui/Label.java	(revision 2440)
+++ src/com/badlogic/gdx/scenes/scene2d/ui/Label.java	(working copy)
@@ -62,7 +62,7 @@
  *
  */
 public class Label extends Widget {		
-	final LabelStyle style;
+	LabelStyle style;
 	String label;
 	final TextBounds bounds = new TextBounds();
 	final Vector2 textPos = new Vector2();
@@ -139,4 +139,13 @@
 		this.label = text;
 		invalidateHierarchy();
 	}
+	
+	/**
+	 * Sets the {@link LabelStyle} of this Label  

In order to apply it to a folder. You need to 'cd' into it and write

patch -p0 < patch.txt

And then pray. ๐Ÿ™‚ In my case I had a line ending mismatch resulting in lots of those errors:

Hunk #1 FAILED at 1 (different line endings).
Hunk #2 FAILED at 48 (different line endings).

And it makes sense. I developed the game on windows but I'm working now on my beloved linux. So, I applied dos2unix on both, the whole folder as well as on the patch:

find . -type f -print0 | xargs -0 dos2unix

(This command calls dos2unix on all files from the current folder upwards)

After this, calling the patch-command (as above) just worked. I call this a miracle ๐Ÿ™‚

Refs:

Tags :

Export this post as PDF document  Export this post to PDF document

Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!

Docker: mysql5

In order to create a local mysql5 server with adminer web-addon:

  1. Create a file mysql.yaml:
# Use root/example as user/password credentials
version: '3'

services:

  db:
    image: mysql:5
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    volumes:
      - ./data:/var/lib/mysql
    ports: 
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: example


  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

Use docker-compose to install:

sudo docker-compose -f mysql.yaml up

Open browser at localhost:8080 using username/passwort root/example

References:

Tags : ,

Export this post as PDF document  Export this post to PDF document

Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!

pimp eclipse with a working(!) and beautiful color theme "Darkest Dark"

If you want to work with eclipse (as I do with trying to revive Wood Games 3D) and struggle with the default color themes and think "WTF" try the "Darkest Dark Theme". You can't imagine the difference.

Steps in Eclipse:

  1. Help > Eclipse Marketplace...
  2. Search > Find: 'Color Theme'
  3. Select "Darkest Dark Theme with Devstyle"

  4. Press 'Install Now', wait and restart eclipse.
  5. After Restart you (at least I had to) should change the javadoc-background-color, as it was for me black on black:
  • Window > Preferences > General > Appearance > Colors And Fonts > Java > Javadoc View Background
    Choose a color you find fitting. (Obviously you can also change the font color)
  1. Be happy:
  • ...I would say. But there is a strange flickering. Sometimes more sometimes less. Usually the bigger the problems with the code you are trying to understand, the harder it is flickering :D. I just found out (and I remember that I already knew this some time ago) that gtk3 is the problem.

    a) For new versions like eclipse 2020-03: Here eclipse itself points you to the solution (if you loog in the logs or start eclipse in the terminal):

    ***WARNING: Detected: GTK_IM_MODULE=xim. This input method is unsupported and can cause graphical issues.
    ***WARNING: Unset GTK_IM_MODULE or set GTK_IM_MODULE=ibus if flicking is experienced.
    

    b) For older eclipse versions: You can set it back to gtk2 to avoid that. Just insert following right before -vmargs (two lines):

    --launcher.GTK_version
    2
    

    You can check the gtk-version here: Help -> About -> Installation Details -> Configuration Tab -> org.eclipse.swt.internal.gtk.version
    More read More read2

Tags :

Export this post as PDF document  Export this post to PDF document

Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!

Project: 'Revive Wood Games 3D'


Ok, since I stumbled over my one and only thingy that I would call a game "Wood Games 3D" and made me sad, that it actually died. That had a couple of reasons. One was that I was too lazy to react to all of those google-play "You need to take action"-Emails. So actually there is only one reason. Me letting it die. There were minor other reasons. One e.g. that scoreloop the social-plugin I based some functionality on (leaderboards, friends, challenges and more) was closed... Not sure I will revive all functionalities but at least I want the leaderboards to be working again...

I will make it up to you, dear Woody. At least I will give it a try.

Day 1(2020-05-15):

  1. Starting with hardest part: setting up the project (eclipse + libgdx). I hope I actually have the latest sources :D But it looks ok...and I won't let me be discouraged by this state:

    Let's see what is what. Super exciting :D It's like a time travel and I'm prepared for some ugly spaghetti-code ;)
  • Well,...seems that I don't have my altered version of libgdx anywhere. I only found an old patch-file. What in hell did me not include the libgdx-library?

  • eclipse, my ide of choice in former days. But nowadays I struggle more with color-theme as anything. Lots of background/forecolor like white on lightgray or such....so painful. (I guess I done something wrong? This can't be default) But I found "Darkest Dark Theme with DevStyle" in eclipse-marketplace and it transformed the experience from (let's call it) undefined to beautiful. Really. Such a difference.

  • One thing you see here is again. Never use an IDE-dependent build-process. It funks you latest once the time passed by a bit...

  • I actually have also create at these days an server of my own (not sure about what features). It is using mysql5 via hibernate. I'm not 100% sure if I want to use this or to write a new mapping to e.g. nakama server. First of all I will check out if I can start my old 'faw'-server (which stands for fight'n'win ;) )

  • I finally managed to setup a mysql5-server via docker with the right user-managment settings setup. And here we are. The server initalized itself. Very exciting to see this work more or less out of the box. Let's see what my former me created there ๐Ÿ˜€

  • Ok, then I tried to get libgdx and the engine I put on top of it to work again. I really don't understand how stupid I was, that I did not pack the altered version of libgdx with the project!? At least I had the patch file that included a date "2011-07-29" in it and I hope it was refering to the date of the svn-revision of libgdx.

    Libgdx is now on github but it was no problem to get the state of this date and miraculously applying the patch worked more or less without real problem. With some manual work, I could compile the GdxEngine (which is my engine, put on libgdx for loading the blender-scene with materials and so on). So it's first time to commit the current state and then to import WoodGames into eclipse and see what is breaking. 0 Errors, nice. At least for now ๐Ÿ˜€

  • Well,...actually I made lots of progress and came to a point where I could compile without error. Even the connection to the server worked, but for some reason not a single texture can be loaded....to make it a 'bit' harder the lib for loading the image is a native one... actually it is a bit frustrating. Another point is that I don't have a clue how to create the APK as it is based on the old ADT-Plugin...I guess I will give it a try tomorrow to setup the old eclipse plus adt plus android-15. We'll see. But for today it's enough...

Day2(2020-05-16):

  • After a sleep I have new plans. First of all, I need to go one step back and see if the vanilla libgdx version that I patched actually worked. I did a test on their "hello-world" but that was using a whole bunch on included libs (including native ones) and did not point to the current projects... and then we will see.

  • And voila. It turned out that I had bad luck with the libgdx-commit I chose. They changed a native interface call but did not compile the corresponding native so/dll. So I just changed the native interface to version before and wood games (aka wood olympics show up). That was nasty and burned most of my time on this ๐Ÿ˜€. But that is the life of a bug-hunter ๐Ÿ˜€ Great start for day 2 which boosts my motiviation to 100% again....we can do this. ๐Ÿคž

    Afaik the desktop version worked 100% with my faw-server, no scoreloop involved. You see this fancy login-screen....I'm optimistic that this might work quite fast ๐Ÿ˜€. At least if I can get keyboard-input to work...

  • oh man,...I don't get it. Keyboard-Controls are just ignored. Strange thing, JOGL as well as LWJGL is not reacting to any keyboard-input. Mouse works perfectly...I really shouldn't put too much time into this, as I need the keyboard only for the login-process...and the game itself will be played on android (where hopefully the keyboard work)....but I do want the keyboard do work ๐Ÿ˜€

  • Sry JOGL, that it did doubt you (I just used one of the libgdx-test-cases and did not test it on WoodGames itself (as with lwjgl)). You give me the keystrokes I need letting me shout out sounds of pure delight

  • Creating a new account worked out of the box. What a nice surprise. Every other access to the server seems to through an exception though. On both sides on client and server. Well I didn't expect less ๐Ÿ˜€

  • Bรครคmm, found that the problem was some setting in the MySQL-Database. Thx to internet and the right search query, it now works with the sql-queries as well ๐Ÿ˜‰. As a reminder for me, executing this command as root on mysql did the job:

    SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
    

    So now, I can actually create scores, they are added accordingly to the leaderboards. So good :D

  • Even the daily "world championship" works which was choosing one event and the best of this time-period gets a medal. That was actually a good design-decision as I really kept people playing it like crazy. Not many, but like crazy (aka daily)

  • It seems that at least for the desktop version everything seems to work now. Things that I need to add or change:

    1. The dashboard needs to give a chance to logout and login for another account. (It gives you already the option to change the name, what I do like.)
    2. Deactivate autologin (at the moment the last user is automatically logged in)
    3. Bring Back K7 (all disciplines combined to a multi-event)

    But before I start thinking about adding new code I need to try creating an apk out of it. And I do want to it to work with an ant-script and not with adt.

  • Nonetheless I have to setup adt to do some debugging. That worked with some flaws. At least I now can start debugging and see why it is not working ;).

  • So,...here we are. I could run "Wood Games 3D" on the phone, strangely the faw-dashboard was shown already, as usually this should only be done on desktop if I recall right. It actually did not create a user and it didn't work 100%, but it is quite a step for "bringing woody back to life".

  • Some braindeads later,... well,...for some reason I can't have multiple users, because hibernate refuses to add more user objects. I kind of remember that this problem occured at these days and there is a way around it, but I can't recall... I take a break and think about kicking faw and porting it to nakama-server

  • Well, actually I did not stop but switched into chaotic uncoordinated headless mode ;). Not even started with changing the server but wanted to put the game to a android-version with which I actually can publish to google play. But doing this seems to kill my network. I ended up using 3 different IDEs (eclipse photon with ADT, eclipse 2020-03 with 'Eclipse Andmore' and Android Studio creating a new project from scratch. And then trying all three simultaneously. This is madness? Yes, I agree.

Day 3:

  • After some sleep let's tidy up a bit first. My plan is to follow the approach with Eclipse Andmore (which is the successor of ADT). With this I was already able to target android 29 but the network (seems) to not work anymore. I lost somewhere the ability to debug...but still I need to focus on that. Sice I burned 2 days now, I cancel full-throttle mode. I will do till afternoon today and from tomorrow on, I will go on very reduced. (Which realistically might be the end of the effort)

  • Ok,...fore some reason I managed to not save the entry that should be already been written down here ;). So in short: I managed to establish a ssl-connection to my tomcat which is hosting the faw-server

  • I guess it's time for a roadmap for further work:

    1. transfer to gradle as build system I had a look into gradle. And eventhough it gave me much pain when using it (without knowing) for urho3d-android, I do like it. But moving all to gradle would be overkill. Especially as first try... In the end main motiviation was to be able to debug again. I switched back to eclipse photon + ADT and it works... ๐Ÿ˜€ Man, what an IDE-Roundtrip ๐Ÿ˜€๐Ÿ˜€

    2. establish debugging again (android studio?) eclipse photon + ADT it is. Btw, to switch back from Eclipse Andmore to ADT you need to alter the nature in the Android Project to

      <natures>
        <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
      </natures>
      
    3. replace faw-server with nakama? I found out why no more players could be added to faw-server. The problem was that email had a unique-contraint on the database-site (hibernate) which obviously made problems when multiple users did not provide any....so current approach is to make it run with faw. Porting it to nakama is like with gradle before, it would be overkill (but nice)

Day 4:

  • Weekend is over and beside working on "Endzone - A World Apart", Wood-Games have low priority. But I found some late time:
    • Got Server working by setting again this "sql-group"-hack from above. Not sure what this does though.
    • Setting ssl-cert on desktop-version
    • and looked a bit deeper into the game-code.
    • Multiple Users playing "at the same time" works without problems
    • On Android the World-Championchip view is for some reason not visible (I guess because it uses the wrong game-id). At former days there were two separate game-modes for "desktop" and "android". I will cancel this, since desktop is actually not really for playing more for testing and showcasing. Desktop:

      The font is quite small. And on the phone it is hard to actually read anything. I guess this will be a todo later.

Day 5:

  • I found out why Daily Championchip is not visible. I had some kind of screen management where I had display-sizes managed up until y-dimensions of 800px and after that...nothing ๐Ÿ˜€. That was also a good location to scale the font for higher resolutions.
    I really do like this trip back in time...

    here a picture of my old HTC Desire(2010) and my other phones plus on desktop... Lovely, isn't it ๐Ÿ˜€
    Guess next step will be to see what happend with K7...

DAY 6:

  • Reactivated local scores that are stored only on the phone and are shown as "best 5" for each discipline.
  • Nice that I found out today that tomorrow is holiday. I cannot emphasize enough that I do like that fact. I guess tomorrow I will revive K7 - a combination of all disciplines into somekind of compound event...

Day 7:

  • "King7" is back. Now you can have the "decathlon" of the wood competiting in all events leading to one result...
  • Focusing the dashboard on android now moves the selected textfield in an visible area and prevents input being hidden by the virtual keyboard. Also fixed a bug that you couldn't select behind the last character....

Day 8:

  • Reenable password-reset:

    1. the user requests password-reset
    2. the user is lead to the servers website to do this. (do I want to integrate this ingame?? hmm,...i guess not)
    3. the user have to fill in username/password-combination.
    4. if this combination was saved on server the server sends an email to the email-address and a link
    5. if the link is hit, the user can fill in a new password.
    6. the password is changed...
  • Most time took as I had to establish a secure connection to gmail for sending the mail. The old way was not supported anymore and now you need to do so via oauth2-connection. To set this up, was not sooo straight forward, but doable if you know where to do what in the 'google developer console'. What really did help me was this blog post

  • Bugs I found and that needs to be fixed:

    1. Hall of Fame is not visible (just one line). Might be again only on big screens
    2. K7-Sore is not transfered properly (or at all?)
    3. Ingame I rely on the android-back-button to trigger things like showing the menu. I need to add a button for this effect

Day n:

I actually didn't write too much lately but was constantly fixing and changing stuff. Especially the login/user creation screen, layouting and more. I started with a page of points I wanted to tackle thinking that maybe afterwards I will be done just to end up with even more points afterwards.... still some things to do. I also wonder how to handle the european privacy thingy as I'm using a server (not really saving personal data though...) I would like to finish till sunday and reRelease someday next week? I'm a bit exhausted in the Wood case and want to be ready for new stuff :D

Day n+1:

At the moment I try to create a docker-image for the faw-server for an easy deployment. Actually I already you docker for starting mysql and database-frontend. So my plan now is to create a faw-server-dockerimage that is based on the official tomcat-docker and will install fawserver and the needed certificate.
And when I say 'install fawserver' I actually mean the war-file that was created by eclipse. I kind of gave up to move to an IDE-independet building-system. Not that I did try hard but it would have been too much learning until I could have started with this. Same with creating the APK. Not sure how long I will be able to create those with my current eclipse-based setup...I will have to rethink as soon as I am screwed ;)

Some reads:

<< May 14, 2020 | Home | May 16, 2020 >>