Client progress


#1

The goals I have with this client are:

  • remove the dependence on Graal
  • utilize hardware capabilities to a more significant extent (no 1980s 20 FPS cap, high performance that should be expected from a simple 2D game)
  • enable much more interesting graphical modifications through the use of shaders
  • provide a more C++ style (in terms of syntax, at least) scripting language that can be modified as needed
  • provide an option to have a server that doesn’t use levels for its gameplay if desired
  • allow for more precise control of server and client communication, which is critical for smooth player/NPC movement
  • to have as little hard-coded as possible

Highlights of work done so far:

  • Syntax error reporting for the script compiler is incredibly detailed to make it much easier to track down and understand what/where the code error is.
  • The scripting language is quite flexible and easy to use.

Below is the current state of the client, including what needs to be done. Updates will be posted in this thread.

Struckout text indicates a completed step.
Red text indicates areas currently being worked on.
Yellow text indicates areas previously under development that have been put on hold.

  • Script engine
    • Compiler
    • Interpreter
    • Integration with the rendering engine
    • Language API planning

  • Rendering core
    • Image loading
    • Text rendering

  • UI
    • Child clipping
    • Z-ordering
    • Basic window
    • Basic controls
      • Button
      • Editbox
      • Combobox

  • Levels
    • Format specification
    • Graal level conversion to the new format
    • Map loading
    • Rendering
    • Maps (Adjacent levels) (Will need a brief revisit later to support multiple maps.)

  • Scripts
    • Events
    • NPCs

  • Simple image rendering (Basic version implemented… doesn’t have all of the needed features yet.)

  • Animations (Will need a revisit for additional features.)

  • Networking
    • Server

  • Script engine optimization

#2

I guess I that can pretend that I read and understood it.


#3

I’d like to hear more about function pointers since it’s the first time I read about it. As in bush.ForceRespawn, what triggers the respawn script to run?

Will referencing work too if I do something like:
library = new Library();
library.addimage(“universe.gif”);

cat = new Cat(library.images);

library.resizeverything();

-> in this case the library images inside cat would be resized too.

And more importantly, will array dynamically resize themselves?
Say I make a new array of size 5 then add something in the 7th position, will the array automagically resize itself?


#4

While that’s kinda a cool suggestion, I find it an encouragement to design your code in an improper fashion. If you wanted a dynamic array why not just request that codr implement a linked-list like structure within the language.
On that note…
I think it’d be nice to have such implemented data structures that could then be extended upon by end users to write something like a queue or a stack.

Another thing, will arrays store objects or strictly floating points/integers. Because being able to store function pointers would be pretty groovy, at least in my opinion and with that, would you then allow mixed data types and entrust to the programmer that they be careful with how they assign values?
Variable concatenation is also another thing I can see as being a nice feature if anyone would ever chose to use it but I’d assume that’s a pretty standard feature you’d implement regardless.


#5

Of course.

Are you referring to the name of the variable? If so, then yes, dynamic names will be possible, just like Graal.


#6

Push and pop pls


#7

I don’t know why you say that but I’ll trust you on it.

Awesome!

Lolll.


#8

There are situations where they’re the right choice, but people use them outside of those situations just because they like the name or something.

Having memory spread out in random locations and “linked” together with pointers is an excellent way to torture your processor and slow everything down needlessly.


#9

All I know is that it is a feature Java has and that the code I’m basing myself on for my game uses that kind of technique… I haven’t investigated much on alternatives but it sounded like a cool idea to use objects passed in other objects as pointers/references since I wouldn’t need to refresh my object after modifying it through one of its methods.

A better example could be:
bush = new plant();
tree = new plant();
sprout = new plant();

if(area.wetness > 40){
plant.setrespawntime(10);
} else {
plant.setrespawntime(40);
}

In this case plant.setrespawntime would set all the plant’s respawn times to 10 or 40.

Of course a workaround could be:
if(area.wetness > 40){
respawntime = 10;
} else {
respawntime = 40;
}

bush = new plant(respawntime);
tree = new plant(respawntime);
sprout = new plant(respawntime);

By the way, how could I be able to access multiple objects with a for loop.
as in:
myArray = {bush,tree,sprout};
for(i = 0; i < myArray.size(); i++){
myArray[i].setrespawntime(40);
}

Would work but it’s always sexier to have a for each construct:
for(element in myArray){
element.setrespawntime(40);
}

Will there also be a way to check if an object is of a given type or would we need to code it for every object?
for(element in myArray){
if(element.type == plant){ // in opposition to element.type == “plant” if I need to hardcode it.
element.setrespawntime(40);
}
}

Additionnaly, will I be able to compare strings without strequals and co? What kind of typing will you use? Duck? Sounds like you’re aiming for duck typing so far but I just want to make sure.


#10

Ewww, nooooo. Please no.


#11

Why not? O_o


#12

How about GS2 since we already know it works?


#13

Haven’t you read the other topic?
GS2 is a mess and pushes us into making messy code.


#14

Mark forums read


#15

GS2 isn’t really THAT bad to most people. It’s just unacceptable to me, and a language can definitely be done better.

Considering a compiler has to be made either way, it makes no sense at all to use an inferior language.


#16

I have a question for those who actually read this and respond.

Do any of you see any purpose of inline functions? That is, being able to define a function inside of another function.

function whatever() { newFunction = () { hi, i do some shit too }; newFunction(); }

There can be uses for it when trying to make things more dynamic, but it’s nothing that can’t be done by defining the function the normal way. It seems to me that it’s just adding complexity for the purpose of adding complexity.


#17

I’ve never used it.
It would be nice though to have functions return multiple values (that is if you plan functions to return anything) as in:

bush.size,bush.respawntime = mahUberFunction(somevalue);

function mahUberFunction(somevalue){
if(somevalue > 10){
return 10,10;
} else {
return 5,5;
}
}

That could be useful, unless as in gs1 every var is considered as global, which I do not have anything against, I’m pretty creative when it comes to naming variables. And I find it way easier to add restrictions to new variables one by one(such as adding this. before the name so it is specific to the npc) than having to go back in my code and rewrite stuff every time I realize a new variable needs a bigger scope.


#18

That won’t be possible, however, you can return an array.

[code]function f() {
return {1,2,3};
}
array = f();
array[2] == 3

or even:

f()[2] == 3[/code]

Edit: I’ve also updated the first post with more details on some of the more complicated concepts of the language.


#19

Bro, do you even OO?


#20

More than one return value? No. Just use pointers and arrays for that.

More than one return value would mean weird datatypes.

Edit: i see codr already addressed this