Return to Level1Techs.com

Psycho_666 game project... again

devember2k18

#21

Psh ill aboose it if i have to


#22

Mutant aboose… This is how the Xmen sentinel future happened… Mutant aboobs… Hm… Mutant boobs…
Boobs…
What were we talking about?


#23

Your 5 votes behind the leader sadly


#24

Curious what’s the leader now?


#25

- DAY 1 -
goal: Create a global settings controller, that will store settings like resolution, difficulty settings, UI scaling, etc etc…
So I made that and I immediately moved to the next goal - resolution change. So I was struggling for about an hour with that, cause I wasn’t really looking up how am I supposed to do it properly.
The hour is gone.
So the goal for day 2 is to make the thing change resolutions. I’m not entirely sure how I will do that, but still…

PS: I remember having the same issue long time ago - it changes the resolution, it changes everything, but the window size on the screen. And I can’t quite recall how to fix that.


#26

I just checked it out and apparently in this version they have made it way easier than before. They just added a new variable that wasn’t here before, so after work tonight I may try it out…


#27

Hmm so why not play a programming game?
Something without much writing, like:

Post your solutions.


#28

DAY 2

ZZZzzz…

DAY 3

ZZZzzz…

DAY 4

Fucking hell, did I really just forgot I had my devember thing while reading other people’s devember things? Fuck me sideways… I have 3 days to catch up… So let’s do that…

Goal: Change resolution…
For now I decided I don’t want to make all possible resolutions. I’ll make 2 resolutions and just make sure the resolution change works. Adding more of them will be easy enough once the thing works.

So I set the two resolutions:

w_1080=1920;
h_1080=1080;
w_768=1024;
h_768=768;

And then I set up two buttons to change the resolution:

switch (keyboard_key)
{
case ord(“P”):
//setrting the camera view
view_wview[0] = w_1080;
view_hview[0] = h_1080;
view_wport[0] = view_wview[0];
view_hport[0] = view_hview[0];

    //Resize Application Surface
    surface_resize(application_surface, view_wview[0], view_hview[0]);
    window_set_size(view_wview[0], view_hview[0]);
    display_set_gui_size(view_wview[0], view_hview[0]);
    break;
case ord("O"):
    //setrting the camera view
    view_wview[0] = w_768;
    view_hview[0] = h_768;
    view_wport[0] = view_wview[0];
    view_hport[0] = view_hview[0];

    //Resize Application Surface
    surface_resize(application_surface, view_wview[0], view_hview[0]);
    window_set_size(view_wview[0], view_hview[0]);
    display_set_gui_size(view_wview[0], view_hview[0]);
    break;
}

It’s a large switch statement, that works nicely in those cases.
There is a nice little bug on 1080p resolution and I can’t quite figure it out. It outstretches it way larger than 1920px width and I have no idea why.



That’s actually a look into the forest my dude is walking in :smiley:
Goal - complete.

Now with that out the way:
Goal: resize the banner of the boy. At larger resolution that banner will be so tiny.
Right. I had a plan, that backfired, so I made it way way easier.
Added a simple scale variable.
Added this line to the drawing event:

draw_sprite_stretched(spr_banner,0,x-(sprite_get_width(spr_banner)(1+scale))/2,y-
(sprite_get_height(spr_banner)
(1+scale))/2,sprite_get_width(spr_banner)*
(1+scale),sprite_get_height(spr_banner)*(1+scale));

The forum is sh… for posting mathematical calculations. Using * makes the font “Italic” and that wasn’t the goal. Not quite sure how to post code properly TBH…
Anyways, after a lot of tweaking I found this to be pretty nice scaling code:

//View controll
view_xport[1]=x-sprite_width0.9(1+scale)/2;
view_yport[1]=y-sprite_height0.8(1+scale)/2;

//change the banner size
switch (keyboard_key)
{
case ord (“K”):
scale=0.5;
view_wport[1]=sprite_width0.9(1+scale);
view_hport[1]=sprite_height0.8(1+scale);
break;
case ord (“L”):
scale=0;
view_wport[1]=sprite_width0.9;
view_hport[1]=sprite_height
0.8;
break;
}



Goal - Complete.

Goal: Build a couple more dungeons…
Mkay, so currently I just have the forest.


What I want to do is build up let’s say 2 extra for now and make a basic system where the charager physically walks into a specific dungeon, so when later on I fill the dungeons with random encounters and events it will literally “clear” them up from the world.
Honestly I’ve been working for 2 hours and I am planing on letting this rest for tomorrow.
So Day 5 I will be doing this and I will be doing multilevel dungeons as well… Extra mechanic in the game I want to set up now so I don’t have to shift everything later on.


#29

That resolution thing is bugging me …
You know what, I’m going to completely rework the resolution system.
Basically I’m going to make a whole main menu screen. It will save me a lot of work later on since I’m gonna do it now.
So goal for day 5 is to make main menu screen and try to set resolution and banner size scaling so it doesn’t look blurry.


#30

DAY 5 & DAY 6
Fuck me I’m so rusty…
Goal: Make a main menu and fix the resolution change bug…
I’m actually used to make those kinds of things. It’s actually the thing I am best at - connecting variables to button presses. Now it took me about half an hour to just remember how to do a stupid color shift on mouseover…



YEY…
Next up - resolution change algorithm, that will save the settings in an external file so when I boot the game again, it will read the settings from the file and not reset every time.
So I made kinda step by step menu creation and… Well…





It’s working…

ini_open(“Settings.ini”);
ini_write_real(“resolution”,“horisontal”,1920)
ini_write_real(“resolution”,“vertical”,1080)
ini_close();

//resizing the game window
view_wview[0] = 1920;
view_hview[0] = 1080;
view_wport[0] = 1920;
view_hport[0] = 1080;

surface_resize(application_surface, 1920, 1080);
window_set_size(1920, 1080);

If I press “new game” I just go into the already existing room where all the gameplay will happen. All I have to do now is carry the resolution changes from the main menu to the game room itself.
So I wrote this:

ini_open(“Settings.ini”);
view_wview[0]=ini_read_real(“resolution”,“horisontal”,1280);
view_hview[0]=ini_read_real(“resolution”,“vertical”,768);
view_wport[0]=ini_read_real(“resolution”,“horisontal”,1280);
view_hport[0]=ini_read_real(“resolution”,“vertical”,768);
surface_resize(application_surface, ini_read_real(“resolution”,“horisontal”,1280), ini_read_real(“resolution”,“vertical”,768));
window_set_size(ini_read_real(“resolution”,“horisontal”,1280), ini_read_real(“resolution”,“vertical”,768));
ini_close();

And bam - it works…
I also added a debug text, that shows me what the resolution, written inside the file is, so…
720p



1080p


It actually centered itself on the main monitor, and I am OK with that…

Goal - complete.
It took me way more than an hour, and honestly it shouldn’t have. And today is 6-th, so I will cheat a bit and add that as DAY 6 as well…

Tomorrow I will try and add an algorithm for dungeon generation. Basically scale the world, so the dungeons doesn’t show up if you play 1440p for example.


#31

How’d the dungeon generation go?


#32

Just got home from work… Warming up my dinner, and when I’m done with that I will jump into the project…
Then I will write a summary. Basically in about 4-5 hours there will be an update…


#33

Riiiight…
It’s 9-th today so I have to keep up…

Day 7 (and 8)
Goal: Create a system, that will generate dungeons out of sight of the camera no matter the resolution. If the resolution changes that system should just shift the dungeons away from the camera, so the “trick” stays out of sight and it’s still magic god damn it…

Boring theory:
So my general idea is to make a dungeon controller object.
This one will create other dungeon objects. Those secondary dungeon objects will be responsible for creating the backgrounds (the idea is to have modular backgrounds, so I can mix and match, but for now I’m gonna use a single image just to make sure it works), later on the loot chests, the encounters, etc etc.
For this to work properly I have to start with some setup… A 2D array is required. So…

//array setup
for(i=0;i<3;i++)
{
for(j=1;j<3;j++)
{
dungeon[i,j]=0;
}
}

//dungeon setup in an array
dungeon[0,0]=obj_dungeon_0;
dungeon[1,0]=obj_dungeon_1;
dungeon[2,0]=obj_dungeon_2;

ini_open(“Settings.ini”);
h_res=ini_read_real(“resolution”,“horisontal”,1280);
v_res=ini_read_real(“resolution”,“vertical”,768);
ini_close();

//generating dungeon locations on the world map
for(i=0;i<3;i++)
{
dungeon[i,1]=irandom_range(sprite_get_width(spr_banner),h_res-sprite_get_width(spr_banner));
dungeon[i,2]=irandom_range(sprite_get_height(spr_banner),v_res/2);
instance_create(dungeon[i,1],dungeon[i,2],dungeon[i,0]);
}

This basically creates the 3 dungeons at random locations in the bottom half of the map.


SUXASS… I mean success… I just want them in the lower half, so I will payed a bit with the generation code and replaced one line with this:

dungeon[i,2]=irandom_range(v_res/2,v_res-sprite_get_height(spr_banner));


Right, that’s OK, it just looks like it’s generating them at the same locations, and I used the random function to “spread them out” a bit…

that’s beautiful.

the 720p resolution just generates them at the same locations… Hmmmm…
I don’t understand what’s going on with that…
Will pause now and do my most favorite thing of all - research…

PS: This is not really a big issue, since I am going to generate precise locations based on a seed later on, so I won’t use random function for that. Still I am curious what’s wrong with it…


#34

Right… Good… I see where the issue is. It’s an engine quirk…


To help out:

NOTE: This function will return the same value every time the game is run afresh due to the fact that GameMaker: Studio generates the same initial random seed every time to make debugging code a far easier task. To avoid this behaviour use randomize at the start of your game.

So the random function gives me the same numbers. Now that’s logical…
Seems like adding

randomize();

at the beginning of the game should fix the issue. Let’s test and see…


YES… FUCK ME YES… OK, don’t fuck me…
Moving right along…
I have one background sprite atm. I shall create couple more, so I have one for each dungeon. Just to make sure the algorithms and systems I am making are working properly.
So I made that. Added them as element 3 of the array, so I can just call them from every object no matter what.
Then I did this in the draw_event:

for(i=0;i<floor(obj_dungeon_ctrl.h_res/sprite_get_width(obj_dungeon_ctrl.dungeon[index,3]));i++)
{
for(j=1;j<4;j++)
{
draw_sprite(obj_dungeon_ctrl.dungeon[index,3],0,sprite_get_width(obj_dungeon_ctrl.dungeon[index,3])/2+sprite_get_width(obj_dungeon_ctrl.dungeon[index,3])*i,obj_dungeon_ctrl.v_res+(index+1)*sprite_get_height(obj_dungeon_ctrl.dungeon[index,3]*j));
}
}

Right… I also added a line to help me show the locations of each dungeon in the overall room.


So… It’s all fine. It’s drawing them where they should be, since there is a background behind the guy walking around. But it’s also drawing them on the screen and I don’t know why.
Hard coding 100 extra to the Y location shifted it outside the view. That is perfect. I also thought of a way to simplify the entire code, since it’s extremely wrong and I have easier ways to check for stuff…
So for a start I won’t try and draw 3 layers. I’ll try drawing one and finding out what’s going on with that…

for(i=0;i<floor(view_wview[0]/sprite_get_width(obj_dungeon_ctrl.dungeon[index,3]));i++)
{
draw_sprite(obj_dungeon_ctrl.dungeon[index,3],0,sprite_get_width(obj_dungeon_ctrl.dungeon[index,3])/2+sprite_get_width(obj_dungeon_ctrl.dungeon[index,3])*i,view_hview[0]+(index+1)*sprite_get_height(obj_dungeon_ctrl.dungeon[index,3]));
}


Right, it’s working so far…

My framerate dropped from 2700 to 1600 so I don’t think that’s the best implementation.
Maybe I should physically build the dungeons and not just draw them. That way the system shouldn’t stress about drawing stuff constantly.

Right… I started about 3 hours ago… Let’s say I made 2 hours of work, so that covers my Day 8 as well. Bending the rules to fit my thing.

Tomorrow I will fix a SMALL bug that’s bugging me… Then I will do a couple changes to the algorithm and try to pass 2K fps. I still haven’t put any mechanics and heavy shit into the game. Once those are in, the framerate will start dropping like nobody’s business… I need to keep it as high as possible.
Then I will make a small changes to a couple places and actually make the guy walk the actual dungeons and not just somewhere… The idea is he should walk where the background is drawn, so it looks like he is walking in the dungeon.

C U all tomorrow.


#35

That’s pseudo-random number generators for you.
You could randomize with a particular seed and get the same map every time, stuff like that?


#36

The goal of giving the same random numbers is to ease up the debugging process. Basically you know the random numbers are always the same, so the issue is somewhere else, not in the randomness. I get their idea, but I just want random numbers.

Oh yeah, I will do that later on, but for now I need to be sure the basics are working properly before I jump into the procedural generation.


#37

Right…
DAY 9
There is a small bug in the drag and drop system of the banner. The camera view, drawn in the middle of it seems to be a dead zone negating any mouse clicks. So I am not going to rely on the built in mouse click functionality as much and just make sure when I’m clicking my mouse is in the boundaries of the banner and then activate dragging no matter if the game agrees or not.

I tried using the Mouseover function, but the view seems to negate that as well.

However I found another function, that seems to be working with the mouse and views combo, which is exactly what I want.
It will make it even simpler, cause I can remove quite a lot of code and use just a couple lines to deal with the drag and drop functionality.

Nope, it’s not working at all. I will do some “research” by which I mean I will ask in the GameMaker forums for help.
Currently I have no idea how to fix the issue.


#38

Right. After some extra thinking and nobody answering my questions in the game maker forums I have decided to go as low level as possible and start dealing with basic X and Y coordinates. The engine is supposed to have functionality to deal with that for me, but the entire premise of the “window into the life of a character” is negating the built-in functions. So I have to write my own.
The good thing is this way I have extreme control over what’s going on.
The bad thing is I will have to go back and do some re-programing to make it easier for myself later on.

So tonight after I finish work I will see what I can do about it.


#39

DAY 10

Nevermind it’s actually 11-th…

Goal: clean up the drag and drop system.
I removed everything, that’s even remotely connected to the old drag and drop system and did all the coding a new.

And this doesn’t work either.
I may have to try and code outside the object I want to move, which is beyond awful solution…
I will try first to mask an invisible object just to try and trick the mouse…

I really have absolutely no idea how to deal with that issue…

PS: hm… I have a weird Idea… Going to work now so I will try it out tomorrow…

PS2: noo… This won’t work either. The game just moves my mouse location into the view coordinates, so I have to take the view coordinates into account next time.
The formula will be larger than my big fat ass, but the important thing is, I want it to work.
I have to deal with the view on top of dealing with the banner the view is projected onto. So I need 2 drag and drop systems…
For fucks sake…


#40