One Hour One Life Forums

a multiplayer game of parenting and civilization building

You are not logged in.

#1 2018-05-01 16:40:14

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Zooming out - Client modification

Before:
imageBefore
After:
imageAfter

First of all i want to say, jason if you dont like this, feel free to delete this thread, i will not reopen it. Am i stepping over a line by doing this? What are the rules?

------

I make this because i think its more fun to play the game zoomed out and i want to show people how it can be done. It makes it easier to orientate yourself, easier to find food, less likley to run into wild animals, easier to spot killers/griefers from further away and so on..

I will not upload this to github and i will not upload any executables. But i will explain how you can change the source code in order to zoom out.
In order to find the correct line number, copy the code that i did not change and search (ctrl+f) for it inside the correct file.

First download the source code and make sure you can compile it. (more about this at the bottom)

Now to the coding, change 2 variables in /OneLife/gameSource/game.cpp

double viewWidth = 1920; // 1280
double viewHeight = 1080; // 720

The zoom factor i am using is 1.5x, so i multiplied 1280*1.5 to get 1920 and 720*1.5 to get 1080.
I put the old values in comments.
If you now compile it and start it, it will look like this:
imageInBetween
Already zoomed out! But the borders are messed up and the health panel is not in the right position.

So lets fix the borders first, therefore we need to change several variables inside /OneLife/gameSource/LivingLifePage.cpp
I must admit, i changed them randomly, not sure what the correct values are but this works fine for me.

// more on left and right of screen to avoid wide object tops popping in
int xStart = gridCenterX - 10; // 7
int xEnd = gridCenterX + 10; // 7

// more on bottom of screen so that tall objects don't pop in
int yStart = gridCenterY - 10; // 6
int yEnd = gridCenterY + 10; // 4

The first four numbers i changed to 10, then i added 3 to the next four numbers

int yStartFloor = gridCenterY - 7; // 4
int yEndFloor = gridCenterY + 6; // 3

int xStartFloor = gridCenterX - 8; // 5
int xEndFloor = gridCenterX + 9; // 6

I put the original values in comments again.
After this change the borders will look nice, and you will be able to see more trees and other objects on the borders. But the panels are still messed up.

So lets fix the panels, this part is a bit messy.
All changes will happen in /OneLife/gameSource/LivingLifePage.cpp
First lets define 2 new constants, you can put them in the first line of the file or next to the other defines.

#define MOVE_PANEL_X 320
#define MOVE_PANEL_Y 180

The reason why 320 and 180 is because (1920-1280)/2 = 320 and (1080-720)/2 = 180
This has to do with the first change we made.
Now we need to change 14 lines:

mNotePaperHideOffset.y = -420 - MOVE_PANEL_Y;

mHomeSlipHideOffset.y = -360 - MOVE_PANEL_Y;

mHungerSlipShowOffsets[i].y = -250 - MOVE_PANEL_Y;

mHungerSlipHideOffsets[i].y = -370 - MOVE_PANEL_Y; 

mHintHideOffset[i].x = 900 + MOVE_PANEL_X; 
mHintHideOffset[i].y = -370 - MOVE_PANEL_Y;
    
panelPos.y -= 242 + 32 + 16 + 6 + MOVE_PANEL_Y;

doublePair pos = { lastScreenViewCenter.x - 590, 
                   lastScreenViewCenter.y - 334 - MOVE_PANEL_Y};

doublePair pos = { lastScreenViewCenter.x - 590, 
                   lastScreenViewCenter.y - 334 - MOVE_PANEL_Y};

doublePair pos = { lastScreenViewCenter.x + 546, 
                   lastScreenViewCenter.y - 319 - MOVE_PANEL_Y};

doublePair pos = { lastScreenViewCenter.x, 
                   lastScreenViewCenter.y - 313 - MOVE_PANEL_Y};
        
doublePair atePos = { lastScreenViewCenter.x, 
                      lastScreenViewCenter.y - 347 - MOVE_PANEL_Y};

doublePair pos = { lastScreenViewCenter.x, 
                   lastScreenViewCenter.y - 313 - MOVE_PANEL_Y};

doublePair barPos = { lastScreenViewCenter.x - 590, 
                   lastScreenViewCenter.y - 334 - MOVE_PANEL_Y};

My strategy for the last 6 variables was to just subtract MOVE_PANEL_Y whenever i see a number thats between 310 and 340.

And thats it! Compile, run and enjoy.

How to compile:
Joriom's tutorial: https://onehouronelife.com/forums/viewtopic.php?id=1438
I think its best to use Ubuntu to compile it. If you dont have Ubuntu you can set up a vm or install a dual boot. (google it)
Here is a nice tutorial from jason: http://onehouronelife.com/compileNotes.php
First create a new folder called whatever.
Then create a new file call it pullAndBuildLatest.
Open the file and copy paste this script into it:
https://raw.githubusercontent.com/jason … uildLatest
Save it. Close it. Right Click it. Properties -> Permission -> Check "Allow executing file as program"
Now rightclick "nothing" inside the folder you created and click on "Open in terminal".
Copy (ctrl+c) and paste (ctrl+SHIFT+v) this:
sudo apt-get install git g++ imagemagick xclip libsdl1.2-dev libglu1-mesa-dev libgl1-mesa-dev
inside the terminal that opened. This will install libraries.
Than write ./pullAndBuildLatest to execute the script you saved.
This will download the latest version from github and then compile it.
If you then make changes to the code you can run the ./runToBuild script in the terminal to compile it. (/runToBuild 1 for ubuntu)

Bonus: (thanks to sliderule)
https://github.com/jasonrohrer/OneLife/ … .cpp#L1587
Replace the string "ABCDEFGHIJKLMNOPQRSTUVWXYZ.-,'?! " with:

mSayField( handwritingFont, 0, 1000, 10, true, NULL,
	"ABCDEFGHIJKLMNOPQRSTUVWXYZ.-,'?! 0123456789_#+*:;\"§$%&/()=\\@€[]{}~^°"),

This allows you to write numbers and some symbols.
But not all symbols work, some of them doesnt show up when you write them but are visible after you pressed enter and some symbols might also get you killed.
For example if you write # you will get a connection lost error, which might be usefull if you want to quickly commit suicide without restarting the game.

Last edited by Drakulon (2018-05-02 19:08:33)

Offline

#2 2018-05-01 18:08:20

Nubbcakes
Member
Registered: 2018-03-26
Posts: 27

Re: Zooming out - Client modification

this is fucking rad tbh!!

ive been wondering if there was a way to possibly run the game fullscreen on an ultrawide resolution, zoomed out like this would be a huge plus. im not experienced with any of this but it sounds like i could tinker with the numbers above and make something work??

Offline

#3 2018-05-01 18:37:13

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

Thanks smile

If you have no experience with programming this wont be easy, but you can do it.
I never had any kind of computer eduction, learned all by myself with google.
Its just a question of time and patient.

The first and maybe hardest thing to do is to compile the source code.
You need to download the source code (text) and use a complier (program) to transform into an executable program.
Normally you can do this with windows as well, but i think noone has figured out a way to do it so far.
So you would need to get Ubuntu (linux based operating system).
You can install a Virtual Machine on windows and then run Ubuntu on it.
And then follow the steps on how to compile it.

After that you need to open different text files and change certain lines like i described above.
Then you can compile it again and you will have a new program, which is now zoomed out.
If you encounter problems feel free to ask.

Offline

#4 2018-05-01 18:46:32

FounderOne
Member
Registered: 2018-03-16
Posts: 336

Re: Zooming out - Client modification

I am playing on a ultrawide monitor too.
I need to run the game in windowed mode. I like to run it fullscreen too.

I set up the vm today and see tomorrow what I can do.


Its a rought world - keep dying untill you live <3

Offline

#5 2018-05-01 18:50:57

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

I am not using an ultrawide monitor, if the game is not running fullscreen for you, than i dont think that this will change it.
The window should stay the same size but everything inside gets smaller. (zoomed out)
Unfortunatly i dont know how to make the game ultrawide monitor compatible

Offline

#6 2018-05-01 18:53:37

YAHG
Member
Registered: 2018-04-06
Posts: 1,347

Re: Zooming out - Client modification

Damn that is cool as shit!

Combat view...


"be prepared and one person cant kill all city, if he can, then you deserve it"  -pein
https://kazetsukai.github.io/onetech/#
https://onehouronelife.com/forums/viewtopic.php?id=1438

Offline

#7 2018-05-01 19:24:36

Nubbcakes
Member
Registered: 2018-03-26
Posts: 27

Re: Zooming out - Client modification

FounderOne wrote:

I am playing on a ultrawide monitor too.
I need to run the game in windowed mode. I like to run it fullscreen too.

I set up the vm today and see tomorrow what I can do.

Drakulon wrote:

I am not using an ultrawide monitor, if the game is not running fullscreen for you, than i dont think that this will change it.
The window should stay the same size but everything inside gets smaller. (zoomed out)
Unfortunatly i dont know how to make the game ultrawide monitor compatible

the problem i found with fullscreen on an ultrawide was mainly that the mouse calibration was off, so it wasn't possible to actually click on an item or an option in the main menu because your actual click would be like 40px off
the quick fix for this is changing the files screenHeight and screenWidth in settings to the dimensions of your monitor
it works, but you get a pretty big pillarbox effect

i'm sorry if this is a little off topic but basically i'm wondering what would happen if i took

double viewWidth = 1920; // 1280
double viewHeight = 1080; // 720

and replaced it with this to fit a 2560 x 1080 resolution

double viewWidth = 3840; // 1280
double viewHeight = 1620; // 720

do you think it would effectively fill the screen or would it just look all wonky? lol

Offline

#8 2018-05-01 20:16:47

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

Nubbcakes wrote:

and replaced it with this to fit a 2560 x 1080 resolution

double viewWidth = 3840; // 1280
double viewHeight = 1620; // 720

do you think it would effectively fill the screen or would it just look all wonky? lol

This will only change the things inside the window, but not the window itself.
So you need to change something else in addition to the viewWidth and viewHeight to change the window itself.
I assume you are using windows? I think in order to change the windows window you need to modify this file:
/minorGems/graphics/win32/graphixFramework.cpp
https://github.com/jasonrohrer/minorGem … mework.cpp
Inside this file i see alot of 640 / 480 numbers.
But i dont have windows and i cannot test this, this might not be the right thing, but you can try ofcourse smile

Offline

#9 2018-05-01 21:50:05

Uncle Gus
Moderator
Registered: 2018-02-28
Posts: 567

Re: Zooming out - Client modification

This looks awesome.

Offline

#10 2018-05-01 22:19:06

jasonrohrer
Administrator
Registered: 2017-02-13
Posts: 4,803

Re: Zooming out - Client modification

Beware of a few things:

1.  If you don't have enough resolution to support this, then all the graphics will be downscaled, which looks ugly and loses detail.  I settled on 1280x720 for a reason, because it will NOT be downscaled on pretty much any semi-modern monitor.

2.  The server is sending map chunks based on its understanding of the client's view area.  To reduce the volume of messages sent, the server cuts it as close as possible, and lets you get pretty close to the edge of your current map chunk before it sends you additional map information.  I expect that you will experience a lot more pop-in, of both biome ground tiles and objects, near the edge of the map when you run this mod, and even a slight spike in network lag will cause loads of pop-in.

The client has no control over what map chunks are sent, so it does not have the power to ask to server for information about a larger area.  Fortunately, because of this, this type of mod puts no additional strain on the server.  But implementing a larger view area that was pop-in-free would put a larger strain on the server.

Offline

#11 2018-05-01 22:23:04

Uncle Gus
Moderator
Registered: 2018-02-28
Posts: 567

Re: Zooming out - Client modification

What if the player was locked in the center without the camera moving around? That might eliminate a little bit of edge-popin.

Offline

#12 2018-05-02 07:07:01

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

I missed 2 variables:

mHungerSlipHideOffsets[i].y = -370 - MOVE_PANEL_Y; 

doublePair barPos = { lastScreenViewCenter.x - 590, 
                   lastScreenViewCenter.y - 334 - MOVE_PANEL_Y};

i updated the op


jasonrohrer wrote:

1.  If you don't have enough resolution to support this, then all the graphics will be downscaled, which looks ugly and loses detail.  I settled on 1280x720 for a reason, because it will NOT be downscaled on pretty much any semi-modern monitor.

Oh ok, i am using an older monitor (11 years) and it works fine for me, i dont know how it looks on any other monitor.
Maybe we could have an option in the settings menu, to change the window size and view size, probably not the perfect solution but some people might like it and they could maybe configure the game so it fits their monitors better.

jasonrohrer wrote:

2.  The server is sending map chunks based on its understanding of the client's view area.  To reduce the volume of messages sent, the server cuts it as close as possible, and lets you get pretty close to the edge of your current map chunk before it sends you additional map information.  I expect that you will experience a lot more pop-in, of both biome ground tiles and objects, near the edge of the map when you run this mod, and even a slight spike in network lag will cause loads of pop-in.

So pop-in means this white stuff when the map doesnt load, i dident know. I experience this when my camera is not in the middle. I agree with uncle gus, maybe its a good idea to lock the camera for this mod.

jasonrohrer wrote:

The client has no control over what map chunks are sent, so it does not have the power to ask to server for information about a larger area.  Fortunately, because of this, this type of mod puts no additional strain on the server.  But implementing a larger view area that was pop-in-free would put a larger strain on the server.

I am glad i am not harming the servers with this smile

Offline

#13 2018-05-02 08:24:36

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

But i am not sure if its ok to write this "hacks" and publicly share them.
Jason when you make this game you make it with a certain difficulty, this changes the difficulty slightly.
I dont think that this particular change has a negative effect on other players who dont use it, but it still messes with the games difficulty.
I thought about adding a feature which would make it so, that if you have only 1 hunger left, the client tries to eat automatically whatever food is in your hand, backpack or basket that you are holding, maybe also picking berries from bushes that are very close. Sometimes when i starve, i panic, accidentally missclick and then die.
What is your opinion on this? Maybe we can draw a line somewhere between things that are ok and those which are not.
For example an aimbot would be very unfair to other players who play the game, for me its obvious this is wrong.
But maybe also changing the game difficulty is wrong.

Last edited by Drakulon (2018-05-02 08:25:50)

Offline

#14 2018-05-02 11:05:02

Baker
Member
Registered: 2018-03-06
Posts: 445

Re: Zooming out - Client modification

I gotta try this, I'm not great at this kind of thing but I gotta try it. I'm curious as to how larger civs would look like with this, would make exploring a lot easier.

Although having this definitely gives you an advantage over others, You can see them when they can't see you. Could be used for both and bad.


"I came in shitting myself and I'll go out shitting myself"

Offline

#15 2018-05-02 11:11:42

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

Baker wrote:

Although having this definitely gives you an advantage over others, You can see them when they can't see you. Could be used for both and bad.

Ok i agree, it gives an advantage. You can use it to better plan how to kill everyone inside a village.
You can grief and if someone comes you can run away before he sees you.

Offline

#16 2018-05-02 23:51:30

spamvictim
Member
Registered: 2018-03-12
Posts: 12

Re: Zooming out - Client modification

That's how u write a tutorial, haha

Offline

#17 2018-05-03 00:14:50

Anshin
Member
Registered: 2018-04-01
Posts: 614

Re: Zooming out - Client modification

palisade wrote:

Someone should try to hook zooming into the mouse wheel.

That would be wonderful as part of the official game.

Offline

#18 2018-05-03 02:13:58

YAHG
Member
Registered: 2018-04-06
Posts: 1,347

Re: Zooming out - Client modification

I wonder if your bow range is increased via this mod?


"be prepared and one person cant kill all city, if he can, then you deserve it"  -pein
https://kazetsukai.github.io/onetech/#
https://onehouronelife.com/forums/viewtopic.php?id=1438

Offline

#19 2018-05-03 02:38:31

Alleria
Member
Registered: 2018-03-30
Posts: 339

Re: Zooming out - Client modification

YAHG wrote:

I wonder if your bow range is increased via this mod?

Bow range is three tiles, so nope. However, this is hugely advantageous for scouting and learning the layout of your area. I often spend the first few minutes of a life working out where things are, and this mod would mean I wouldn't have to do that at all. I'm not sure how I feel about it, but it definitely changes the difficulty of the game by a huge degree. Would do a lot to making griefing easier to identify, and aid in communication - both huge pluses both for balance and for RP/culture. Hypothetically, I think it'd be fair to remove the food bonus entirely, if this was made widely available.

Last edited by Alleria (2018-05-03 02:39:28)


"Words build bridges into unexplored regions"

Offline

#20 2018-05-04 05:07:36

YAHG
Member
Registered: 2018-04-06
Posts: 1,347

Re: Zooming out - Client modification

Alleria wrote:
YAHG wrote:

I wonder if your bow range is increased via this mod?

Bow range is three tiles, so nope. However, this is hugely advantageous for scouting and learning the layout of your area. I often spend the first few minutes of a life working out where things are, and this mod would mean I wouldn't have to do that at all. I'm not sure how I feel about it, but it definitely changes the difficulty of the game by a huge degree. Would do a lot to making griefing easier to identify, and aid in communication - both huge pluses both for balance and for RP/culture. Hypothetically, I think it'd be fair to remove the food bonus entirely, if this was made widely available.

I am gonna try it I am thinking, also want to try the type numbers thing. Wizard powers and shit.


"be prepared and one person cant kill all city, if he can, then you deserve it"  -pein
https://kazetsukai.github.io/onetech/#
https://onehouronelife.com/forums/viewtopic.php?id=1438

Offline

#21 2018-05-04 09:32:54

TrustyWay
Member
Registered: 2018-03-12
Posts: 570

Re: Zooming out - Client modification

Can I do these change and still have update ?

Offline

#22 2018-05-04 09:41:29

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

I just updated the game with my modified client and it works fine.
But it could happen that jason changes something and then you have to do the whole tutorial again.
And if jason rewrites code that is modified in this tutorial, then we need a new tutorial smile

Offline

#23 2018-05-04 15:00:09

Joriom
Moderator
From: Warsaw, Poland
Registered: 2018-03-11
Posts: 565
Website

Re: Zooming out - Client modification

I'll make dedicated repository for the edited versions of game.cpp and LivingLifePage.cpp so you can merge those into fresh clone. I hope you don't mind Drakulon? All I need to do is to learn how to merge single file from different remote repository. Shouldn't be hard though.

Offline

#24 2018-05-04 15:08:44

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: Zooming out - Client modification

Joriom sure you can do whatever you want with this
Everyone can do whatever they want with this

Last edited by Drakulon (2018-05-04 15:11:19)

Offline

#25 2018-05-04 15:19:21

KucheKlizma
Member
Registered: 2018-04-14
Posts: 100

Re: Zooming out - Client modification

Joriom wrote:

I'll make dedicated repository for the edited versions of game.cpp and LivingLifePage.cpp so you can merge those into fresh clone. I hope you don't mind Drakulon? All I need to do is to learn how to merge single file from different remote repository. Shouldn't be hard though.

I think this may be what you're looking for:
https://stackoverflow.com/questions/515 … -directory

Offline

Board footer

Powered by FluxBB