Author Topic: sbw2  (Read 11493 times)

0 Members and 1 Guest are viewing this topic.

Tinister

  • Cutest
  • ****
  • Posts: 288
  • Cutes: 10
    • View Profile
  • Pronouns: eax/ebx/ecx/edx
Re: sbw2
« Reply #60 on: April 13, 2016, 01:18:49 AM »
Blank media and shipping labels?

hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #61 on: April 13, 2016, 02:20:47 AM »


i guess i could send them from this government facility

hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #62 on: April 14, 2016, 08:04:33 PM »
i think i finished this minigame


hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #63 on: April 14, 2016, 08:23:57 PM »
up next is a jail location that u can "just visit" or be placed in temporarily if you screw up this minigame lol

hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #64 on: April 15, 2016, 07:11:40 PM »
this just in.... lambda functions are cute as f*ck!!!!!!! :watermelon:

SquareWheel

  • Administrator
  • Cutest
  • *****
  • Posts: 366
  • Cutes: 35
    • View Profile
Re: sbw2
« Reply #65 on: April 15, 2016, 07:50:26 PM »
+1.  Playing with Javascript really turned me on to alternate programming paradigms.

hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #66 on: April 15, 2016, 08:09:48 PM »
yeah its neat..... so right now im trying to minimize one of my classes Entity and it has kind of a bunch of crap that doesnt always get used. entity is basically my equivalent of a game maker object. position, speed, image related stuff, alarms, theres also a hash set of tags for things like collision. but nine times out of ten at least some aspect of this goes unused, and when i feel like i will be wasting resources, i climb the ladder and extend EntityBase (the parent for oddwarg and i's own entity classes) but ultimately this means i have to fill out a bunch of methods. so im making MinEntity which has position, collision support, and alarms. i dropped the image shit because it's way too game maker and for a lot of these objects im not just drawing one sprite, but many, so its ultimately not very helpful. when i do end up using EntityBase, i always end up needing alarms. the implementation for alarms in Entity is reaaaaally naive and bad. its an int array with a size determined in the constructor. each entry in the array is decreased by 1 every step and when one of the entries in the array reaches 0 it invokes a method alarmEvent(int alarmId)..... the alarmEvent functions usually look really cluttered and bad for cutscenes and shit. so instead of all this crap i have a queue of instances of a simple class Alarm that takes an int initialTime and a lambda function event. the time is decreased and the lamba function is called at 0.

the only bummer is that it's not really possible for the lambda function to setup an alarm with the same function.. so in some of these games there might be a timer that ticks every 30 frames, its alarmEvent(int i) would have looked like this

Code: [Select]
public void alarmEvent(int i){
if (i == 0){
   crap();
   alarm[0] = 30;
}
}

this isnt really possible to do with lambda expressions in java, so my solution is the following
Code: [Select]
repeatAlarm(() -> 30, () -> {
double newTime =  Math.max(World.JAIL.stats.get("sentence") - 1, 0);
World.JAIL.stats.set("sentence", newTime);
if (newTime <= 0){

}
else{

}
});

the first argument to repeatAlarm is a lambda function that generates the amount of time each iteration should take. in some of my other classes that do things like Vibrate Wildly, i use a bunch of dumb alarms with random times to take care of Jittering. the second argument is the event. what this is saying is to perform this event every 30 frames. the only problem is there is no way to kill the alarm. my alarm() method could return a reference to the Alarm object would could be appended with a destroy() method or something

hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #67 on: April 15, 2016, 08:31:54 PM »
lol i just removed the xprevious and yprevious fields from Entity and i had never used them anywhere.... good shit

Tinister

  • Cutest
  • ****
  • Posts: 288
  • Cutes: 10
    • View Profile
  • Pronouns: eax/ebx/ecx/edx
Re: sbw2
« Reply #68 on: April 16, 2016, 02:30:30 AM »
Playing with Javascript really turned me on

( ͡ ͜ʖ ͡)

🐰 goodies 🐰

  • Cutey
  • **
  • Posts: 62
  • Cutes: 8
  • corgi using an old macbook lol loser
    • View Profile
  • Pronouns: Him, he
Re: sbw2
« Reply #69 on: April 16, 2016, 05:03:32 PM »
this just in.... lambda functions are cute as f*ck!!!!!!! :watermelon:
It was my favourite feature until I really got to grips with functional list processing

sogood
🐰

🐰 goodies 🐰

  • Cutey
  • **
  • Posts: 62
  • Cutes: 8
  • corgi using an old macbook lol loser
    • View Profile
  • Pronouns: Him, he
Re: sbw2
« Reply #70 on: April 16, 2016, 06:41:09 PM »
yeah its neat..... so right now im trying to minimize one of my classes Entity and it has kind of a bunch of crap that doesnt always get used. entity is basically my equivalent of a game maker object. position, speed, image related stuff, alarms, theres also a hash set of tags for things like collision. but nine times out of ten at least some aspect of this goes unused, and when i feel like i will be wasting resources, i climb the ladder and extend EntityBase (the parent for oddwarg and i's own entity classes) but ultimately this means i have to fill out a bunch of methods. so im making MinEntity which has position, collision support, and alarms.
Okay, so not-working weekend brain here, also I don't program vidjas, and am not really thinking outside the box in regards to all of your requirements.

Objects should represent a single "thing", and should provide all of the behaviours for that; an object that does everything generally leads to how you feel, that it is a bit of a dumping ground. Try making objects around more narrow concepts (you could have a position object that carries the position and provides methods for common transforms and the like). As for the composite entities, you could have a hierarchy of more and more complex entities each provided a more specialised aspect. For instance, a simple entity that doesn't move would just have a position set on construct and no methods to provide any ability to mutate position. You can build on that with a movable entity blahblah. If the specialisation of your entities is also in logic rather than data, you can use interfaces too to add behaviours to entities, again you could have movable with means all of your entities that implement it should be movable in some way. Default methods are new too, which allows you to provide logic in these interfaces: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html

I wouldn't worry about things like this from a performance standpoint. Having a few arbitrary fields isn't going to make any noticeable impact on performance*.

As for event scheduling, I would avoid solving the problem yourself, since it is one that has probably already been solved. Are you using any kind of game framework? This should provide the means to do this out of the box.

* Unless you are making many thousands and/or each field has to do a lot of work to initialise, or contains a LOT of data
🐰

hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #71 on: April 16, 2016, 08:24:08 PM »
nah we're using a custom engine.... so positions and speeds are all represented as vectors. incrementing a position by a directional vector is as simple as pos.add(spd)

i've used default methods before theyre also pretty handy!!!!

theres a lot of variation in the number of Entity instances per minigame, but either way a few floating points that are being wasted arent an emergency situation, but its just the idea of There Is Waste Here kind of bugs me. ur idea of abstracting game behaviors using interfaces is kind of being used already. theres a collideable() method that returns a rectangle.2D that represents the mask... there are some others too that mostly are useful for the editor oddwarg designed....

i think i solved my problem though and im pretty satisfied with it!!!!!! i like that im not using magic ints for the alarm events anymore and i can have references to each alarm if i choose!!!

🐰 goodies 🐰

  • Cutey
  • **
  • Posts: 62
  • Cutes: 8
  • corgi using an old macbook lol loser
    • View Profile
  • Pronouns: Him, he
Re: sbw2
« Reply #72 on: April 16, 2016, 08:53:52 PM »
nah we're using a custom engine.... so positions and speeds are all represented as vectors. incrementing a position by a directional vector is as simple as pos.add(spd)

i've used default methods before theyre also pretty handy!!!!

theres a lot of variation in the number of Entity instances per minigame, but either way a few floating points that are being wasted arent an emergency situation, but its just the idea of There Is Waste Here kind of bugs me. ur idea of abstracting game behaviors using interfaces is kind of being used already. theres a collideable() method that returns a rectangle.2D that represents the mask... there are some others too that mostly are useful for the editor oddwarg designed....

i think i solved my problem though and im pretty satisfied with it!!!!!! i like that im not using magic ints for the alarm events anymore and i can have references to each alarm if i choose!!!
Making your own engine is fair enough, but libraries and frameworks can provide solutions for common tasks such as this. It is fair enough if you are writing it all yourself for hobbyist's sake tho

"able" is generally the suffix of the interface itself, so you would generally have a Collidable interface with standard methods that would allow the object itself to check if it has collided with another itself, in a more "tell don't ask" kinda way
🐰

hubol

  • Cutester
  • *****
  • Posts: 585
  • Cutes: 69
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: sbw2
« Reply #73 on: April 16, 2016, 10:07:18 PM »
oh right yeah i meant theres a Collideable interface with public Rectangle.2D getMask() (once u have the rectangle all you have to do is rect.intersects(rectB)). i figure that returning the mask as a whole is a bit more powerful than just testing for an intersection. the other values found in the rectangle may be of use for the object

i think in general oddwarg probably hates all the available frameworks or simply prefers the amount of control when u write your own. ive been using various iterations of this engine since early 2012
« Last Edit: April 16, 2016, 10:12:25 PM by hubol »

🐰 goodies 🐰

  • Cutey
  • **
  • Posts: 62
  • Cutes: 8
  • corgi using an old macbook lol loser
    • View Profile
  • Pronouns: Him, he
Re: sbw2
« Reply #74 on: April 16, 2016, 10:34:18 PM »
More flexible, but consistently doing that can again lead to huuuuge classes that just do all the work, which are nasty to work with (been there, done that!). See:
https://en.wikipedia.org/wiki/Law_of_Demeter

It is a really easy trap to fall into, and of course you can try and follow this stuff to death at the risk of productivity...but it is good to bear it in mind. Of course, there are places where you have to force the rule which ends up worse than if you just violated it. YMMV.

In terms of my recommendation on using other libraries/frameworks, something that is constantly mentioned in programming is "reinventing the wheel" (https://en.wikipedia.org/wiki/Reinventing_the_wheel). It is again very easy to do this, it is a consistent battle that has to be fought.
🐰