Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Re:creation - a top down action adventure about undeads [hiatus]  (Read 501766 times)

0 Members and 5 Guests are viewing this topic.

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re:creation - a top down action rpg about undeads
« Reply #45 on: May 14, 2015, 05:17:16 pm »
You recommend encode them to binary/resource files, or compile as libraries? What's your method?

I don't know what he does but Lua is "compilable" with luac

fakepotato

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • Email
Re:creation - a top down action rpg about undeads
« Reply #46 on: May 14, 2015, 05:25:32 pm »
So luac is 100% safe?
Infinite insomnia.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re:creation - a top down action rpg about undeads
« Reply #47 on: May 14, 2015, 05:40:02 pm »
Are you trying to say that you think something is "safe" (from tampering) because it is in binary and not script form?  If so, you are mistaken - and that goes for not just lua but your c++ object files as well.

Ricky

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Tejada
    • Email
Re:creation - a top down action rpg about undeads
« Reply #48 on: May 14, 2015, 06:05:56 pm »
So luac is 100% safe?

I say embrace modding because just look what it did for Minecraft. It helps build a community around your product and also means that the community is making content that you don't have to and you still make sales!

I'd totally let the community tear the game apart and do what they wanted.
Wilt thou yet say before him that slayeth thee, I am God? but thou shalt be a man, and no God, in the hand of him that slayeth thee.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #49 on: May 14, 2015, 06:23:52 pm »

 
Did you really struggle to render a few sprites on the screen? This kind of game usually needs no optimization in rendering, modern cards hold a lot more draw calls than that :D
Nah, it was running in 60 FPS all the time. Rendering was just taking too long compared to other stuff and I've thought I could optimize it a bit. This chunk system even helped me realize how to store levels more efficiently so it's a double win!

Your tutorials about Lua bindings are awesome.
I have question, though. What about security? Everyone can see and edit scripts.
You recommend encode them to binary/resource files, or compile as libraries? What's your method?
As far as i know, your re:creation game won't be open source, so i suppose you solved that problem somehow to hide realization from users.
Thanks for replies  :)
Thanks!
I have no problems with users reading and editing my scripts. I can say I even embrace that. Modding is awesome (this is what got me into gamedev!) and I'll do some stuff to help modders mod my game if they show some interest in it (some documentation, some tools like level editor, etc.). I think it's a good thing that people may use my scripts because it may help them improve their scripting or see awesomeness of Lua!
As for luac... Maybe I'll use it if scripts slow down my game. But it makes modding harder which is not what I want. :)

So luac is 100% safe?

I say embrace modding because just look what it did for Minecraft. It helps build a community around your product and also means that the community is making content that you don't have to and you still make sales!

I'd totally let the community tear the game apart and do what they wanted.

Totally agreed!
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #50 on: May 14, 2015, 06:39:43 pm »
Can you tell me the advantages of using scripts instead of just writing it in c++? I was just thinking how hard can it be to just translate the lua into c++ and then not have to use another language.

P.S. I'm pretty sure you've been stealing my ideas directly out of my head, because about a year ago, I was going to make a game which used a similar game mechanic as the game, but with a different context, I never told anyone about it, didn't finish or post it, and then a year later you've made what looks like a brilliant game based around a concept I couldn't be bothered to make the artwork for.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #51 on: May 14, 2015, 07:13:16 pm »
Can you tell me the advantages of using scripts instead of just writing it in c++? I was just thinking how hard can it be to just translate the lua into c++ and then not have to use another language.
The main advantage is getting rid of hard coded values and hard coded gameplay logic in C++. Scripts make your code a lot more flexible (no need to recompile if you change anything in them). They are also useful in Entity/Component/System because you can't create a class for each type of an entity and writing lots of if/else stuff for different objects is just awful.
So, for example, when I have objects which will behave uniquely if you collide with them, I just write a script function and it gets the job done.

P.S. I'm pretty sure you've been stealing my ideas directly out of my head, because about a year ago, I was going to make a game which used a similar game mechanic as the game, but with a different context, I never told anyone about it, didn't finish or post it, and then a year later you've made what looks like a brilliant game based around a concept I couldn't be bothered to make the artwork for.
Great minds think alike, haha! Thanks. :)
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #52 on: May 14, 2015, 07:17:22 pm »
Ah I think I get what you're talking about. Well, I get why you do it anyway, I don't think I'll ever leave pure c++ because I prefer the object orientated style, where I give classes identifiers so the in the given example, the class can tell whether or not the think it collided with is special. Oh, and for the record, I think your way of controlling enemies is better than mine because mine was something like venom from spiderman in that you played as a symbiotic goo and so I would have had to draw a player controlled version of every enemy instead of your way of just controlling them.

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re:creation - a top down action rpg about undeads
« Reply #53 on: May 14, 2015, 07:20:30 pm »
What about security? Everyone can see and edit scripts.
You recommend encode them to binary/resource files, or compile as libraries? What's your method?

There are plenty of Lua decompilers out there, and the output tends to be pretty straightforward.

Can you tell me the advantages of using scripts instead of just writing it in c++? I was just thinking how hard can it be to just translate the lua into c++ and then not have to use another language.

1. You don't have to recompile the whole game every time you make a change.

2. Lua is more flexible than C++ in some ways, which can make some tasks easier to accomplish in Lua.

3. Lua is a higher-level language than C++, generally, you can get more done in less time.

4. Makes it easier to include modding support.

5. Helps to keep your C++ code clean. Less implementation specific stuff clogging it up.

6. Almost requires a good design for your C++ code. Having messy C++ code can make it more difficult to bind it to Lua.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #54 on: May 14, 2015, 07:31:47 pm »
Ah I think I get what you're talking about. Well, I get why you do it anyway, I don't think I'll ever leave pure c++ because I prefer the object orientated style, where I give classes identifiers so the in the given example, the class can tell whether or not the think it collided with is special. Oh, and for the record, I think your way of controlling enemies is better than mine because mine was something like venom from spiderman in that you played as a symbiotic goo and so I would have had to draw a player controlled version of every enemy instead of your way of just controlling them.

You can mix OOP and Lua quite easily. No need to recompile is a big thing for gamedev. I can change and fine-tune gameplay logic and different variables during the run time. This makes development a lot faster.

And dabbertorres wrote about some cool advantages I've missed. I strongly encourage you to try out scripts. If you don't like them - no problem, everyone has their own dev process. But just trying out different stuff is great and can improve your code a lot, especially scripting.
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #55 on: May 14, 2015, 07:34:20 pm »
I have done some stuff with Unity, is that the same thing?

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #56 on: May 14, 2015, 07:55:38 pm »
I have done some stuff with Unity, is that the same thing?
I've never used Unity, so I can't tell (but I know that it has cool scripting system so I think you can make changes when your game is running). Basically it works like this for my game:

1) Load the game
2) Test some stuff
3) Make some changes in a script
4) Reload the script using in-game console
5) Changes are now in the game and I can test stuff again. :)
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #57 on: May 14, 2015, 07:59:43 pm »
Yeah that's pretty much how it is in Unity.
When you want to do that, you make the variable you want to change visible in the inspector and then change it while you're running the program. Then put the value in the scripts when you stop the program.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #58 on: May 15, 2015, 09:41:30 am »
I've improved level format

See these dark gray squares? These are empty chunks. There maybe a lot of them because levels may not be in form of a rectangle. 
When I didn't use chunks, I've had to save large empty areas because all tiles were stored in one big 2d array. So it looked like this in a file (-1 is an empty tile id):

1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,...
1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,...
1,1,4,1,5,1,1,1,-1,-1,-1,-1,-1,-1,...
1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,...
1,1,1,5,1,1,1,1,-1,-1,-1,-1,-1,-1,...
1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,...
1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,...

Lots of space wasted, right? Not anymore! Now I store levels like this (posX and posY indicate index of top-left tile in chunk):

...
chunk posX=-8 posY=-13
42,42,42,42,42,42,42,42,
30,30,30,30,30,30,30,30,
9,9,9,9,9,9,9,9,
13,13,13,13,13,13,13,13,
13,13,13,13,13,13,13,13,
52,52,52,52,52,52,52,52,
1,1,1,1,1,11,1,1,
31,1,11,2,1,1,23,1,
chunk posX=-32 posY=-5
1,1,1,1,1,13,13,13,
1,1,1,1,1,13,13,13,
1,1,1,1,1,13,13,13,
1,1,1,1,1,13,13,13,
1,1,1,1,1,13,13,13,
1,1,1,1,1,13,13,13,
1,1,1,1,1,13,13,13,
1,1,1,1,1,13,13,13,
...

Chunks are still stored in one 2d array (it's easier to work with them that way), but empty chunks are very lightweight (all they have is empty sf::VertexArray and std::vector<std::vector<int>>) so it's not a problem.
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #59 on: May 15, 2015, 10:32:50 am »
Could I suggest filling the empty spaces with dense forest (just copy and paste your trees), because that makes it look more realistic, while still means you don't have rectangular levels.

 

anything